-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (83 loc) · 2.36 KB
/
Copy pathMakefile
File metadata and controls
106 lines (83 loc) · 2.36 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Makefile
# Builds to `bin/turtle`.
# Copies `res/*` to `bin/`. Put test drawings in `res/`.
# Typical workflow:
# cd Assignment
# lua design/prototype.lua drawing=r gen >res/drawing.txt
# make debug && (cd ./bin/; valgrind --leak-check=full ./turtle drawing.txt)
# If you want to build release version:
# make clean && make
#
default: full
debug: full
quick: build
quickdebug: build
profile: build
TARGET=cactusgame
SRC=src
OBJ=obj
BIN=bin
RES=res
LIB=lib
CC=g++
CCFLAGS =
#CCFLAGS =-D_GNU_SOURCE
#CCFLAGS+=-Wextra
#CCFLAGS+=-pedantic
#CCFLAGS+=-Weffc++
#CCFLAGS+=-Werror
#CCFLAGS+=-std=c99
CCFLAGS+=-std=c++0x
CCFLAGS+=-Isrc -IAntTweakBar/include -ISOIL/src
DBG_CCFLAGS=-ggdb -g3 -O0 -DDEBUG
#DBG_CCFLAGS+=-D_GLIBCXX_DEBUG
PRF_CCFLAGS=-pg
LD=g++
LDFLAGS =-L$(LIB)
LDFLAGS+=-lm -lGL -lGLU -lglut -lX11
DBG_LDFLAGS=
LDOBJS =$(LIB)/libAntTweakBar.a $(LIB)/libSOIL.a
SRCFILES:=$(shell find $(SRC) -type f -name "*.cpp")
DEPFILES:=$(patsubst $(SRC)/%.cpp,$(OBJ)/%.d,$(SRCFILES))
OBJFILES:=$(patsubst $(SRC)/%.cpp,$(OBJ)/%.o,$(SRCFILES))
$(OBJ)/%.o: $(SRC)/%.cpp Makefile
$(CC) $(CCFLAGS) -MMD -c $< -o $@
# Generates dependency information for each C file's object file as a new
# Makefile. This has many benefits, and no tangible disadvantages!
-include $(DEPFILES)
#`-` suppresses warnings about the files not existing first time round
$(BIN)/$(TARGET): $(OBJFILES)
$(LD) $(LDFLAGS) -o $@ $^ $(LDOBJS)
anttweakbar: .FORCE
@echo "# Compiling AntTweakBar."
cd AntTweakBar/src; make $(MFLAGS)
cp AntTweakBar/lib/libAntTweakBar.a lib
@echo "# Compiled AntTweakBar to $(DEP)/$(LIB)/libAntTweakBar.a"
tinyobjloader: .FORCE
cp tiny_obj_loader.* src
soil: .FORCE
@echo "# Compiling SOIL."
cd SOIL/projects/makefile; make
cp SOIL/lib/libSOIL.a lib
@echo "# Compiled SOIL to $(LIB)/libSOIL.a."
build: $(BIN)/$(TARGET)
@echo "# Compiled to $(BIN)/$(TARGET)."
full: anttweakbar soil res build
debug: CCFLAGS+=$(DBG_CCFLAGS)
quickdebug: CCFLAGS+=$(DBG_CCFLAGS)
profile: CCFLAGS+=$(PRF_CCFLAGS)
# -DDEBUG_DRAW -DDEBUG_PARSE
res: .FORCE
cp -u res/* bin/
# Have the contents of 'res' changed? No idea! Copy them every time
# by using .FORCE
run:
cd bin; /cactusgame
clean:
cd AntTweakBar/src; make clean
cd SOIL/projects/makefile; make clean
$(RM) $(wildcard $(OBJ)/* $(BIN)/*)
quickclean:
$(RM) $(wildcard $(OBJ)/* $(BIN)/*)
.PHONY: default clean
.FORCE: