-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (41 loc) · 1.17 KB
/
Makefile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright (C) 2019 Trevor Last
# See LICENSE file for copyright and license details.
CXXFLAGS=-Wall -Wextra -g
LDFLAGS=-lSDL2
SRCDIR=src
OBJDIR=$(SRCDIR)/obj
DEPDIR=$(SRCDIR)/dep
SRC=$(wildcard $(SRCDIR)/*.cpp)
OBJ=$(subst $(SRCDIR),$(OBJDIR),$(SRC:.cpp=.o))
DEP=$(subst $(SRCDIR),$(DEPDIR),$(SRC:.cpp=.d))
FONTS=$(addprefix font/,\
80col-normal.pbm \
80col-doublewidth.pbm \
80col-doubleheight.pbm \
132col-normal.pbm \
132col-doublewidth.pbm \
132col-doubleheight.pbm)
all : term $(FONTS)
term : $(OBJ)
$(CXX) $^ $(CXXFLAGS) $(LDFLAGS) -o $@
buildfont : font/mkfont/mkfont.cpp src/obj/loadfont.o
$(CXX) $^ $(CXXFLAGS) -o $@
$(FONTS) : buildfont font/mkfont/vt100font-source.pbm
@echo "Building fonts..."
@./buildfont font/mkfont/vt100font-source.pbm
@mv $(notdir $(FONTS)) font/
@echo "Done."
include $(DEP)
$(OBJDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) -c $< $(CXXFLAGS) $(LDFLAGS) -o $@
$(DEPDIR)/%.d : $(SRCDIR)/%.cpp
$(CXX) $^ $(CXXFLAGS) $(LDFLAGS) -MM -MT $(subst $(DEPDIR),$(OBJDIR),$(@:.d=.o)) -MF $@
$(OBJ) :|$(OBJDIR)
$(DEP) :|$(DEPDIR)
$(OBJDIR) :
@mkdir $@
$(DEPDIR) :
@mkdir $@
.PHONY: clean
clean:
@rm -f term buildfont $(OBJDIR)/* $(DEPDIR)/* $(FONTS)