about summary refs log tree commit diff stats
path: root/cpp/tangle/makefile
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-18 14:48:19 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-18 14:48:19 -0800
commit01b2852b653a81c4d5e197a0c52659c7e0dcaf5f (patch)
tree9c9864846c27191afd73b4c1a44810ac0fdd1091 /cpp/tangle/makefile
parent9fc64bbc95bb4e55f28f5262d0f5c660177f0a19 (diff)
downloadmu-01b2852b653a81c4d5e197a0c52659c7e0dcaf5f.tar.gz
782 - promote literate version to canonical C++ version
Diffstat (limited to 'cpp/tangle/makefile')
-rw-r--r--cpp/tangle/makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/cpp/tangle/makefile b/cpp/tangle/makefile
new file mode 100644
index 00000000..3d938c09
--- /dev/null
+++ b/cpp/tangle/makefile
@@ -0,0 +1,23 @@
+tangle: makefile type_list function_list file_list test_file_list test_list
+	g++ -O3 -Wall -Wextra -fno-strict-aliasing boot.cc -o tangle
+
+type_list: boot.cc [0-9]*.cc
+	@# assumes struct decl has space before '{'
+	@grep -h "^struct .* {" [0-9]*.cc |perl -pwe 's/(struct *[^ ]*).*/$$1;/' > type_list
+	@grep -h typedef [0-9]*.cc >> type_list
+
+function_list: boot.cc [0-9]*.cc
+	@# assumes function decl has space before '{'
+	@grep -h "^[^ #].*) {" [0-9]*.cc |perl -pwe 's/ {.*/;/' > function_list
+
+file_list: boot.cc [0-9]*.cc
+	@ls [0-9]*.cc |grep -v "\.test\.cc$$" |perl -pwe 's/.*/#include "$$&"/' > file_list
+
+test_file_list: [0-9]*.test.cc
+	@ls [0-9]*.test.cc |perl -pwe 's/.*/#include "$$&"/' > test_file_list
+
+test_list: [0-9]*.cc
+	@grep -h "^[[:space:]]*void test_" [0-9]*.cc |perl -pwe 's/^\s*void (.*)\(\) {$$/$$1,/' > test_list
+
+clean:
+	rm -rf tangle *_list