df0861ad02
The point is to give Colin S. Miller the credit for a hack to get the current goal's word-in-a-list position: http://lists.gnu.org/archive/html/help-gnu-utils/2010-05/msg00004.html
37 lines
774 B
Makefile
37 lines
774 B
Makefile
# umbrella mkimage-profiles makefile:
|
|
# iterate over multiple goals/arches
|
|
|
|
# immediate assignment
|
|
ifndef ARCHES
|
|
ifdef ARCH
|
|
ARCHES := $(ARCH)
|
|
else
|
|
ARCHES := $(shell arch | sed 's/i686/i586/')
|
|
endif
|
|
endif
|
|
export ARCHES
|
|
|
|
# recursive make considered useful for m-p
|
|
MAKE += --no-print-directory
|
|
|
|
.PHONY: clean distclean help
|
|
clean distclean help:
|
|
@$(MAKE) -f main.mk $@
|
|
|
|
export NUM_TARGETS := $(words $(MAKECMDGOALS))
|
|
|
|
# real targets need real work
|
|
%:
|
|
@n=1; \
|
|
if [ "$(NUM_TARGETS)" -gt 1 ]; then \
|
|
n="`echo $(MAKECMDGOALS) \
|
|
| tr '[[:space:]]' '\n' \
|
|
| grep -nx "$@" \
|
|
| cut -d: -f1`"; \
|
|
echo "** goal: $@ [$$n/$(NUM_TARGETS)]"; \
|
|
fi; \
|
|
for ARCH in $(ARCHES); do \
|
|
$(MAKE) -f main.mk ARCH=$$ARCH $@; \
|
|
done; \
|
|
if [ "$$n" -lt "$(NUM_TARGETS)" ]; then echo; fi
|