forked from oomek/attractplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
692 lines (597 loc) · 16.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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
##
##
## Attract-Mode frontend
## Copyright (C) 2013-2018 Andrew Mickelson
##
## This file is part of Attract-Mode.
##
## Attract-Mode is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## Attract-Mode is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Attract-Mode. If not, see <http://www.gnu.org/licenses/>.
##
##
###############################
#
# BUILD CONFIGURATION OPTIONS:
#
# Uncomment the next line to build the DRM/KMS version (alternative to X11)
#USE_DRM=1
#
# Uncomment next line to disable movie support (i.e. no FFmpeg).
#NO_MOVIE=1
#
# Uncomment the next line to enable the use of MMAL video decoder
#USE_MMAL=1
#
# By default, if FontConfig gets enabled we link against the system's expat
# library (because FontConfig uses expat too). If FontConfig is not used
# then Attract-Mode is statically linked to its own version of expat.
# Uncomment next line to always link to Attract-Mode's version of expat.
#BUILD_EXPAT=1
#
# Uncomment next line for Windows static cross-compile build (mxe)
#WINDOWS_STATIC=1
#
# By default, Attract-Mode on Windows is built as a GUI application, which
# does not allow for command line interactions at the Windows console.
# Uncomment the next line to build a console version of Attract-Mode
# instead (Windows only)
#WINDOWS_CONSOLE=1
#
# Uncomment the next line(s) as appropriate to enable hardware video
# decoding on Linux (req FFmpeg >= 3.4)
#FE_HWACCEL_VAAPI=1
#FE_HWACCEL_VDPAU=1
#
# If you set this to 1, AM+ will link the system SFML version
# If left to blank, AM+ will build and link the extlib/SFML version
#USE_SYSTEM_SFML=1
###############################
#FE_DEBUG=1
#VERBOSE=1
#WINDOWS_XP=1
ifeq ($(FE_VERSION),)
override FE_VERSION := v3.0.9
else
$(info user set version on command line)
override FE_VERSION := v$(FE_VERSION)
endif
CC ?= gcc
CXX ?= g++
CFLAGS = $(EXTRA_CFLAGS)
STRIP ?= strip
PKG_CONFIG ?= pkg-config
AR ?= ar
ARFLAGS ?= rc
RM=rm -f
MD=mkdir -p
WINDRES=windres
CMAKE=cmake
LD=objcopy
B64FLAGS = -w0
CFLAGS += -DSQUSEDOUBLE
CFLAGS += -std=c++11
ifndef OPTIMIZE
OPTIMIZE=2
endif
STATIC ?= 1
ifndef VERBOSE
SILENT=@
CC_MSG = @echo Compiling $@...
AR_MSG = @echo Archiving $@...
EXE_MSG = @echo Creating executable: $@
MAKEFLAGS += --no-print-directory
endif
ifneq ($(origin TOOLCHAIN),undefined)
override CC := $(TOOLCHAIN)-$(CC)
override CXX := $(TOOLCHAIN)-$(CXX)
override AR := $(TOOLCHAIN)-$(AR)
override CMAKE := $(TOOLCHAIN)-$(CMAKE)
override LD := $(TOOLCHAIN)-$(LD)
endif
ifneq ($(origin CROSS),undefined)
override STRIP := $(TOOLCHAIN)-$(STRIP)
override PKG_CONFIG := $(TOOLCHAIN)-$(PKG_CONFIG)
PKG_CONFIG_MXE=_$(subst .,_,$(TOOLCHAIN))
override PKG_CONFIG_MXE :=$(subst -,_,$(PKG_CONFIG_MXE))
override WINDRES := $(TOOLCHAIN)-$(WINDRES)
endif
prefix ?= /usr/local
datarootdir=$(prefix)/share
datadir=$(datarootdir)
exec_prefix=$(prefix)
bindir=$(exec_prefix)/bin
DATA_PATH:=$(datadir)/attract/
EXE_BASE=attractplus
EXE_EXT=
OBJ_DIR=obj
SRC_DIR=src
EXTLIBS_DIR=extlibs
RES_DIR=resources
FE_FLAGS=
RES_SRC_DIR=resources
RES_DIR=$(OBJ_DIR)/$(RES_SRC_DIR)
RES_FONTS_DIR = $(RES_DIR)/fonts
RES_IMGS_DIR = $(RES_DIR)/images
_DEP =\
fe_base.hpp \
fe_file.hpp \
fe_util.hpp \
fe_util_sq.hpp \
fe_info.hpp \
fe_input.hpp \
fe_romlist.hpp \
scraper_base.hpp \
scraper_xml.hpp \
fe_settings.hpp \
fe_config.hpp \
fe_presentable.hpp \
fe_present.hpp \
sprite.hpp \
fe_image.hpp \
fe_sound.hpp \
fe_shader.hpp \
fe_overlay.hpp \
fe_window.hpp \
tp.hpp \
fe_text.hpp \
fe_listbox.hpp \
fe_rectangle.hpp \
fe_vm.hpp \
fe_blend.hpp \
path_cache.hpp \
image_loader.hpp \
base64.hpp \
zip.hpp
_OBJ =\
fe_base.o \
fe_file.o \
fe_util.o \
fe_util_sq.o \
fe_cmdline.o \
fe_info.o \
fe_input.o \
fe_romlist.o \
fe_settings.o \
scraper_base.o \
scraper_xml.o \
scraper_general.o \
scraper_net.o \
scraper_gamesdb.o \
fe_config.o \
fe_presentable.o \
fe_present.o \
sprite.o \
fe_image.o \
fe_sound.o \
fe_shader.o \
fe_overlay.o \
fe_window.o \
tp.o \
fe_text.o \
fe_listbox.o \
fe_rectangle.o \
fe_vm.o \
fe_blend.o \
zip.o \
path_cache.o \
image_loader.o \
base64.o \
main.o
_RES =\
resources/fonts/BarlowCJK.ttf \
resources/fonts/Attract.ttf \
resources/images/Logo.png
#
# Backward compatibility with WINDOWS_STATIC
#
ifeq ($(WINDOWS_STATIC),1)
STATIC=1
FE_WINDOWS_COMPILE=1
endif
ifneq ($(FE_WINDOWS_COMPILE),1)
#
# Test OS to set some defaults
#
ifeq ($(OS),Windows_NT)
#
# Windows
#
FE_WINDOWS_COMPILE=1
else
UNAME = $(shell uname -a)
ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
FE_MACOSX_COMPILE=1
endif
ifeq ($(FE_MACOSX_COMPILE),1)
#
# Mac OS X
#
_DEP += fe_util_osx.hpp
_OBJ += fe_util_osx.o
override B64FLAGS = -b 0 -i
LIBS += -framework Cocoa -framework Carbon -framework IOKit -framework CoreVideo
else
ifeq ($(USE_DRM),1)
else
#
# Test for Xlib and Xinerama...
#
ifeq ($(shell $(PKG_CONFIG) --exists x11 && echo "1" || echo "0"), 1)
USE_XLIB=1
ifeq ($(shell $(PKG_CONFIG) --exists xinerama && echo "1" || echo "0"), 1)
USE_XINERAMA=1
endif
endif
endif
endif
endif
endif
#
# Deal with SFML
#
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SFML_OBJ_DIR = $(OBJ_DIR)/sfml
SFML_LIB_DIR=$(SFML_OBJ_DIR)/install/lib/
SFML_PKG_CONFIG_PATH=$(ROOT_DIR)/$(SFML_OBJ_DIR)/install/pkgconfig
LIBS += -L$(SFML_LIB_DIR)
SFML_PC="sfml-system sfml-window sfml-graphics"
SFML_TOKEN=$(SFML_OBJ_DIR)/.sfmlok
ifeq ($(FE_MACOSX_COMPILE),1)
LIBS += -framework OpenGL
LIBS += $(shell pkg-config --libs-only-L freetype2) -lfreetype
LIBS += $(shell pkg-config --libs-only-L libjpeg) -ljpeg
endif
ifneq ($(FE_WINDOWS_COMPILE),1)
ifneq ($(FE_MACOSX_COMPILE),1)
LIBS += -ldl -lGL -lpthread
endif
else
LIBS += -lopengl32 -lgdi32
endif
ifeq ($(FE_WINDOWS_COMPILE),1)
_DEP += attract.rc
_OBJ += attract.res
ifeq ($(WINDOWS_XP),1)
FE_FLAGS += -DWINDOWS_XP
else
LIBS += -ldwmapi
endif
ifeq ($(WINDOWS_CONSOLE),1)
CFLAGS += -mconsole
FE_FLAGS += -DWINDOWS_CONSOLE
EXE_BASE=attractplus-console
else
CFLAGS += -Wl,--subsystem,windows
endif
EXE_EXT = .exe
else
CFLAGS += -DDATA_PATH=\"$(DATA_PATH)\"
endif
#
# Check whether optional libs should be enabled
#
ifeq ($(shell $(PKG_CONFIG) --exists libarchive && echo "1" || echo "0"), 1)
USE_LIBARCHIVE=1
endif
ifeq ($(shell $(PKG_CONFIG) --exists libcurl && echo "1" || echo "0"), 1)
USE_LIBCURL=1
endif
#
# Now process the various settings...
#
ifeq ($(FE_DEBUG),1)
CFLAGS += -g -Wall
FE_FLAGS += -DFE_DEBUG
else
CFLAGS += -O$(OPTIMIZE) -DNDEBUG
endif
ifeq ($(USE_MMAL),1)
FE_FLAGS += -DUSE_MMAL
endif
ifeq ($(USE_XLIB),1)
FE_FLAGS += -DUSE_XLIB
LIBS += -lX11 -lXrandr -lXcursor
ifeq ($(USE_XINERAMA),1)
FE_FLAGS += -DUSE_XINERAMA
LIBS += -lXinerama
endif
endif
ifeq ($(USE_DRM),1)
TEMP_LIBS += libdrm gbm
FE_FLAGS += -DUSE_DRM
LIBS += -lEGL
endif
ifeq ($(FE_HWACCEL_VAAPI),1)
FE_FLAGS += -DFE_HWACCEL_VAAPI
endif
ifeq ($(FE_HWACCEL_VDPAU),1)
FE_FLAGS += -DFE_HWACCEL_VDPAU
endif
ifeq ($(USE_LIBARCHIVE),1)
FE_FLAGS += -DUSE_LIBARCHIVE
TEMP_LIBS += libarchive
LIBS += -lz
else
CFLAGS += -I$(EXTLIBS_DIR)/miniz
endif
ifeq ($(USE_LIBCURL),1)
FE_FLAGS += -DUSE_LIBCURL
TEMP_LIBS += libcurl
_DEP += fe_net.hpp
_OBJ += fe_net.o
endif
ifeq ($(NO_MOVIE),1)
FE_FLAGS += -DNO_MOVIE
ifeq ($(WINDOWS_STATIC),1)
LIBS += -lsfml-audio-s
else
LIBS += -lsfml-audio
endif
AUDIO =
else
TEMP_LIBS += libavformat libavcodec libavutil libswscale libswresample
ifeq ($(FE_MACOSX_COMPILE),1)
LIBS += -framework OpenAL
else
TEMP_LIBS += openal
endif
_DEP += media.hpp
_OBJ += media.o
CFLAGS += -I$(EXTLIBS_DIR)/audio/include
AUDIO = $(OBJ_DIR)/libaudio.a
endif
CFLAGS += -D__STDC_CONSTANT_MACROS -I$(RES_IMGS_DIR) -I$(RES_FONTS_DIR)
ifeq ($(shell $(PKG_CONFIG) --libs $(TEMP_LIBS) && echo "1" || echo "0"), 0)
$(error pkg-config couldn't find some libraries, aborting)
endif
LIBS := $(LIBS) $(shell $(PKG_CONFIG) --libs $(TEMP_LIBS))
CFLAGS := $(CFLAGS) $(shell $(PKG_CONFIG) --cflags $(TEMP_LIBS))
EXE = $(EXE_BASE)$(EXE_EXT)
ifeq ($(BUILD_EXPAT),1)
CFLAGS += -I$(EXTLIBS_DIR)/expat
EXPAT = $(OBJ_DIR)/libexpat.a
ifneq ($(FE_WINDOWS_COMPILE),1)
EXPAT_FLAGS = -DXML_DEV_URANDOM -DHAVE_MEMMOVE
endif
else
LIBS += -lexpat
EXPAT =
endif
LIBS += -lfreetype
# Boost static linking
ifeq ($(FE_WINDOWS_COMPILE),1)
LIBS += -lboost_system-mt -lboost_filesystem-mt
else ifeq ($(FE_MACOSX_COMPILE),1)
LIBS +=-L$(shell brew --prefix)/lib
LIBS += -lboost_system -lboost_filesystem
else
LIBS += -l:libboost_filesystem.a -l:libboost_system.a
endif
CFLAGS += -I$(EXTLIBS_DIR)/squirrel/include -I$(EXTLIBS_DIR)/sqrat/include -I$(EXTLIBS_DIR)/nowide -I$(EXTLIBS_DIR)/nvapi -I$(EXTLIBS_DIR)/rapidjson/include
SQUIRREL = $(OBJ_DIR)/libsquirrel.a $(OBJ_DIR)/libsqstdlib.a
# Our nowide "lib" is only needed on Windows systems
ifeq ($(FE_WINDOWS_COMPILE),1)
SQUIRREL += $(OBJ_DIR)/libnowide.a
endif
OBJ = $(patsubst %,$(OBJ_DIR)/%,$(_OBJ))
DEP = $(patsubst %,$(SRC_DIR)/%,$(_DEP))
RES = $(patsubst %,$(OBJ_DIR)/%.h,$(_RES))
VER_TEMP = $(subst -, ,$(FE_VERSION))
VER_PARTS = $(subst ., ,$(word 1,$(VER_TEMP)))
VER_MAJOR = $(subst v,,$(word 1,$(VER_PARTS)))
VER_MINOR = $(word 2,$(VER_PARTS))
ifneq ($(word 3,$(VER_PARTS)),)
VER_POINT = $(word 3,$(VER_PARTS))
else
VER_POINT = 0
endif
# version macros
FE_FLAGS += -DFE_VERSION_MAJOR=$(VER_MAJOR) -DFE_VERSION_MINOR=$(VER_MINOR) -DFE_VERSION_POINT=$(VER_POINT)
FE_FLAGS += -DFE_VERSION_D='"$(FE_VERSION)"' -DFE_VERSION_NUM=$(VER_MAJOR)$(VER_MINOR)$(VER_POINT)
BUILD_NR = 0
ifdef GITHUB_RUN_NUMBER
BUILD_NR = $(GITHUB_RUN_NUMBER)
FE_FLAGS += -DFE_BUILD_D='"( Build $(BUILD_NR) ) "'
else
FE_FLAGS += -DFE_BUILD_D='""'
endif
$(OBJ_DIR)/%.res: $(SRC_DIR)/%.rc | $(OBJ_DIR)
$(CC_MSG)
$(SILENT)$(WINDRES) $(FE_FLAGS) $< -O coff -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(DEP) $(RES) | $(OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CXX) -c -o $@ $< $(CFLAGS) $(FE_FLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.mm $(DEP) | $(OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CC) -c -o $@ $< $(CFLAGS) $(FE_FLAGS)
.PRECIOUS: $(OBJ_DIR)/%.h
$(OBJ_DIR)/%.h: % | $(RES_FONTS_DIR) $(RES_IMGS_DIR)
$(info Converting $< to $@ ...)
$(shell (echo 'const char* _binary_$(subst .,_,$(subst /,_,$<)) = "' ; base64 $(B64FLAGS) $< ; echo '";') | tr -d '\n' > $@)
$(EXE): $(OBJ) $(EXPAT) $(SQUIRREL) $(AUDIO)
$(EXE_MSG)
$(SILENT)$(CXX) -o $@ $^ $(CFLAGS) $(FE_FLAGS) $(LIBS)
ifneq ($(FE_DEBUG),1)
$(SILENT)$(STRIP) $@
endif
.PHONY: clean
.PHONY: install
.PHONY: sfml sfmlbuild
.PHONY: bin2h
SFML_FLAGS =
ifneq ($(USE_SYSTEM_SFML),1)
sfmlbuild:
ifneq ("$(wildcard $(SFML_TOKEN))","")
$(info SFML is already built)
else
$(info Building SFML...)
ifeq ($(STATIC),1)
$(eval SFML_FLAGS += -DBUILD_SHARED_LIBS=FALSE)
ifeq ($(FE_WINDOWS_COMPILE),1)
$(eval SFML_FLAGS += -DCMAKE_CXX_FLAGS="-DAL_LIBTYPE_STATIC=TRUE")
endif
else
$(eval SFML_FLAGS += -DBUILD_SHARED_LIBS=TRUE)
endif
ifeq ($(USE_DRM),1)
$(eval SFML_FLAGS += -DSFML_USE_DRM=1)
endif
ifeq ($(FE_MACOSX_COMPILE),1)
$(eval SFML_FLAGS += -DSFML_USE_SYSTEM_DEPS=1)
endif
$(SILENT)$(CMAKE) -S extlibs/SFML -B $(SFML_OBJ_DIR) -DCMAKE_INSTALL_PREFIX=$(SFML_OBJ_DIR)/install -DOpenGL_GL_PREFERENCE=GLVND -DSFML_INSTALL_PKGCONFIG_FILES=TRUE -DSFML_BUILD_NETWORK=FALSE $(SFML_FLAGS)
+$(SILENT)$(CMAKE) --build obj/sfml --config Release --target install
touch $(SFML_TOKEN)
endif
else
sfmlbuild:
endif
sfml: sfmlbuild
ifeq ($(STATIC),1)
$(eval SFML_LIBS += $(shell PKG_CONFIG_PATH$(PKG_CONFIG_MXE)="$(SFML_PKG_CONFIG_PATH)" $(PKG_CONFIG) --static --libs-only-L $(SFML_PC)))
$(info Manually adding sfml libs as pkg-config has no --static version)
$(eval SFML_LIBS += -lsfml-graphics-s -lsfml-window-s -lsfml-system-s)
$(eval CFLAGS += -DSFML_STATIC $(shell PKG_CONFIG_PATH$(PKG_CONFIG_MXE)="$(SFML_PKG_CONFIG_PATH)" $(PKG_CONFIG) --static --cflags $(SFML_PC)))
ifeq ($(FE_WINDOWS_COMPILE),1)
else ifeq ($(FE_MACOSX_COMPILE),1)
else
$(eval SFML_LIBS += -lGL -lGLU -lm -lz -ludev -lrt)
endif
else
# SFML may not generate .pc files, so manually add libs
$(eval CFLAGS += $(shell PKG_CONFIG_PATH$(PKG_CONFIG_MXE)="$(SFML_PKG_CONFIG_PATH)" $(PKG_CONFIG) --cflags $(SFML_PC)))
$(eval SFML_LIBS += $(shell PKG_CONFIG_PATH$(PKG_CONFIG_MXE)="$(SFML_PKG_CONFIG_PATH)" $(PKG_CONFIG) --libs $(SFML_PC)))
#LIBS += -lsfml-graphics -lsfml-window -lsfml-system
endif
$(eval override LIBS = $(SFML_LIBS) $(LIBS))
# .WAIT is supported from make 4.4, not yet standard sadly. So the all target appreared
#$(OBJ_DIR) : sfml .WAIT headerinfo
$(OBJ_DIR): headerinfo
$(MD) $@
$(RES_FONTS_DIR): $(OBJ_DIR)
$(MD) $@
$(RES_IMGS_DIR): $(OBJ_DIR)
$(MD) $@
headerinfo: sfml
$(info flags:$(CFLAGS) $(FE_FLAGS))
$(info libs:$(LIBS))
#
# Expat Library
#
EXPAT_OBJ_DIR = $(OBJ_DIR)/expat
EXPATOBJS = \
$(EXPAT_OBJ_DIR)/xmlparse.o \
$(EXPAT_OBJ_DIR)/xmlrole.o \
$(EXPAT_OBJ_DIR)/xmltok.o
$(OBJ_DIR)/libexpat.a: $(EXPATOBJS) | $(EXPAT_OBJ_DIR)
$(AR_MSG)
$(SILENT)$(AR) $(ARFLAGS) $@ $(EXPATOBJS)
$(EXPAT_OBJ_DIR)/%.o: $(EXTLIBS_DIR)/expat/%.c | $(EXPAT_OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CC) -c $< -o $@ $(CFLAGS) $(EXPAT_FLAGS)
$(EXPAT_OBJ_DIR):
$(MD) $@
#
# Squirrel Library
#
SQUIRREL_FLAGS = -fno-exceptions -fno-rtti -fno-strict-aliasing
SQUIRREL_OBJ_DIR = $(OBJ_DIR)/squirrel
SQUIRRELOBJS= \
$(SQUIRREL_OBJ_DIR)/sqapi.o \
$(SQUIRREL_OBJ_DIR)/sqbaselib.o \
$(SQUIRREL_OBJ_DIR)/sqfuncstate.o \
$(SQUIRREL_OBJ_DIR)/sqdebug.o \
$(SQUIRREL_OBJ_DIR)/sqlexer.o \
$(SQUIRREL_OBJ_DIR)/sqobject.o \
$(SQUIRREL_OBJ_DIR)/sqcompiler.o \
$(SQUIRREL_OBJ_DIR)/sqstate.o \
$(SQUIRREL_OBJ_DIR)/sqtable.o \
$(SQUIRREL_OBJ_DIR)/sqmem.o \
$(SQUIRREL_OBJ_DIR)/sqvm.o \
$(SQUIRREL_OBJ_DIR)/sqclass.o
$(OBJ_DIR)/libsquirrel.a: $(SQUIRRELOBJS) | $(SQUIRREL_OBJ_DIR)
$(AR_MSG)
$(SILENT)$(AR) $(ARFLAGS) $@ $(SQUIRRELOBJS)
$(SQUIRREL_OBJ_DIR)/%.o: $(EXTLIBS_DIR)/squirrel/squirrel/%.cpp | $(SQUIRREL_OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CXX) -c $< -o $@ $(CFLAGS) $(SQUIRREL_FLAGS)
$(SQUIRREL_OBJ_DIR):
$(MD) $@
#
# Squirrel libsqstdlib
#
SQSTDLIB_OBJ_DIR = $(OBJ_DIR)/sqstdlib
SQSTDLIBOBJS= \
$(SQSTDLIB_OBJ_DIR)/sqstdblob.o \
$(SQSTDLIB_OBJ_DIR)/sqstdio.o \
$(SQSTDLIB_OBJ_DIR)/sqstdstream.o \
$(SQSTDLIB_OBJ_DIR)/sqstdmath.o \
$(SQSTDLIB_OBJ_DIR)/sqstdstring.o \
$(SQSTDLIB_OBJ_DIR)/sqstdaux.o \
$(SQSTDLIB_OBJ_DIR)/sqstdsystem.o \
$(SQSTDLIB_OBJ_DIR)/sqstdrex.o
$(OBJ_DIR)/libsqstdlib.a: $(SQSTDLIBOBJS) | $(SQSTDLIB_OBJ_DIR)
$(AR_MSG)
$(SILENT)$(AR) $(ARFLAGS) $@ $(SQSTDLIBOBJS)
$(SQSTDLIB_OBJ_DIR)/%.o: $(EXTLIBS_DIR)/squirrel/sqstdlib/%.cpp | $(SQSTDLIB_OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CXX) -c $< -o $@ $(CFLAGS) $(SQUIRREL_FLAGS)
$(SQSTDLIB_OBJ_DIR): sfml
$(MD) $@
#
# Audio
#
AUDIO_OBJ_DIR = $(OBJ_DIR)/audiolib
AUDIOOBJS= \
$(AUDIO_OBJ_DIR)/ALCheck.o \
$(AUDIO_OBJ_DIR)/AudioDevice.o \
$(AUDIO_OBJ_DIR)/Listener.o \
$(AUDIO_OBJ_DIR)/SoundSource.o \
$(AUDIO_OBJ_DIR)/SoundStream.o
$(OBJ_DIR)/libaudio.a: $(AUDIOOBJS) | $(AUDIO_OBJ_DIR)
$(AR_MSG)
$(SILENT)$(AR) $(ARFLAGS) $@ $(AUDIOOBJS)
$(AUDIO_OBJ_DIR)/%.o: $(EXTLIBS_DIR)/audio/Audio/%.cpp | $(AUDIO_OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CXX) -c $< -o $@ $(CFLAGS)
$(AUDIO_OBJ_DIR): sfml
$(MD) $@
#
# Nowide
#
NOWIDE_OBJ_DIR = $(OBJ_DIR)/nowidelib
NOWIDEOBJS= \
$(NOWIDE_OBJ_DIR)/iostream.o \
$(NOWIDE_OBJ_DIR)/filebuf.o \
$(NOWIDE_OBJ_DIR)/cstdio.o \
$(NOWIDE_OBJ_DIR)/cstdlib.o \
$(NOWIDE_OBJ_DIR)/console_buffer.o \
$(NOWIDE_OBJ_DIR)/stat.o
$(OBJ_DIR)/libnowide.a: $(NOWIDEOBJS) | $(NOWIDE_OBJ_DIR)
$(AR_MSG)
$(SILENT)$(AR) $(ARFLAGS) $@ $(NOWIDEOBJS)
$(NOWIDE_OBJ_DIR)/%.o: $(EXTLIBS_DIR)/nowide/%.cpp | $(NOWIDE_OBJ_DIR)
$(CC_MSG)
$(SILENT)$(CXX) -c $< -o $@ $(CFLAGS)
$(NOWIDE_OBJ_DIR):
$(MD) $@
$(DATA_PATH):
$(MD) -p $(DESTDIR)$@
install: $(EXE) $(DATA_PATH)
install -D $(EXE) $(DESTDIR)$(bindir)/$(EXE)
mkdir -p $(DESTDIR)$(DATA_PATH)
cp -r config/* $(DESTDIR)$(DATA_PATH)
smallclean:
-$(RM) $(OBJ_DIR)/*.o *~ core $(RES_FONTS_DIR)/*.h $(RES_IMGS_DIR)/*.h
clean:
-$(RM) -r $(OBJ_DIR)/*.o $(EXPAT_OBJ_DIR)/*.o $(SQUIRREL_OBJ_DIR)/*.o $(SQSTDLIB_OBJ_DIR)/*.o $(AUDIO_OBJ_DIR)/*.o $(NOWIDE_OBJ_DIR)/*.o $(OBJ_DIR)/*.a $(OBJ_DIR)/*.res $(SFML_OBJ_DIR)/* $(SFML_TOKEN) $(RES_FONTS_DIR)/*.h $(RES_IMGS_DIR)/*.h *~ core