forked from Voidious/BerryBots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
367 lines (310 loc) · 13.4 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
##############################################################################
# Configure build parameters.
CC = g++
.DEFAULT_GOAL = linux
SFML_HEADER_PATH =
SFML_LIB_PATH =
WXWIDGETS_PATH =
LIBARCHIVE_PATH =
LOCAL_SFML=0
LOCAL_WX=0
LOCAL_LIBARCHIVE=0
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
datarootdir = ${prefix}/share
datadir = ${datarootdir}
##############################################################################
# You shouldn't have to edit anything below this line. #######################
VERSION = 1.3.3
##############################################################################
# BerryBots GUI common source files
SOURCES = bbguimain.cpp guiprinthandler.cpp guimanager.cpp newmatch.cpp
SOURCES += outputconsole.cpp bbutil.cpp gfxmanager.cpp filemanager.cpp
SOURCES += circle2d.cpp line2d.cpp point2d.cpp sensorhandler.cpp zone.cpp
SOURCES += bbengine.cpp bblua.cpp gfxeventhandler.cpp rectangle.cpp stage.cpp
SOURCES += packagedialog.cpp packageship.cpp packagestage.cpp dockitem.cpp
SOURCES += dockshape.cpp docktext.cpp dockfader.cpp zipper.cpp guizipper.cpp
SOURCES += menubarmaker.cpp guigamerunner.cpp runnerdialog.cpp runnerform.cpp
SOURCES += bbrunner.cpp resultsdialog.cpp replaybuilder.cpp sysexec.cpp
SOURCES += stagepreview.cpp
##############################################################################
##############################################################################
# Sources and flags for building on Raspberry Pi (Raspbian "wheezy")
RPI_SOURCES = bbpimain.cpp bbengine.cpp stage.cpp bbutil.cpp bblua.cpp
RPI_SOURCES += line2d.cpp point2d.cpp circle2d.cpp rectangle.cpp zone.cpp
RPI_SOURCES += bbpigfx.cpp filemanager.cpp gfxeventhandler.cpp sensorhandler.cpp
RPI_SOURCES += cliprinthandler.cpp clipackagereporter.cpp libshapes.c oglinit.c
RPI_SOURCES += zipper.cpp tarzipper.cpp bbrunner.cpp relativebasedir.cpp
RPI_SOURCES += relativerespath.cpp replaybuilder.cpp ./luajit/src/libluajit.a
RPI_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include -I/opt/vc/include
RPI_CFLAGS += -I/opt/vc/include/interface/vcos/pthreads
RPI_CFLAGS += -I/opt/vc/include/interface/vmcs_host/linux
RPI_LDFLAGS = -L/opt/vc/lib -lGLESv2 -lEGL -lbcm_host -lpthread -ldl
##############################################################################
##############################################################################
# BerryBots CLI common source files
CLI_SOURCES = bbsfmlmain.cpp bbutil.cpp gfxmanager.cpp filemanager.cpp
CLI_SOURCES += circle2d.cpp line2d.cpp point2d.cpp sensorhandler.cpp zone.cpp
CLI_SOURCES += bbengine.cpp bblua.cpp gfxeventhandler.cpp rectangle.cpp
CLI_SOURCES += stage.cpp cliprinthandler.cpp clipackagereporter.cpp dockitem.cpp
CLI_SOURCES += dockshape.cpp docktext.cpp dockfader.cpp zipper.cpp guizipper.cpp
CLI_SOURCES += bbrunner.cpp replaybuilder.cpp
##############################################################################
##############################################################################
# BerryBots webui source files
WEBUI_SOURCES = bbwebmain.cpp bbutil.cpp filemanager.cpp circle2d.cpp
WEBUI_SOURCES += line2d.cpp point2d.cpp sensorhandler.cpp zone.cpp bbengine.cpp
WEBUI_SOURCES += bblua.cpp rectangle.cpp stage.cpp cliprinthandler.cpp
WEBUI_SOURCES += zipper.cpp tarzipper.cpp bbrunner.cpp replaybuilder.cpp
WEBUI_SOURCES += relativebasedir.cpp relativerespath.cpp
WEBUI_SOURCES += ./luajit/src/libluajit.a
##############################################################################
##############################################################################
# osx: Sources and flags for building GUI on Mac OS X / Cocoa
OSX_EXTRA_SOURCES = osxbasedir.mm osxcfg.m linuxrespath.cpp
OSX_EXTRA_SOURCES += ./luajit/src/libluajit.a
ifneq ($(LIBARCHIVE_PATH), )
OSX_EXTRA_SOURCES += ${LIBARCHIVE_PATH}/.libs/libarchive.a
endif
OSX_EXTRA_SOURCES += /usr/lib/libz.dylib /usr/lib/libiconv.dylib
OSX_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include
OSX_LDFLAGS =
ifneq ($(LIBARCHIVE_PATH), )
OSX_CFLAGS += -I${LIBARCHIVE_PATH}/libarchive
else
OSX_LDFLAGS += -larchive
endif
ifneq ($(SFML_HEADER_PATH), )
OSX_CFLAGS += -I${SFML_HEADER_PATH}
OSX_LDFLAGS += -L./sfml-lib
endif
ifneq ($(WXWIDGETS_PATH), )
OSX_CFLAGS += `${WXWIDGETS_PATH}/wx-config --cflags`
OSX_LDFLAGS += `${WXWIDGETS_PATH}/wx-config --libs`
else
OSX_CFLAGS += -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
OSX_LDFLAGS += -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
endif
OSX_LDFLAGS += -lsfml-graphics -lsfml-window -lsfml-system
OSX_LDFLAGS += -ldl -pagezero_size 10000 -image_base 100000000 -stdlib=libc++
##############################################################################
##############################################################################
# osxcli: Sources and flags for building CLI on Mac OS X / Cocoa
OSXCLI_EXTRA_SOURCES = relativebasedir.cpp relativerespath.cpp
OSXCLI_EXTRA_SOURCES += ./luajit/src/libluajit.a
OSXCLI_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include
OSXCLI_LDFLAGS =
ifneq ($(LIBARCHIVE_PATH), )
OSXCLI_EXTRA_SOURCES += ${LIBARCHIVE_PATH}/.libs/libarchive.a
endif
OSXCLI_EXTRA_SOURCES += /usr/lib/libz.dylib /usr/lib/libiconv.dylib
ifneq ($(LIBARCHIVE_PATH), )
OSXCLI_CFLAGS += -I${LIBARCHIVE_PATH}/libarchive
else
OSXCLI_LDFLAGS += -larchive
endif
ifneq ($(SFML_HEADER_PATH), )
OSXCLI_CFLAGS += -I${SFML_HEADER_PATH}
OSXCLI_LDFLAGS += -L${SFML_LIB_PATH}
endif
OSXCLI_LDFLAGS += -lsfml-graphics -lsfml-window -lsfml-system -ldl
OSXCLI_LDFLAGS += -pagezero_size 10000 -image_base 100000000 -stdlib=libc++
##############################################################################
##############################################################################
# linux: Sources and flags for building GUI on Linux / GTK
LINUX_EXTRA_SOURCES = linuxbasedir.cpp linuxrespath.cpp linuxcfg.cpp
LINUX_EXTRA_SOURCES += ./luajit/src/libluajit.a
ifneq ($(LIBARCHIVE_PATH), )
LINUX_EXTRA_SOURCES += ${LIBARCHIVE_PATH}/.libs/libarchive.a
endif
LINUX_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include
LINUX_CFLAGS += -Wno-deprecated-declarations
LINUX_LDFLAGS =
ifneq ($(LIBARCHIVE_PATH), )
LINUX_CFLAGS += -I${LIBARCHIVE_PATH}/libarchive
else
LINUX_LDFLAGS += -larchive
endif
ifneq ($(SFML_HEADER_PATH), )
LINUX_CFLAGS += -I${SFML_HEADER_PATH}
LINUX_LDFLAGS += -L${SFML_LIB_PATH}
LINUX_LDFLAGS += -Wl,-rpath,$(DESTDIR)$(libdir)/berrybots,--enable-new-dtags
endif
ifneq ($(WXWIDGETS_PATH), )
LINUX_CFLAGS += `${WXWIDGETS_PATH}/wx-config --cflags`
LINUX_LDFLAGS += `${WXWIDGETS_PATH}/wx-config --libs`
else
LINUX_CFLAGS += -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
LINUX_LDFLAGS += -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
endif
LINUX_LDFLAGS += -lsfml-graphics -lsfml-window -lsfml-system -lz -ldl -lpthread
##############################################################################
##############################################################################
# linuxcli: Sources and flags for building CLI on Linux / GTK
LINUXCLI_EXTRA_SOURCES = relativebasedir.cpp relativerespath.cpp
LINUXCLI_EXTRA_SOURCES += ./luajit/src/libluajit.a
LINUXCLI_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include
LINUXCLI_CFLAGS += -Wno-deprecated-declarations
LINUXCLI_LDFLAGS =
ifneq ($(LIBARCHIVE_PATH), )
LINUXCLI_EXTRA_SOURCES += ${LIBARCHIVE_PATH}/.libs/libarchive.a
endif
ifneq ($(LIBARCHIVE_PATH), )
LINUXCLI_CFLAGS += -I${LIBARCHIVE_PATH}/libarchive
else
LINUXCLI_LDFLAGS += -larchive
endif
ifneq ($(SFML_HEADER_PATH), )
LINUXCLI_CFLAGS += -I${SFML_HEADER_PATH}
LINUXCLI_LDFLAGS += -L${SFML_LIB_PATH}
endif
LINUXCLI_LDFLAGS += -lsfml-graphics -lsfml-window -lsfml-system -lz -ldl
LINUXCLI_LDFLAGS += -lpthread
##############################################################################
##############################################################################
# webui: Flags for building headless / save to replay on any platform.
WEBUI_CFLAGS = -I./luajit/src -I./stlsoft-1.9.116/include
WEBUI_LDFLAGS = -ldl -lpthread
ifeq ($(.DEFAULT_GOAL), osx)
WEBUI_SOURCES += /usr/lib/libz.dylib /usr/lib/libiconv.dylib
WEBUI_LDFLAGS += -pagezero_size 10000 -image_base 100000000
endif
##############################################################################
##############################################################################
# Build targets
GUIPLATS = osx linux
CLIPLATS = rpi osxcli linuxcli
none:
@echo "Please do "
@echo " make PLATFORM "
@echo "where PLATFORM is one of these: "
@echo " GUI: $(GUIPLATS) "
@echo " CLI: $(CLIPLATS) "
MAKE_LUAJIT=cd luajit; $(MAKE); cd ..
CLEAN_LUAJIT=cd luajit; $(MAKE) clean; cd ..
MAKE_SFML=cd SFML-2.3.2; mkdir build; cd build; cmake -DCMAKE_SKIP_RPATH=ON ..; make; cd ../..
CLEAN_SFML=rm -rf SFML-2.3.2/build
MAKE_WX=cd wxWidgets-3.0.2; ./configure --disable-shared; $(MAKE); cd ..
CLEAN_WX=cd wxWidgets-3.0.2; make clean; cd ..
MAKE_LIBARCHIVE=cd libarchive-3.1.2; ./configure; $(MAKE); cd ..
CLEAN_LIBARCHIVE=cd libarchive-3.1.2; make clean; cd ..
rpi:
$(MAKE_LUAJIT)
$(CC) ${RPI_SOURCES} ${RPI_CFLAGS} ${RPI_LDFLAGS} -o berrybots
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
osx:
$(MAKE_LUAJIT)
ifeq ($(SFML_HEADER_PATH), )
$(CC) ${SOURCES} ${OSX_EXTRA_SOURCES} ${OSX_CFLAGS} ${OSX_LDFLAGS} -o bbgui
cp scripts/bb_gui.sh berrybots
else
./scripts/osx_copy_fix_dylib_paths.sh "${SFML_LIB_PATH}" "sfml-lib"
$(CC) ${SOURCES} ${OSX_EXTRA_SOURCES} ${OSX_CFLAGS} ${OSX_LDFLAGS} -o bbgui
cp scripts/bb_gui_ldpath.sh berrybots
endif
chmod 755 berrybots
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
osxcli:
$(MAKE_LUAJIT)
ifeq ($(SFML_HEADER_PATH), )
$(CC) ${CLI_SOURCES} ${OSXCLI_EXTRA_SOURCES} ${OSXCLI_CFLAGS} ${OSXCLI_LDFLAGS} -o berrybots
else
./scripts/osx_copy_fix_dylib_paths.sh "${SFML_LIB_PATH}" "sfml-lib"
$(CC) ${CLI_SOURCES} ${OSXCLI_EXTRA_SOURCES} ${OSXCLI_CFLAGS} ${OSXCLI_LDFLAGS} -o bbmain
cp scripts/bb_osx.sh berrybots
chmod 755 berrybots
endif
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
linux:
$(MAKE_LUAJIT)
ifeq ($(SFML_HEADER_PATH), )
$(CC) ${SOURCES} ${LINUX_EXTRA_SOURCES} ${LINUX_CFLAGS} ${LINUX_LDFLAGS} -o bbgui
cp scripts/bb_gui.sh berrybots
else
ifeq ($(LOCAL_SFML), 1)
$(MAKE_SFML)
endif
ifeq ($(LOCAL_WX), 1)
$(MAKE_WX)
endif
ifeq ($(LOCAL_LIBARCHIVE), 1)
$(MAKE_LIBARCHIVE)
endif
$(CC) ${SOURCES} ${LINUX_EXTRA_SOURCES} ${LINUX_CFLAGS} ${LINUX_LDFLAGS} -o bbgui
cp scripts/bb_gui_ldpath.sh berrybots
rm -rf sfml-lib
cp -r ${SFML_LIB_PATH} sfml-lib
endif
chmod 755 berrybots
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
linuxcli:
$(MAKE_LUAJIT)
ifeq ($(SFML_HEADER_PATH), )
$(CC) ${CLI_SOURCES} ${LINUXCLI_EXTRA_SOURCES} ${LINUXCLI_CFLAGS} ${LINUXCLI_LDFLAGS} -o berrybots
else
$(CC) ${CLI_SOURCES} ${LINUXCLI_EXTRA_SOURCES} ${LINUXCLI_CFLAGS} ${LINUXCLI_LDFLAGS} -o bbmain
rm -rf sfml-lib
cp -r ${SFML_LIB_PATH} sfml-lib
cp scripts/bb_linux.sh berrybots
chmod 755 berrybots
endif
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
webui:
$(MAKE_LUAJIT)
$(CC) ${WEBUI_SOURCES} ${WEBUI_CFLAGS} ${WEBUI_LDFLAGS} -o berrybots
chmod 755 berrybots
@echo "==== Successfully built BerryBots $(VERSION) ===="
@echo "==== Launch BerryBots with: ./berrybots"
install:
ifeq ($(wildcard bbgui), )
$(error Can only install BerryBots GUI targets.)
endif
mkdir -p $(DESTDIR)$(bindir)
cp bbgui $(DESTDIR)$(bindir)/berrybots
mkdir -p $(DESTDIR)$(datadir)/berrybots
cp LICENSE $(DESTDIR)$(datadir)/berrybots
cp README $(DESTDIR)$(datadir)/berrybots
cp -r resources $(DESTDIR)$(datadir)/berrybots
cp -r bots $(DESTDIR)$(datadir)/berrybots
cp -r stages $(DESTDIR)$(datadir)/berrybots
cp -r runners $(DESTDIR)$(datadir)/berrybots
cp -r apidoc $(DESTDIR)$(datadir)/berrybots
ifneq ($(SFML_HEADER_PATH), )
mkdir -p $(DESTDIR)$(libdir)
rm -rf $(DESTDIR)$(libdir)/berrybots
cp -r sfml-lib $(DESTDIR)$(libdir)/berrybots
ifeq ($(.DEFAULT_GOAL), osx)
./scripts/osx_fix_dylib_paths.sh $(DESTDIR)$(bindir)/berrybots $(DESTDIR)$(libdir)/berrybots
endif
endif
mkdir -p $(DESTDIR)$(datarootdir)/pixmaps
cp $(DESTDIR)$(datadir)/berrybots/resources/icon.iconset/icon_128x128.png $(DESTDIR)/$(datarootdir)/pixmaps/berrybots.png
mkdir -p $(DESTDIR)$(datarootdir)/applications
cp scripts/berrybots.desktop $(DESTDIR)$(datarootdir)/applications
uninstall:
rm $(DESTDIR)$(bindir)/berrybots
rm -rf $(DESTDIR)$(datadir)/berrybots
rm -rf $(DESTDIR)$(libdir)/berrybots
rm $(DESTDIR)$(datarootdir)/applications/berrybots.desktop
rm $(DESTDIR)$(datarootdir)/pixmaps/berrybots.png
clean:
$(CLEAN_LUAJIT)
ifeq ($(LOCAL_SFML), 1)
$(CLEAN_SFML)
endif
ifeq ($(LOCAL_WX), 1)
$(CLEAN_WX)
endif
ifeq ($(LOCAL_LIBARCHIVE), 1)
$(CLEAN_LIBARCHIVE)
endif
rm -rf *o sfml-lib bbgui berrybots.sh berrybots config.log config.status autom4te.cache
distclean: clean
rm Makefile