From c2d49d81f34ae481a37fd0d93f597b1c8f5f088b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 14 Aug 2015 21:59:34 -0700 Subject: 2002 No, 2001 is no good. Phony targets can't early-exit if everything's built. New approach: $ CFLAGS=-g make && ./mu test etc. --- build_and_test_until | 4 +--- makefile | 35 +++++++---------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/build_and_test_until b/build_and_test_until index 48067971..73c2b6ca 100755 --- a/build_and_test_until +++ b/build_and_test_until @@ -8,6 +8,4 @@ make tangle/tangle make enumerate/enumerate ./tangle/tangle $(./enumerate/enumerate --until $* |grep -v '.mu$') |grep -v "^\s*//:" > mu.cc cat /dev/null $(./enumerate/enumerate --until $* |grep '.mu$') > core.mu -make autogenerated_lists -make valgrind #? 2 -#? make test #? 4 +CXX=clang++ CFLAGS="-O3 -fsanitize=undefined" make valgrind diff --git a/makefile b/makefile index 26259a40..a46a9c41 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,10 @@ all: mu_bin core.mu +CXX ?= c++ +CFLAGS ?= -g -O3 + mu_bin: makefile enumerate/enumerate tangle/tangle mu.cc termbox/libtermbox.a - @make --no-print-directory dbg+opt + ${CXX} ${CFLAGS} -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin # To see what the program looks like after all layers have been applied, read # mu.cc @@ -40,34 +43,10 @@ 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 -# turning optimizations/profiling/sanitization-checking on/off -.PHONY: all autogenerated_lists test valgrind clang dbg opt prof opt+prof dbg+opt+prof clang+opt clena - -dbg: - c++ -g -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -opt: - c++ -O3 -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -dbg+opt: - c++ -g -O3 -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -prof: - c++ -pg -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -opt+prof: - c++ -O3 -pg -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -dbg+opt+prof: - c++ -g -O3 -pg -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin - -clang: - clang++ -g -fsanitize=undefined mu.cc termbox/libtermbox.a -o mu_bin - -clang+opt: - clang++ -O3 -fsanitize=undefined mu.cc termbox/libtermbox.a -o mu_bin +# +.PHONY: all autogenerated_lists clean clena -valgrind: clang+opt +valgrind: autogenerated_lists mu_bin core.mu valgrind --leak-check=yes -q --error-exitcode=1 ./mu_bin test clena: clean -- cgit 1.4.1-2-gfad0