about summary refs log tree commit diff stats
path: root/cpp/makefile
blob: b062b2884048bec6935a53d2bc07d6a855d3c470 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
mu: makefile enumerate/enumerate tangle/tangle mu.cc
	g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc -o mu

# To see what the program looks like after all layers have been applied, read
# mu.cc
mu.cc: 0*
	./tangle/tangle $$(./enumerate/enumerate --until 999 |grep -v '.mu$$') |grep -v "^\s*//:" > mu.cc
	cat $$(./enumerate/enumerate --until 999 |grep '.mu$$') > core.mu
	@make autogenerated_lists >/dev/null

enumerate/enumerate:
	cd enumerate && make && ./enumerate test

tangle/tangle:
	cd tangle && make && ./tangle test

# auto-generated files; by convention they end in '_list'.
.PHONY: autogenerated_lists test clena 
autogenerated_lists: mu.cc function_list test_list

test: mu
	./mu test

function_list: mu.cc
	@grep -h "^[^ #].*) {" mu.cc |grep -v ":.*(" |perl -pwe 's/ {.*/;/' > function_list
	@grep -h "^[[:space:]]*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list

test_list: mu.cc
	@grep -h "^[[:space:]]*void test_" mu.cc |perl -pwe 's/^\s*void (.*)\(\) {.*/$$1,/' > test_list
	@grep -h "^[[:space:]]*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/test_$$1,/' >> test_list

clena: clean
clean:
	cd enumerate && make clean
	cd tangle && make clean
	rm -rf mu.cc core.mu mu *_list