6206
This commit is contained in:
parent
d6f9813650
commit
11f7f7b812
|
@ -4,27 +4,17 @@
|
|||
set -v
|
||||
set -e # stop immediately on error
|
||||
|
||||
cd ../../tangle
|
||||
cd ../../tools
|
||||
# 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
|
||||
} > type_list
|
||||
# list of function declarations, so I can define them in any order
|
||||
grep -h "^[^ #].*) {" [0-9]*.cc |sed 's/ {.*/;/' > function_list
|
||||
# list of code files to compile
|
||||
ls [0-9]*.cc |grep -v "\.test\.cc$" |sed 's/.*/#include "&"/' > file_list
|
||||
# list of test files to compile
|
||||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' > test_file_list
|
||||
grep -h "^[^ #].*) {" tangle.cc |sed 's/ {.*/;/' > tangle.function_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list
|
||||
grep -h "^[[:space:]]*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > tangle.test_list
|
||||
grep -h "^\s*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > tangle.test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
g++ -std=c++98 -g -O2 boot.cc -o tangle
|
||||
g++ -std=c++98 -g -O3 tangle.cc -o tangle
|
||||
./tangle test
|
||||
cd ../archive/2.vm
|
||||
cd ../archive/1.vm
|
||||
|
||||
cd termbox
|
||||
gcc -g -O2 -c termbox.c
|
||||
|
@ -32,7 +22,7 @@ cd termbox
|
|||
ar rcs libtermbox.a *.o
|
||||
cd ..
|
||||
|
||||
../../tangle/tangle [0-9]*.cc > mu.cc
|
||||
../../tools/tangle [0-9]*.cc > mu.cc
|
||||
# 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 ') {'
|
||||
#
|
||||
|
|
|
@ -21,29 +21,19 @@ export CXXFLAGS="-std=c++98 $CFLAGS" # CI has an ancient version; don't expect
|
|||
# (layers) | |
|
||||
# tangle $CXX
|
||||
|
||||
$CXX $CFLAGS ../../enumerate/enumerate.cc -o ../../enumerate/enumerate
|
||||
$CXX $CFLAGS ../../tools/enumerate.cc -o ../../tools/enumerate
|
||||
|
||||
cd ../../tangle
|
||||
cd ../../tools
|
||||
# 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
|
||||
} > type_list
|
||||
# list of function declarations, so I can define them in any order
|
||||
grep -h "^[^ #].*) {" [0-9]*.cc |sed 's/ {.*/;/' > function_list
|
||||
# list of code files to compile
|
||||
ls [0-9]*.cc |grep -v "\.test\.cc$" |sed 's/.*/#include "&"/' > file_list
|
||||
# list of test files to compile
|
||||
ls [0-9]*.test.cc |sed 's/.*/#include "&"/' > test_file_list
|
||||
grep -h "^[^ #].*) {" tangle.cc |sed 's/ {.*/;/' > tangle.function_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list
|
||||
grep -h "^[[:space:]]*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > tangle.test_list
|
||||
grep -h "^\s*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > tangle.test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CXXFLAGS boot.cc -o tangle
|
||||
$CXX $CXXFLAGS tangle.cc -o tangle
|
||||
./tangle test
|
||||
cd ../archive/2.vm
|
||||
cd ../archive/1.vm
|
||||
|
||||
cd termbox
|
||||
$CC $CFLAGS -c termbox.c
|
||||
|
@ -51,8 +41,8 @@ cd termbox
|
|||
ar rcs libtermbox.a *.o
|
||||
cd ..
|
||||
|
||||
LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
../../tangle/tangle $LAYERS > mu.cc
|
||||
LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
../../tools/tangle $LAYERS > mu.cc
|
||||
# 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 ') {'
|
||||
#
|
||||
|
@ -65,5 +55,5 @@ $CXX $CXXFLAGS mu.cc termbox/libtermbox.a -o mu_bin
|
|||
|
||||
## [0-9]*.mu -> core.mu
|
||||
|
||||
MU_LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
MU_LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
cat $MU_LAYERS > core.mu
|
||||
|
|
|
@ -81,38 +81,28 @@ noisy_cd() {
|
|||
echo "-- `pwd`" >&2
|
||||
}
|
||||
|
||||
older_than ../../enumerate/enumerate ../../enumerate/enumerate.cc && {
|
||||
$CXX $CXXFLAGS ../../enumerate/enumerate.cc -o ../../enumerate/enumerate
|
||||
older_than ../../tools/enumerate ../../tools/enumerate.cc && {
|
||||
$CXX $CXXFLAGS ../../tools/enumerate.cc -o ../../tools/enumerate
|
||||
}
|
||||
|
||||
older_than ../../tangle/tangle tangle/*.cc && {
|
||||
noisy_cd ../../tangle
|
||||
older_than ../../tools/tangle ../../tools/tangle.cc && {
|
||||
noisy_cd ../../tools
|
||||
# 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
|
||||
grep -h "^[^ #].*) {" tangle.cc |sed 's/ {.*/;/' |update tangle.function_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
grep -h "^[[:space:]]*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update tangle.test_list
|
||||
grep -h "^\s*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update tangle.test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CXXFLAGS boot.cc -o tangle
|
||||
$CXX $CFLAGS tangle.cc -o tangle
|
||||
./tangle test
|
||||
noisy_cd ../archive/2.vm # no effect; just to show us returning to the parent directory
|
||||
noisy_cd ../archive/1.vm # no effect; just to show us returning to the parent directory
|
||||
}
|
||||
|
||||
LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
older_than mu.cc $LAYERS ../../enumerate/enumerate ../../tangle/tangle && {
|
||||
LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
older_than mu.cc $LAYERS ../../tools/enumerate ../../tools/tangle && {
|
||||
# no update here; rely on 'update' calls downstream
|
||||
../../tangle/tangle $LAYERS > mu.cc
|
||||
../../tools/tangle $LAYERS > mu.cc
|
||||
}
|
||||
|
||||
older_than cleave/cleave cleave/cleave.cc && {
|
||||
|
@ -160,7 +150,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && {
|
|||
|
||||
## [0-9]*.mu -> core.mu
|
||||
|
||||
MU_LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
MU_LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
cat $MU_LAYERS |update core.mu
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -106,38 +106,28 @@ noisy_cd() {
|
|||
echo "-- `pwd`" >&2
|
||||
}
|
||||
|
||||
older_than ../../enumerate/enumerate ../../enumerate/enumerate.cc && {
|
||||
$CXX $CXXFLAGS ../../enumerate/enumerate.cc -o ../../enumerate/enumerate
|
||||
older_than ../../tools/enumerate ../../tools/enumerate.cc && {
|
||||
$CXX $CXXFLAGS ../../tools/enumerate.cc -o ../../tools/enumerate
|
||||
}
|
||||
|
||||
older_than ../../tangle/tangle ../../tangle/*.cc && {
|
||||
noisy_cd ../../tangle
|
||||
older_than ../../tools/tangle ../../tools/tangle.cc && {
|
||||
noisy_cd ../../tools
|
||||
# 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
|
||||
grep -h "^[^ #].*) {" tangle.cc |sed 's/ {.*/;/' |update tangle.function_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
grep -h "^[[:space:]]*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update tangle.test_list
|
||||
grep -h "^\s*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update tangle.test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CXXFLAGS boot.cc -o tangle
|
||||
$CXX $CFLAGS tangle.cc -o tangle
|
||||
./tangle test
|
||||
noisy_cd ../archive/2.vm # no effect; just to show us returning to the parent directory
|
||||
noisy_cd ../archive/1.vm # no effect; just to show us returning to the parent directory
|
||||
}
|
||||
|
||||
LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
older_than mu.cc $LAYERS ../../enumerate/enumerate ../../tangle/tangle && {
|
||||
LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
older_than mu.cc $LAYERS ../../tools/enumerate ../../tools/tangle && {
|
||||
# no update here; rely on 'update' calls downstream
|
||||
../../tangle/tangle $LAYERS > mu.cc
|
||||
../../tools/tangle $LAYERS > mu.cc
|
||||
}
|
||||
|
||||
older_than cleave/cleave cleave/cleave.cc && {
|
||||
|
@ -185,7 +175,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && {
|
|||
|
||||
## [0-9]*.mu -> core.mu
|
||||
|
||||
MU_LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
MU_LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
cat $MU_LAYERS |update core.mu
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -125,62 +125,53 @@ all_exist() {
|
|||
}
|
||||
|
||||
TMP=`mktemp`
|
||||
mv_if_exists ../../enumerate/enumerate $TMP
|
||||
mv_if_exists ../../tools/enumerate $TMP
|
||||
(
|
||||
wait_for_all ../../enumerate/enumerate.cc
|
||||
older_than $TMP ../../enumerate/enumerate.cc && {
|
||||
wait_for_all ../../tools/enumerate.cc
|
||||
older_than $TMP ../../tools/enumerate.cc && {
|
||||
echo "building enumerate"
|
||||
$CXX $CXXFLAGS ../../enumerate/enumerate.cc -o $TMP || quit
|
||||
$CXX $CXXFLAGS ../../tools/enumerate.cc -o $TMP || quit
|
||||
echo "done building enumerate"
|
||||
}
|
||||
mv $TMP ../../enumerate/enumerate
|
||||
mv $TMP ../../tools/enumerate
|
||||
) &
|
||||
|
||||
TMP=`mktemp`
|
||||
mv_if_exists ../../tangle/tangle $TMP
|
||||
mv_if_exists ../../tools/tangle $TMP
|
||||
(
|
||||
wait_for_all ../../tangle/*.cc
|
||||
older_than $TMP ../../tangle/*.cc && {
|
||||
wait_for_all ../../tools/tangle.cc
|
||||
older_than $TMP ../../tools/tangle.cc && {
|
||||
echo "building tangle"
|
||||
cd ../../tangle
|
||||
cd ../../tools
|
||||
# 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
|
||||
grep -h "^[^ #].*) {" tangle.cc |sed 's/ {.*/;/' |update tangle.function_list
|
||||
# list of tests to run
|
||||
grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update test_list
|
||||
grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list
|
||||
grep -h "^[[:space:]]*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {$/\1,/' |update tangle.test_list
|
||||
grep -h "^\s*void test_" tangle.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update tangle.test_name_list
|
||||
# }
|
||||
# Now that we have all the _lists, compile 'tangle'
|
||||
$CXX $CXXFLAGS boot.cc -o $TMP || quit
|
||||
$CXX $CXXFLAGS tangle.cc -o $TMP || quit
|
||||
$TMP test
|
||||
cd ../archive/2.vm
|
||||
cd ../archive/1.vm
|
||||
echo "done building tangle"
|
||||
}
|
||||
mv $TMP ../../tangle/tangle
|
||||
mv $TMP ../../tools/tangle
|
||||
) &
|
||||
|
||||
wait_for_all ../../enumerate/enumerate
|
||||
wait_for_all ../../tools/enumerate
|
||||
echo "enumerating layers"
|
||||
LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.cc$')
|
||||
echo "done enumerating layers"
|
||||
|
||||
TMP=`mktemp`
|
||||
mv_if_exists mu.cc $TMP
|
||||
(
|
||||
wait_for_all $LAYERS ../../enumerate/enumerate ../../tangle/tangle
|
||||
older_than $TMP $LAYERS ../../enumerate/enumerate ../../tangle/tangle && {
|
||||
wait_for_all $LAYERS ../../tools/enumerate ../../tools/tangle
|
||||
older_than $TMP $LAYERS ../../tools/enumerate ../../tools/tangle && {
|
||||
echo "running tangle"
|
||||
# no update here; rely on 'update' calls downstream
|
||||
../../tangle/tangle $LAYERS >$TMP || quit
|
||||
../../tools/tangle $LAYERS >$TMP || quit
|
||||
echo "done running tangle"
|
||||
}
|
||||
mv $TMP mu.cc
|
||||
|
@ -282,9 +273,9 @@ mv_if_exists mu_bin $TMP
|
|||
|
||||
## [0-9]*.mu -> core.mu
|
||||
|
||||
wait_for_all ../../enumerate/enumerate
|
||||
wait_for_all ../../tools/enumerate
|
||||
echo "building core.mu"
|
||||
MU_LAYERS=$(../../enumerate/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
MU_LAYERS=$(../../tools/enumerate --until $UNTIL_LAYER |grep '\.mu$') || exit 0 # ok if no .mu files
|
||||
cat $MU_LAYERS |update core.mu
|
||||
echo "done building core.mu"
|
||||
|
||||
|
|
|
@ -6,4 +6,4 @@ rm -rf mu.cc core.mu mu_bin* *_list .build
|
|||
rm -rf termbox/*.o termbox/libtermbox.a
|
||||
rm -rf .until .quit
|
||||
test $# -gt 0 && exit 0 # convenience: 'clean top-level' to leave subsidiary tools alone
|
||||
rm -rf ../../enumerate/enumerate ../../tangle/tangle ../../tangle/*_list cleave/cleave cleave/cleave.dSYM ../../*/*.dSYM
|
||||
rm -rf ../../tools/enumerate ../../tools/tangle ../../tools/*_list cleave/cleave cleave/cleave.dSYM ../../*/*.dSYM
|
||||
|
|
Loading…
Reference in New Issue