diff options
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | makefile | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/index.html b/index.html index fb8f2c47..2938f838 100644 --- a/index.html +++ b/index.html @@ -64,7 +64,7 @@ that point. <a href='http://akkartik.name/post/wart-layers'>More details →< to show how to hook into the skeleton. Also summarizes how to invoke Mu, behaviors that later layers will be providing. <br/><a href='html/002test.cc.html'>002test.cc</a>: Mu's minimalist test -harness, relying on a couple of one-liners in the makefile to autogenerate +harness, relying on a couple of one-liners in the makefile to auto-generate lists of tests to run. <br/><a href='html/003trace.cc.html'>003trace.cc</a>: support for logging facts about our program, and for <a href='http://akkartik.name/post/tracing-tests'>checking the facts logged in tests</a>. diff --git a/makefile b/makefile index 86d9fab9..5b7aa4e9 100644 --- a/makefile +++ b/makefile @@ -18,6 +18,7 @@ mu_bin: mu.cc makefile function_list test_list cleave/cleave @cp function_list test_list .build @mkdir -p .build/termbox @cp termbox/termbox.h .build/termbox + @# split mu.cc into separate compilation units under .build/ to speed up recompiles ./cleave/cleave mu.cc .build @# recursive (potentially parallel) make to pick up BUILD_SRC after cleave @make .build/mu_bin @@ -51,7 +52,7 @@ termbox/libtermbox.a: termbox/*.c termbox/*.h termbox/*.inl # auto-generated files; by convention they end in '_list'. -# autogenerated list of function declarations, so I can define them in any order +# auto-generated list of function declarations, so I can define them in any order function_list: mu.cc @# functions start out unindented, have all args on the same line, and end in ') {' @# ignore methods @@ -62,13 +63,15 @@ function_list: mu.cc @# test functions @grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list -# autogenerated list of tests to run +# auto-generated list of tests to run test_list: mu.cc @grep -h "^\s*void test_" mu.cc |perl -pwe 's/^\s*void (.*)\(\) \{.*/$$1,/' > test_list @grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/test_$$1,/' >> test_list +# auto-generated list of extern declarations to global variables +# for separate compilation .build/global_declarations_list: .build/global_definitions_list - grep ';' .build/global_definitions_list |perl -pwe 's/[=(].*/;/' |perl -pwe 's/^[^\/# ]/extern $$&/' |perl -pwe 's/^extern extern /extern /' > .build/global_declarations_list + @grep ';' .build/global_definitions_list |perl -pwe 's/[=(].*/;/' |perl -pwe 's/^[^\/# ]/extern $$&/' |perl -pwe 's/^extern extern /extern /' > .build/global_declarations_list .PHONY: all clean clena |