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. --- makefile | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) (limited to 'makefile') 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