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-05-19 23:17:41 +04:00
# preferences
- i n c l u d e $( HOME ) / . m k i m a g e / p r o f i l e s . m k
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
2012-07-16 22:10:54 +04:00
ARCHES := $( shell arch | sed 's/i686/i586/; s/armv.*/arm/; s/ppc.*/ppc/' )
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-04-06 21:13:32 +04:00
export PATH := $( CURDIR) /bin:$( PATH)
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)
2012-04-06 21:13:32 +04:00
POSTPROC := | report-filter > $( REPORT_PATH)
2012-03-19 15:42:10 +04:00
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
2012-07-28 13:26:08 +04:00
DIRECT_TARGETS := help help/distro help/ve help/vm clean distclean check
2012-04-24 12:11:04 +04:00
.PHONY : $( DIRECT_TARGETS )
$(DIRECT_TARGETS) :
2011-12-30 14:46:58 +04:00
@$( MAKE) -f main.mk $@
export NUM_TARGETS := $( words $( MAKECMDGOALS) )
2012-04-25 17:56:48 +04:00
# for pipefail
SHELL = /bin/bash
2012-07-09 22:31:37 +04:00
# don't even consider remaking a configuration file
.PHONY : $( HOME ) /.mkimage /profiles .mk
2012-01-11 12:41:24 +04:00
# real targets need real work
2011-12-30 14:46:58 +04:00
% :
@n= 1; \
2012-04-25 17:56:48 +04:00
set -o pipefail; \
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 ; \
2012-07-17 21:42:37 +04:00
say " ** ARCH: $$ ARCH " ; \
2012-04-23 18:07:39 +04:00
if $( MAKE) -f main.mk ARCH = $$ ARCH $@ $( POSTPROC) ; then \
if [ -n " $$ REPORT " ] ; then \
$( MAKE) -f reports.mk ARCH = $$ ARCH; \
fi ; \
fi ; \
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