Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 1 | .PHONY: all clean |
| 2 | |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 3 | CXX = c++ |
| 4 | LDFLAGS = |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 5 | CXXFLAGS = -I. -std=c++17 |
| 6 | MKDIR_P = mkdir -p |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 7 | |
| 8 | EXE = exe/hello-world-ng |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 9 | TEST = t/greeting-test |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 10 | |
| 11 | mod_OBJ = mod/greeting.o |
| 12 | hello_world_ng_OBJ = exe/hello-world-ng.o |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 13 | greeting_test_OBJ = t/greeting-test.o |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 14 | |
| 15 | OBJ = $(hello_world_ng_OBJ) $(mod_OBJ) |
| 16 | |
| 17 | all: $(EXE) |
Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 18 | |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 19 | test: $(TEST) |
| 20 | @for x in $^; do \ |
| 21 | echo $$x; \ |
| 22 | $$x; \ |
| 23 | done |
| 24 | |
| 25 | test-junit: $(TEST) |
| 26 | $(MKDIR_P) test-results/t |
| 27 | @for x in $^; do \ |
| 28 | echo $$x -r junit -o test-results/$$x.xml --success; \ |
| 29 | $$x -r junit -o test-results/$$x.xml --success || :; \ |
| 30 | done |
| 31 | |
Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 32 | clean: |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 33 | $(RM) $(OBJ) |
| 34 | $(RM) $(EXE) |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 35 | $(RM) -r test-results |
Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 36 | |
Matthias Andreas Benkard | 38610ae | 2018-04-10 20:39:24 +0200 | [diff] [blame] | 37 | exe/hello-world-ng: $(hello_world_ng_OBJ) $(mod_OBJ) |
Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 38 | $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ |
| 39 | |
Matthias Andreas Benkard | 4c71268 | 2018-04-10 20:54:36 +0200 | [diff] [blame] | 40 | t/greeting-test: $(greeting_test_OBJ) $(mod_OBJ) |
| 41 | $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ |
| 42 | |
Matthias Andreas Benkard | 3314730 | 2018-04-09 21:22:22 +0200 | [diff] [blame] | 43 | %.o: %.cpp |
| 44 | $(CXX) $(CXXFLAGS) -o $@ -c $< |