blob: c8bca05fed0ef457221e9f8efcd9ee942c67363a (
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
41
|
CXX := g++
CXXFLAGS := -Wall -Wextra -std=c++11 -g -O2
LDFLAGS :=
TARGET := ai
OBJDIR := .objs
CXX_SOURCES := $(wildcard *.cpp)
OBJ_FILES := $(patsubst %.cpp,$(OBJDIR)/%.o,$(CXX_SOURCES))
DEP_FILES := $(patsubst %.cpp,$(OBJDIR)/%.d,$(CXX_SOURCES))
.PHONY: all clean
all: $(TARGET)
clean:
rm -f $(TARGET)
rm -rf $(OBJDIR)
$(TARGET): $(OBJ_FILES) termio/libtermio.a
@echo LD $@
@$(CXX) $(CXXFLAGS) -o $@ $^ termio/libtermio.a $(LDFLAGS)
$(OBJDIR)/%.o: %.cpp termio/libtermio.a
@mkdir -p $(dir $@)
@echo CXX $<
@$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJDIR)/%.d: %.cpp termio/libtermio.a
@mkdir -p $(dir $@)
@echo DEP $<
@$(CXX) -MT $(OBJDIR)/$*.o -MM $(CXXFLAGS) $< >$@
termio/.git:
git submodule update --init
termio/libtermio.a: termio/.git $(wildcard termio/*.c termio/*.h)
make -C termio
-include $(DEP_FILES)
|