diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-06 20:14:30 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-06 20:14:30 -0700 |
commit | 6acea7626e7ab335d9af2c75510f08e9019e75c9 (patch) | |
tree | f48c8e2c40710f9d80c2a7ebe5591ce96ddef706 /build | |
parent | 7b9cb78d681d69258f26c7cd4882dfe15a7047bb (diff) | |
download | mu-6acea7626e7ab335d9af2c75510f08e9019e75c9.tar.gz |
3452
Fix the sense of a shell function. Somehow in all these years I hadn't realized that 0 is true and non-zero is false for purposes of *nix shells' `&&` and `||` operators. Suddenly Urbit doesn't seem so far out..
Diffstat (limited to 'build')
-rwxr-xr-x | build | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/build b/build index 3b12d6eb..b4caa99d 100755 --- a/build +++ b/build @@ -22,17 +22,17 @@ older_than() { then #? echo "$target doesn't exist" echo "updating $target" >&2 - return 1 + return 0 # success fi for f in $* do if [ $f -nt $target ] then echo "updating $target" >&2 - return 1 + return 0 # success fi done - return 0 + return 1 # failure } noisy_cd() { @@ -40,72 +40,72 @@ noisy_cd() { echo "-- `pwd`" >&2 } -older_than enumerate/enumerate enumerate/enumerate.cc || { +older_than enumerate/enumerate enumerate/enumerate.cc && { $CXX $CFLAGS enumerate/enumerate.cc -o enumerate/enumerate } noisy_cd tangle - older_than type_list [0-9]*.cc || { + older_than type_list [0-9]*.cc && { grep -h "^struct .* {" [0-9]*.cc |sed 's/\(struct *[^ ]*\).*/\1;/' > type_list grep -h "^typedef " [0-9]*.cc >> type_list } - older_than function_list [0-9]*.cc || { + older_than function_list [0-9]*.cc && { grep -h "^[^ #].*) {" [0-9]*.cc |sed 's/ {.*/;/' > function_list } - older_than file_list [0-9]*.cc || { + older_than file_list [0-9]*.cc && { ls [0-9]*.cc |grep -v "\.test\.cc$" |sed 's/.*/#include "&"/' > file_list } - older_than test_file_list [0-9]*.test.cc || { + older_than test_file_list [0-9]*.test.cc && { ls [0-9]*.test.cc |sed 's/.*/#include "&"/' > test_file_list } - older_than test_list [0-9]*.cc || { + older_than test_list [0-9]*.cc && { grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > test_list } - older_than tangle boot.cc *_list || { + older_than tangle boot.cc *_list && { $CXX $CFLAGS boot.cc -o tangle } noisy_cd .. LAYERS=$(./enumerate/enumerate --until $UNTIL_LAYER |grep -v '.mu$') -older_than mu.cc $LAYERS enumerate/enumerate tangle/tangle || { +older_than mu.cc $LAYERS enumerate/enumerate tangle/tangle && { ./tangle/tangle $LAYERS > mu.cc } -older_than function_list mu.cc || { +older_than function_list mu.cc && { grep -h "^[^[:space:]#].*) {$" mu.cc |grep -v ":.*(" |sed 's/ {.*/;/' > function_list } -older_than test_list mu.cc || { +older_than test_list mu.cc && { grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' > test_list } -older_than cleave/cleave cleave/cleave.cc || { +older_than cleave/cleave cleave/cleave.cc && { $CXX -O3 -Wall -Wextra -fno-strict-aliasing cleave/cleave.cc -o cleave/cleave rm -rf .build } -older_than mu_bin mu.cc *_list cleave/cleave || { +older_than mu_bin mu.cc *_list cleave/cleave && { mkdir -p .build cp function_list test_list .build mkdir -p .build/termbox cp termbox/termbox.h .build/termbox ./cleave/cleave mu.cc .build noisy_cd .build - older_than global_declarations_list global_definitions_list || { + older_than global_declarations_list global_definitions_list && { grep ';' global_definitions_list |sed 's/[=(].*/;/' |sed 's/^[^\/# ]/extern &/' |sed 's/^extern extern /extern /' > global_declarations_list } for f in mu_*.cc do - older_than `echo $f |sed 's/\.cc$/.o/'` $f || { + older_than `echo $f |sed 's/\.cc$/.o/'` $f && { $CXX $CFLAGS -c $f } done noisy_cd ../termbox - older_than utf8.o utf8.c || { + older_than utf8.o utf8.c && { $CC $CFLAGS -c utf8.c } - older_than termbox.o termbox.c termbox.h input.inl output.inl bytebuffer.inl || { + older_than termbox.o termbox.c termbox.h input.inl output.inl bytebuffer.inl && { $CC $CFLAGS -c termbox.c } - older_than libtermbox.a *.o || { + older_than libtermbox.a *.o && { ar rcs libtermbox.a *.o } noisy_cd .. @@ -116,6 +116,8 @@ older_than mu_bin mu.cc *_list cleave/cleave || { ## [0-9]*.mu -> core.mu MU_LAYERS=$(./enumerate/enumerate --until $UNTIL_LAYER |grep '.mu$') || exit 0 # ok if no .mu files -older_than core.mu $MU_LAYERS || { +older_than core.mu $MU_LAYERS && { cat $MU_LAYERS > core.mu } + +exit 0 |