58 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| # Define the compiler and the linker. The linker must be defined since
 | |
| # the implicit rule for linking uses CC as the linker. g++ can be
 | |
| # changed to clang++.
 | |
| CXX = g++
 | |
| CC  = $(CXX)
 | |
| 
 | |
| # Define preprocessor, compiler, and linker flags. Uncomment the # lines
 | |
| # if you use clang++ and wish to use libc++ instead of GNU's libstdc++.
 | |
| # -g is for debugging.
 | |
| CPPFLAGS =  -std=c++11 -I.
 | |
| CXXFLAGS =  -O0 -Wall -Wextra -pedantic-errors -Wold-style-cast
 | |
| CXXFLAGS += -std=c++11
 | |
| CXXFLAGS += -g
 | |
| LDFLAGS =   -g
 | |
| # CPPFLAGS += -stdlib=libc++
 | |
| # CXXFLAGS += -stdlib=libc++
 | |
| # LDFLAGS +=  -stdlib=libc++
 | |
| 
 | |
| PROGS=ub leak bounds bounds-heap dangling sum sum-alt bounds-alt bounds-heap-alt
 | |
| 
 | |
| ALL: $(PROGS)
 | |
| 
 | |
| leak: leak.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=leak -o $@ $<
 | |
| 
 | |
| dangling: dangling.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=address -o $@ $<
 | |
| 
 | |
| bounds: bounds.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=address -o $@ $<
 | |
| 
 | |
| bounds-heap: bounds-heap.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=address -o $@ $<
 | |
| 
 | |
| bounds-alt: bounds.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=undefined -o $@ $<
 | |
| 
 | |
| bounds-heap-alt: bounds-heap.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=undefined -o $@ $<
 | |
| 
 | |
| ub: ub.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=undefined -o $@ $<
 | |
| 
 | |
| sum: sum.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=undefined -o $@ $<
 | |
| 
 | |
| sum-alt: sum.cc
 | |
| 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fsanitize=address -o $@ $<
 | |
| 
 | |
| # Targets
 | |
| # Phony targets
 | |
| .PHONY: all clean
 | |
| 
 | |
| # Standard clean
 | |
| clean:
 | |
| 	-rm $(PROGS)
 | |
| 	-rm -r $(addsuffix .dSYM, $(PROGS))
 | |
| 
 | 
