#!/bin/sh # Compile mu from scratch. set -v set -e # stop immediately on error cd tangle { grep -h "^struct .* {" [0-9]*.cc |sed 's/\(struct *[^ ]*\).*/\1;/' grep -h "^typedef " [0-9]*.cc } > type_list grep -h "^[^ #].*) {" [0-9]*.cc |sed 's/ {.*/;/' > function_list ls [0-9]*.cc |grep -v "\.test\.cc$" |sed 's/.*/#include "&"/' > file_list ls [0-9]*.test.cc |sed 's/.*/#include "&"/' > test_file_list grep -h "^[[:space:]]*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {$/\1,/' > test_list g++ -g -O3 boot.cc -o tangle cd .. cd termbox gcc -g -O3 -c termbox.c gcc -g -O3 -c utf8.c ar rcs libtermbox.a *.o cd .. ./tangle/tangle [0-9]*.cc > mu.cc grep -h "^[^[:space:]#].*) {$" mu.cc |grep -v ":.*(" |sed 's/ {.*/;/' > function_list grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' > test_list g++ -g -O3 mu.cc termbox/libtermbox.a -o mu_bin cat [0-9]*.mu > core.mu