about summary refs log tree commit diff stats
path: root/makefile
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-14 21:59:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-14 21:59:34 -0700
commitc2d49d81f34ae481a37fd0d93f597b1c8f5f088b (patch)
treef24756ed8dd940a50c4b45bab2874710d9e9ea91 /makefile
parente53787f51a058270c6125be35172d8fb6341a549 (diff)
downloadmu-c2d49d81f34ae481a37fd0d93f597b1c8f5f088b.tar.gz
2002
No, 2001 is no good. Phony targets can't early-exit if everything's
built. New approach:

  $ CFLAGS=-g make && ./mu test

etc.
Diffstat (limited to 'makefile')
-rw-r--r--makefile35
1 files changed, 7 insertions, 28 deletions
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