Skip to content
Snippets Groups Projects
Makefile 1.13 KiB
Newer Older
  • Learn to ignore specific revisions
  • Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    # This Makefile made available to his students by 
    # Prof. Ronald Moore  
    #     https://fbi.h-da.de/personen/ronald-moore/  
    #     mailto:ronald.moore@h-da.de
    # with no warranties whatsoever
    
    
    PROGS := interpreter
    
    TESTFILES := testInput.txt testOutput.txt
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    # Uncomment only one of the next two lines (choose your c++ compiler)
    # CC=g++
    CC := clang++
    
    ## Add your own CFLAGS if you find them necessary... such as -O3 or so... 
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    
    
    ## More preliminaries
    # See https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
    # In this makefile, we want to keep going even if we find errors
    .IGNORE :
    
    # Tell make that the following "targets" are "phony"
    # Cf. https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
    
    .PHONY : all clean test
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed
    
    ##  Now, the targets -- the things that will get made!
    
    all: $(PROGS)
    
    $(PROGS): %: %.cpp
    	$(CC) -g $< $(CFLAGS) -o $@
    
    clean: 
    
    	$(RM) -v *~ *.o $(PROGS) tmp.txt
    
    test: $(PROGS) $(TESTFILES)
    
    	# Running interpreter in test mode
    
    	-./interpreter testInput.txt 2>&1 >tmp.txt
    
    	# Checking output -- no news is good news!
    
    	diff testOutput.txt tmp.txt
    	-rm tmp.txt
    
    Ronald Charles Moore's avatar
    Ronald Charles Moore committed