### -*-makefile-*- .SECONDEXPANSION: #sorry all:: CROSSDIR := $(shell pwd) FLAVOURS += linux-cross linux-cross_ARCHS = linux-armel linux-armhf linux-arm64 linux-armel_ARCH = arm-linux-gnueabi linux-armhf_ARCH = arm-linux-gnueabihf linux-arm64_ARCH = aarch64-linux-gnu FLAVOURS += linux-native linux-native_ARCHS = linux-i386 linux-amd64 linux-i386_ARCH = i686-linux-gnu linux-amd64_ARCH = x86_64-linux-gnu FLAVOURS += android-cross android-cross_ARCHS = android-arm android-arm64 android-x86 android-x86_64 android-arm_ARCH = arm-linux-androideabi android-arm64_ARCH = aarch64-linux-android android-x86_ARCH = i686-linux-android android-x86_64_ARCH = x86_64-linux-android V = 0 v_tag = $(call v_tag_$V,$1) v_tag_0 = @printf " %-8s %s\n" "$1" "$@"; V_AT = $(V_AT_$V) V_AT_0 = @ define define-setup SETUPS += etc/$2-setup.sh $2_FLAVOUR = $1 endef $(foreach f,$(FLAVOURS), \ $(foreach a,$($f_ARCHS), \ $(eval $(call define-setup,$f,$a)))) TARGETS += $(SETUPS) setup-flavour = $($1_FLAVOUR) $(SETUPS): etc/%-setup.sh: $$(call setup-flavour,$$*)-setup.sh.in Makefile $(V_AT)mkdir -p $(dir $@) $(call v_tag,SED)sed 's/@arch@/$($*_ARCH)/g' $< >$@.new && \ mv $@.new $@ SCRIPTS = mdw-cross crosstool BINSCRIPTS = $(addprefix bin/,$(SCRIPTS)) TARGETS += $(BINSCRIPTS) $(BINSCRIPTS): bin/%: src/%.in $(V_AT)mkdir -p $(dir $@) $(call v_tag,SED)sed 's@crossdir@$(CROSSDIR)' $< >$@.new && \ chmod +x $@.new && mv $@.new $@ all:: $(TARGETS) CLEANFILES += $(TARGETS) clean::; rm -f $(CLEANFILES) show:; : $(VAR)