SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) TXT_FILES := $(wildcard $(SRCDIR)*.txt) NAMES := $(notdir $(basename $(TXT_FILES))) OUTS := $(addprefix out/,$(addsuffix /boot.scr,$(NAMES))) # Default target: build everything .PHONY: all all: $(OUTS) # Pattern rule # out//boot.scr is built from .txt out/%/boot.scr: %.txt @mkdir -p $(dir $@) mkimage -A arm -T script -O linux -d $< $@ .PHONY: clean clean: rm -rf out