blob: eddd4f2e7fb6957712f892911421bdfe1d04684d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
config=debug
defines=standard
BUILD=build/make-$(CXX)-$(config)-$(defines)
SOURCES=src/pugixml.cpp $(wildcard tests/*.cpp)
EXECUTABLE=$(BUILD)/test
CXXFLAGS=-c -g -Wall -Wextra -Werror -pedantic
LDFLAGS=
ifeq ($(config),release)
CXXFLAGS+=-O3 -DNDEBUG
endif
ifneq ($(defines),standard)
COMMA=,
CXXFLAGS+=-D $(subst $(COMMA), -D ,$(defines))
endif
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
all: $(EXECUTABLE)
test: $(EXECUTABLE)
./$(EXECUTABLE)
clean:
rm -rf $(BUILD)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
$(CXX) $< $(CXXFLAGS) -MMD -MP -o $@
-include $(OBJECTS:.o=.d)
.PHONY: all test clean
|