about summary refs log tree commit diff stats
path: root/cpp/literate/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/literate/makefile')
-rw-r--r--cpp/literate/makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/cpp/literate/makefile b/cpp/literate/makefile
new file mode 100644
index 00000000..97187383
--- /dev/null
+++ b/cpp/literate/makefile
@@ -0,0 +1,26 @@
+mu: makefile tangle/tangle mu.cc
+	g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc -o mu
+	-@./mu test
+
+# To see what the program looks like after all layers have been applied, read
+# mu.cc
+mu.cc: 0*
+	./tangle/tangle --until 999 > mu.cc
+	@make autogenerated_lists >/dev/null
+
+tangle/tangle:
+	cd tangle && make
+
+# auto-generated files; by convention they end in '_list'.
+.PHONY: autogenerated_lists
+autogenerated_lists: mu.cc function_list test_list
+
+function_list: mu.cc
+	@grep -h "^[^ #].*) {" mu.cc |perl -pwe 's/ {.*/;/' > function_list
+
+test_list: mu.cc
+	@grep -h "^[[:space:]]*void test_" mu.cc |perl -pwe 's/^\s*void (.*)\(\) {.*/$$1,/' > test_list
+
+clean:
+	cd tangle && make clean
+	rm -rf mu.cc mu *_list