2011-12-30 14:46:58 +04:00
# umbrella mkimage-profiles makefile:
2012-03-19 15:42:10 +04:00
# iterate over multiple goals/arches,
# collect proceedings
2011-12-30 14:46:58 +04:00
2012-03-19 15:42:10 +04:00
# for immediate assignment
2011-12-30 14:46:58 +04:00
i f n d e f A R C H E S
i f d e f A R C H
ARCHES := $( ARCH)
e l s e
ARCHES := $( shell arch | sed 's/i686/i586/' )
2011-11-21 15:42:59 +04:00
e n d i f
2011-10-06 12:46:31 +04:00
e n d i f
2011-12-30 14:46:58 +04:00
export ARCHES
2012-03-19 15:42:10 +04:00
# supervise target tracing; leave stderr alone
i f d e f R E P O R T
export REPORT_PATH := $( shell mktemp --tmpdir mkimage-profiles.report.XXXXXXX)
POSTPROC := | bin/report-filter > $( REPORT_PATH)
e n d i f
2011-12-30 14:46:58 +04:00
# recursive make considered useful for m-p
2012-03-19 15:42:10 +04:00
MAKE += -r --no-print-directory
2011-12-30 14:46:58 +04:00
.PHONY : clean distclean help
clean distclean help :
@$( MAKE) -f main.mk $@
export NUM_TARGETS := $( words $( MAKECMDGOALS) )
2012-01-11 12:41:24 +04:00
# real targets need real work
2011-12-30 14:46:58 +04:00
% :
@n= 1; \
2012-03-19 15:42:10 +04:00
say( ) { echo " $$ @ " >& 2; } ; \
2011-12-30 14:46:58 +04:00
if [ " $( NUM_TARGETS) " -gt 1 ] ; then \
n = " `echo $( MAKECMDGOALS) \
| tr '[[:space:]]' '\n' \
| grep -nx " $@ " \
| cut -d: -f1` " ; \
2012-03-19 15:42:10 +04:00
say " ** goal: $@ [ $$ n/ $( NUM_TARGETS) ] " ; \
2011-12-30 14:46:58 +04:00
fi ; \
for ARCH in $( ARCHES) ; do \
2012-03-19 15:42:10 +04:00
if [ " $$ ARCH " != " $( firstword $( ARCHES) ) " ] ; then say; fi ; \
say " ** ARCH: $$ ARCH " >& 2; \
$( MAKE) -f main.mk ARCH = $$ ARCH $@ $( POSTPROC) ; \
$( MAKE) -f reports.mk ARCH = $$ ARCH; \
2011-12-30 14:46:58 +04:00
done ; \
2012-03-19 15:42:10 +04:00
if [ " $$ n " -lt " $( NUM_TARGETS) " ] ; then say; fi