summaryrefslogtreecommitdiffstats
path: root/script2makefile
diff options
context:
space:
mode:
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!'