diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-18 14:48:19 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-18 14:48:19 -0800 |
commit | 01b2852b653a81c4d5e197a0c52659c7e0dcaf5f (patch) | |
tree | 9c9864846c27191afd73b4c1a44810ac0fdd1091 /cpp/makefile | |
parent | 9fc64bbc95bb4e55f28f5262d0f5c660177f0a19 (diff) | |
download | mu-01b2852b653a81c4d5e197a0c52659c7e0dcaf5f.tar.gz |
782 - promote literate version to canonical C++ version
Diffstat (limited to 'cpp/makefile')
-rw-r--r-- | cpp/makefile | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/cpp/makefile b/cpp/makefile index 0dcdbce5..97187383 100644 --- a/cpp/makefile +++ b/cpp/makefile @@ -1,25 +1,26 @@ -mu: makefile type_list function_list file_list test_file_list test_list - g++ -O3 -Wall -Wextra -fno-strict-aliasing boot.cc -o mu +mu: makefile tangle/tangle mu.cc + g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc -o mu + -@./mu test -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 +# 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 -function_list: boot.cc [0-9]*.cc - @# assumes function decl has space before '{' - @grep -h "^[^ #].*) {" [0-9]*.cc |perl -pwe 's/ {.*/;/' > function_list - @grep -h "^[[:space:]]*TEST(" [0-9]*.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list +tangle/tangle: + cd tangle && make -file_list: boot.cc [0-9]*.cc - @ls [0-9]*.cc |grep -v "\.test\.cc$$" |perl -pwe 's/.*/#include "$$&"/' > file_list +# auto-generated files; by convention they end in '_list'. +.PHONY: autogenerated_lists +autogenerated_lists: mu.cc function_list test_list -test_file_list: [0-9]*.test.cc - @ls [0-9]*.test.cc |perl -pwe 's/.*/#include "$$&"/' > test_file_list +function_list: mu.cc + @grep -h "^[^ #].*) {" mu.cc |perl -pwe 's/ {.*/;/' > function_list -test_list: [0-9]*.cc - @grep -h "^[[:space:]]*void test_" [0-9]*.cc |perl -pwe 's/^\s*void (.*)\(\) {$$/$$1,/' > test_list - @grep -h "^[[:space:]]*TEST(" [0-9]*.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/test_$$1,/' >> test_list +test_list: mu.cc + @grep -h "^[[:space:]]*void test_" mu.cc |perl -pwe 's/^\s*void (.*)\(\) {.*/$$1,/' > test_list clean: - rm -rf mu* *_list + cd tangle && make clean + rm -rf mu.cc mu *_list |