-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
200 lines (176 loc) · 4.19 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#
# General Compiler Settings
#
CC=g++
#PANDORA=1
#DEBUG=1
# general compiler settings
ifeq ($(M32),1)
FLAGS= -m32
endif
ifeq ($(PANDORA),1)
FLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -march=armv7-a -fsingle-precision-constant -mno-unaligned-access -fdiagnostics-color=auto -O3 -fsigned-char
FLAGS+= -DPANDORA
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
#HAVE_GLES=1
endif
ifeq ($(PYRA),1)
FLAGS= -mcpu=cortex-a15 -mfpu=neon -mfloat-abi=hard -fsingle-precision-constant
FLAGS+= -DPYRA
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
endif
ifeq ($(ODROID),1)
FLAGS= -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard -fsingle-precision-constant -O3 -fsigned-char
FLAGS+= -DODROID
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=hard
#HAVE_GLES=1
endif
ifeq ($(ODROIDN1),1)
FLAGS= -mcpu=cortex-a72.cortex-a53 -fsingle-precision-constant -O3 -fsigned-char -ffast-math
FLAGS+= -DODROID
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a72.cortex-a53
#HAVE_GLES=1
endif
ifeq ($(CHIP),1)
FLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard -fsingle-precision-constant -O3 -fsigned-char
FLAGS+= -DCHIP
FLAGS+= -DARM
LDFLAGS= -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard
#HAVE_GLES=1
endif
ifeq ($(EMSCRIPTEN),1)
FLAGS= -s FULL_ES2=1 -I../gl4es/include -s USE_SDL_TTF=2 -s USE_SDL=2
FLAGS+= -I/usr/include/glm
FLAGS+= -Dlinux -DUSE_SDL2
FLAGS+= --emrun --preload-file Tracks --preload-file Sounds
FLAGS+= --preload-file Bitmap --embed-file DejaVuSans-Bold.ttf
FLAGS+= --shell-file template.html
LDFLAGS= -s FULL_ES2=1 -s USE_SDL_TTF=2 -s USE_SDL=2
CC= emcc
CXX= emc++
endif
FLAGS+= -pipe -fpermissive
CFLAGS=$(FLAGS) -Wno-conversion-null -Wno-write-strings -ICommon
LDFLAGS=$(FLAGS)
ifeq ($(PANDORA),1)
PROFILE=0
else
PROFILE=0
endif
ifeq ($(DEBUG),1)
FLAGS+= -g
CFLAGS+=-Og
else
CFLAGS+=-O3 -Winit-self
LDFLAGS+=-s
endif
ifeq ($(PROFILE),1)
ifneq ($(DEBUG),1)
# Debug symbols needed for profiling to be useful
FLAGS+= -g
endif
FLAGS+= -pg
endif
#SDL=1
ifeq ($(EMSCRIPTEN),1)
GL4ES = ../gl4es/lib/libGL.a
LIB+= -lopenal ${GL4ES}
else
ifeq ($(SDL),2)
SDL_=sdl2
TTF_ = SDL2_ttf
CFLAGS += -DUSE_SDL2
else
SDL_=
CFLAGS+=`sdl-config --cflags`
TTF_ = SDL_ttf
endif
# library headers
ifeq ($(PANDORA),1)
CFLAGS+= `pkg-config --cflags $(SDL_) $(TTF_) openal`
else
CFLAGS+= `pkg-config --cflags $(SDL_) $(TTF_) openal`
endif
# dynamic only libraries
ifeq ($(PANDORA),1)
LIB+= `sdl-config --libs`
else
LIB+= `pkg-config --libs $(SDL_)`
endif
LIB+= `pkg-config --libs $(TTF_)`
ifeq ($(MINGW),1)
LIB += -L./mingw/bin
LIB += -lglu32 -lopengl32
LIB += -lsocket -lws2_32 -lwsock32 -lwinmm -lOpenAL32
else
ifeq ($(HAVE_GLES),1)
LIB += -lGLES_CM -lEGL
CFLAGS += -DHAVE_GLES
else
LIB += -lGL -lGLU
endif
LIB += -lopenal
endif
ifneq ($(MINGW),1)
# apparently on some systems -ldl is explicitly required
# perhaps this is part of the default libs on others...?
LIB+= -ldl
endif
endif
# specific includes
CFLAGS += -I.
CFLAGS += -DSOUND_OPENAL
ifeq ($(DEBUG),1)
CFLAGS+= -DDEBUG_ON -DDEBUG_COMP -DDEBUG_SPOTFX_SOUND -DDEBUG_VIEWPORT
endif
ifeq ($(EMSCRIPTEN),1)
BIN=docs/index.html
else
BIN=stuntcarracer
endif
INC=$(wildcard *.h)
SRC=$(wildcard *.cpp)
ifeq ($(EMSCRIPTEN),1)
OBJ=$(patsubst %.cpp,%.bc,$(SRC))
#Not in OBJ to avoid removal with a "clean" command
INC+=${GL4ES}
else
OBJ=$(patsubst %.cpp,%.o,$(SRC))
endif
all: $(BIN)
$(BIN): $(OBJ)
$(CC) -o $(BIN) $(OBJ) $(CFLAGS) $(LDFLAGS) $(LIB)
$(OBJ): $(INC)
%.o: %.cpp
$(CC) -o $@ -c $< $(CFLAGS)
%.bc: %.cpp
$(CC) -o $@ -c $< $(CFLAGS)
clean:
$(RM) $(OBJ) $(BIN)
check:
@echo
@echo "INC = $(INC)"
@echo
@echo "SRC = $(SRC)"
@echo
@echo "OBJ = $(OBJ)"
@echo
@echo "DEBUG = $(DEBUG)"
@echo "PROFILE = $(PROFILE)"
@echo "PANDORA = $(PANDORA)"
@echo "ODROID = $(ODROID)"
@echo "CHIP = $(CHIP)"
@echo "HAVE_GLES = $(HAVE_GLES)"
@echo "SDL = $(SDL)"
@echo "SDL_ = $(SDL_)"
@echo
@echo "CC = $(CC)"
@echo "BIN = $(BIN)"
@echo "CFLAGS = $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "LIB = $(LIB)"
@echo