summaryrefslogtreecommitdiffstats
path: root/script2makefile
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2012-07-03 17:52:57 -0400
committerDJ Delorie <dj@delorie.com>2012-07-03 17:52:57 -0400
commit682b4ba85c22ab9862304cb883a7234373e3f893 (patch)
treec8f5f090dbe0e324d377c629a8f6361db4fd68cd /script2makefile
parent3d5366a613c9b6b5f76dd091c1b4b46ca3d5710e (diff)
downloadbootstrap-682b4ba85c22ab9862304cb883a7234373e3f893.tar.gz
bootstrap-682b4ba85c22ab9862304cb883a7234373e3f893.tar.xz
bootstrap-682b4ba85c22ab9862304cb883a7234373e3f893.zip
script->make, ccache move
Convert build iteration logic (stage 2) from list driven to Makefile driven. Add actual dependencies to recipe files and use them to control build sequence. ccache is moved to stage1 and configured to be used in stage2.
Diffstat (limited to 'script2makefile')
-rw-r--r--script2makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/script2makefile b/script2makefile
new file mode 100644
index 0000000..63701a5
--- /dev/null
+++ b/script2makefile
@@ -0,0 +1,38 @@
+#!/usr/bin/make
+
+SCRIPTDIR := recipe.d
+FRAGDIR := recipe.mk
+RCFILE := ./scripts.rc
+
+SCRIPTS := $(sort $(wildcard ${SCRIPTDIR}/*[0-9A-Za-z]))
+FRAGS := $(addsuffix .mk,$(addprefix ${FRAGDIR}/,$(notdir $(SCRIPTS))))
+
+${FRAGDIR}/%.mk : ${SCRIPTDIR}/%
+ @( \
+ if grep '^#skip' $< >/dev/null ; then true; else \
+ deps=`grep '^#requires ' $< | sed 's@#requires @done\/@'` ;\
+ deps=`echo $$deps` ;\
+ base=`echo $* | sed 's/^[0-9][0-9][0-9][0-9]-//'` ;\
+ echo TARGETS += done/$$base ;\
+ echo ".PHONY: $$base" ;\
+ echo "$$base : done/$$base" ;\
+ echo " @true" ;\
+ echo "done/$$base : $$deps" ;\
+ echo " @echo " ;\
+ echo " @echo Building $$base" ;\
+ echo " @echo " ;\
+ echo " @bash --rcfile ${RCFILE} -i ${SCRIPTDIR}/$*" ;\
+ echo " @true > done/$$base" ;\
+ fi \
+ ) > $@
+
+all.first : all.targets
+ @true
+
+TARGETS :=
+
+include ${FRAGS}
+
+all.targets : ${TARGETS}
+ @echo
+ @echo 'done!'