about summary refs log blame commit diff stats
path: root/cpp/makefile
blob: 75ed8424777e556932dffcd1aea55516b428c4f8 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                         
                                            
                                                                                  
 


                                                                             
                                                                                      
                                                                         
 


                                                
              
                                          
 


                          
                                                          
                                               
                                                  
 


                 


                                           
                    


                                                                                                       
 
                

                                                                                              
 
            
      
                                  
                               
                                
                                      
mu: makefile enumerate/enumerate tangle/tangle mu.cc termbox/libtermbox.a
	@make autogenerated_lists >/dev/null
	g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -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$$') > mu.cc
	cat $$(./enumerate/enumerate --until 999 |grep '.mu$$') > core.mu

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

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

termbox/libtermbox.a:
	cd termbox && make

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

test: mu
	./mu test

valgrind: mu
	valgrind --leak-check=yes ./mu test

function_list: mu.cc
	# declarations for lines starting with non-space and ending with ') {', except methods
	@grep -h "^[^[:space:]#].*) {" mu.cc |grep -v ":.*(" |perl -pwe 's/ {.*/;/' > function_list
	@grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list

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

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