~kiwec/ke

ref: 78c9c27553daf8c35b474c75eefec53e1ef3b9a8 ke/Makefile -rw-r--r-- 777 bytes
78c9c275 — Wolf Clément Reenable syntax highlighting 3 years ago
                                                                                
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
SRC      = $(wildcard src/*.cpp)
OBJ      = $(SRC:.cpp=.o)
DEP      = $(OBJ:.o=.d)
TESTS    = $(wildcard test/*.cpp)
TOBJ     = $(TESTS:.cpp=.o)
TDEP     = $(TOBJ:.o=.d)
CXX      = zapcc
CXXFLAGS = -std=c++1z
LDFLAGS  = -ltermbox -lstdc++ -lm
TARGET   = ke

$(TARGET): $(OBJ)
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)

-include $(DEP)
-include $(TDEP)

%.d: %.cpp
	@$(CXX) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@

.PHONY: clean
clean:
	rm -f $(OBJ) $(DEP) ke

.PHONY: debug
debug: CXXFLAGS += -Wall -Wextra -g
debug: LDFLAGS += -O0
debug: $(TARGET)

.PHONE: tests
tests: CXXFLAGS += -g
tests: LDFLAGS += -O0
tests: $(filter-out src/main.o, $(OBJ)) $(TOBJ)
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) && ./tests

.PHONY: install
install: $(TARGET)
	install $(TARGET) /usr/bin/$(TARGET)