Makefile 1.13 KB
Newer Older
Ronald Charles Moore's avatar
Ronald Charles Moore committed
1
2
3
4
5
6
7
8
# 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
9
TESTFILES := testInput.txt testOutput.txt
Ronald Charles Moore's avatar
Ronald Charles Moore committed
10
11
12
13
14
# 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... 
15
CFLAGS :=   -g -std=c++17 -Wall 
Ronald Charles Moore's avatar
Ronald Charles Moore committed
16
17
18
19
20
21
22
23
24


## 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
25
.PHONY : all clean test
Ronald Charles Moore's avatar
Ronald Charles Moore committed
26
27
28
29
30
31
32
33
34

##  Now, the targets -- the things that will get made!

all: $(PROGS)

$(PROGS): %: %.cpp
	$(CC) -g $< $(CFLAGS) -o $@

clean: 
35
36
37
	$(RM) -v *~ *.o $(PROGS) tmp.txt

test: $(PROGS) $(TESTFILES)
Ronald Charles Moore's avatar
Ronald Charles Moore committed
38
	# Running interpreter in test mode
39
	-./interpreter testInput.txt 2>&1 >tmp.txt
Ronald Charles Moore's avatar
Ronald Charles Moore committed
40
	# Checking output -- no news is good news!
41
42
	diff testOutput.txt tmp.txt
	-rm tmp.txt
Ronald Charles Moore's avatar
Ronald Charles Moore committed
43