.PHONY: all clean | |
CXX = c++ | |
LDFLAGS = | |
CXXFLAGS = -I. -std=c++17 | |
MKDIR_P = mkdir -p | |
EXE = exe/hello-world-ng | |
TEST = t/greeting-test | |
mod_OBJ = mod/greeting.o | |
hello_world_ng_OBJ = exe/hello-world-ng.o | |
greeting_test_OBJ = t/greeting-test.o | |
OBJ = $(hello_world_ng_OBJ) $(mod_OBJ) | |
all: $(EXE) | |
test: $(TEST) | |
@for x in $^; do \ | |
echo $$x; \ | |
$$x; \ | |
done | |
test-junit: $(TEST) | |
$(MKDIR_P) test-results/t | |
@for x in $^; do \ | |
echo $$x -r junit -o test-results/$$x.xml --success; \ | |
$$x -r junit -o test-results/$$x.xml --success || :; \ | |
done | |
clean: | |
$(RM) $(OBJ) | |
$(RM) $(EXE) | |
$(RM) -r test-results | |
exe/hello-world-ng: $(hello_world_ng_OBJ) $(mod_OBJ) | |
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ | |
t/greeting-test: $(greeting_test_OBJ) $(mod_OBJ) | |
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ | |
%.o: %.cpp | |
$(CXX) $(CXXFLAGS) -o $@ -c $< |