about summary refs log tree commit diff stats
path: root/cpp/makefile
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-23 20:35:31 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-23 20:35:31 -0700
commit56ce557708c8387dc0fae590f10e4db62d409fa5 (patch)
treed409bcaea29aef040648cdecd3ab1ada67cf4236 /cpp/makefile
parent732fd9b0ccaad2cad88ced9bd48f840350652b1e (diff)
downloadmu-56ce557708c8387dc0fae590f10e4db62d409fa5.tar.gz
1151
Diffstat (limited to 'cpp/makefile')
-rw-r--r--cpp/makefile14
1 files changed, 11 insertions, 3 deletions
diff --git a/cpp/makefile b/cpp/makefile
index 75ed8424..98982f08 100644
--- a/cpp/makefile
+++ b/cpp/makefile
@@ -17,9 +17,7 @@ tangle/tangle:
 termbox/libtermbox.a:
 	cd termbox && make
 
-# auto-generated files; by convention they end in '_list'.
 .PHONY: autogenerated_lists test valgrind clena
-autogenerated_lists: mu.cc function_list test_list
 
 test: mu
 	./mu test
@@ -27,11 +25,21 @@ test: mu
 valgrind: mu
 	valgrind --leak-check=yes ./mu test
 
+# auto-generated files; by convention they end in '_list'.
+autogenerated_lists: mu.cc function_list test_list
+
+# autogenerated list of function declarations, so I can define them in any order
 function_list: mu.cc
-	# declarations for lines starting with non-space and ending with ') {', except methods
+	# functions start out unindented, have all args on the same line, and end in ') {'
+	#  																		ignore methods
 	@grep -h "^[^[:space:]#].*) {" mu.cc |grep -v ":.*(" |perl -pwe 's/ {.*/;/' > function_list
+	# occasionally we need to modify a declaration in a later layer without messing with ugly unbalanced brackets
+	# assume such functions move the '{' to column 0 of the very next line
+	@grep -v "^#line" mu.cc |grep -B1 "^{" |grep -v "^{" |perl -pwe 's/$$/;/' >> function_list
+	# test functions
 	@grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list
 
+# autogenerated 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