about summary refs log tree commit diff stats
path: root/build2
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2018-03-13 09:04:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2018-03-13 09:04:07 -0700
commit5763322b9cc8cf8c8caed6b62919a680ed907c9a (patch)
tree59f8ed25317587fb6c0b61676d7a0a18358fdd21 /build2
parent075498ec164b53600cf33d8fd070c003b1dc8cdf (diff)
downloadmu-5763322b9cc8cf8c8caed6b62919a680ed907c9a.tar.gz
4221 - more docs about build process
Diffstat (limited to 'build2')
-rwxr-xr-xbuild214
1 files changed, 14 insertions, 0 deletions
diff --git a/build2 b/build2
index 881f2702..beb536df 100755
--- a/build2
+++ b/build2
@@ -86,14 +86,22 @@ older_than enumerate/enumerate enumerate/enumerate.cc && {
 
 older_than tangle/tangle tangle/*.cc && {
   noisy_cd tangle
+    # auto-generate various lists (ending in '_list' by convention) {
+    # list of types
     {
       grep -h "^struct .* {" [0-9]*.cc  |sed 's/\(struct *[^ ]*\).*/\1;/'
       grep -h "^typedef " [0-9]*.cc
     }  |update type_list
+    # list of function declarations, so I can define them in any order
     grep -h "^[^ #].*) {" [0-9]*.cc  |sed 's/ {.*/;/'  |update function_list
+    # list of code files to compile
     ls [0-9]*.cc  |grep -v "\.test\.cc$"  |sed 's/.*/#include "&"/'  |update file_list
+    # list of test files to compile
     ls [0-9]*.test.cc  |sed 's/.*/#include "&"/'  |update test_file_list
+    # list of tests to run
     grep -h "^[[:space:]]*void test_" [0-9]*.cc  |sed 's/^\s*void \(.*\)() {$/\1,/'  |update test_list
+    # }
+    # Now that we have all the _lists, compile 'tangle'
     $CXX $CFLAGS boot.cc -o tangle
   noisy_cd ..  # no effect; just to show us returning to the parent directory
 }
@@ -110,7 +118,12 @@ older_than cleave/cleave cleave/cleave.cc && {
 }
 
 mkdir -p .build
+# auto-generate function declarations, so I can define them in any order
+# functions start out unindented, have all args on the same line, and end in ') {'
+#
+#                                      \/ ignore methods
 grep -h "^[^[:space:]#].*) {$" mu.cc  |grep -v ":.*("  |sed 's/ {.*/;/'  |update .build/function_list
+# auto-generate list of tests to run
 grep -h "^\s*void test_" mu.cc  |sed 's/^\s*void \(.*\)() {.*/\1,/'  |update .build/test_list
 mkdir -p .build/termbox
 update_cp termbox/termbox.h .build/termbox
@@ -118,6 +131,7 @@ update_cp termbox/termbox.h .build/termbox
 older_than mu_bin mu.cc *_list cleave/cleave termbox/* && {
   ./cleave/cleave mu.cc .build
   noisy_cd .build
+    # create the list of global variable declarations from the corresponding definitions
     grep ';' global_definitions_list  |sed 's/[=(].*/;/'  |sed 's/^[^\/# ]/extern &/'  |sed 's/^extern extern /extern /'  |update global_declarations_list
     for f in mu_*.cc
     do