forked from scummvm/scummvm-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
583 lines (483 loc) · 14.1 KB
/
Makefile.common
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
# This file is used by Makefile and declares common build rules,
# a list of common object files etc.
######################################################################
# The default build target
######################################################################
all:
######################################################################
# Module settings
######################################################################
#MODULES := test tools base $(MODULES)
# TODO: This file should be restructured and much of it moved
# to module.mk style files.
#######################################################################
PROGRAMS = \
decine \
degob \
dekyra \
deprince \
descumm \
desword2 \
detwine \
gob_loadcalc \
extract_gob_cdi \
extract_mohawk \
extract_ngi \
construct_mohawk \
msn_convert_mod \
scummvm-tools-cli \
extract_hadesch \
extract_hadesch_img \
extract_lokalizator \
extract_mps \
grim_animb2txt \
grim_bm2bmp \
grim_cosb2cos \
grim_delua \
grim_diffr \
grim_imc2wav \
grim_int2flt \
grim_luac \
grim_meshb2obj \
grim_mklab \
grim_patchex \
grim_patchr \
grim_set2fig \
grim_setb2set \
grim_sklb2txt \
grim_til2bmp \
grim_unlab \
grim_vima \
saga_unpack_amiga \
saga_unpack
ifdef USE_BOOST
PROGRAMS += \
decompile
endif
ifdef USE_FREETYPE2
ifdef USE_ICONV
PROGRAMS += \
create_sjisfnt
endif
endif
ifdef USE_WXWIDGETS
PROGRAMS += \
scummvm-tools
endif
ifdef MACOSX
PROGRAMS += \
pegasus_save_types
endif
# TODO: We don't currently set USE_GTK in configure, so the user would have
# to manually specify it
ifdef USE_GTK
PROGRAMS += \
sword2_clue
endif
UTILS := \
common/file.o \
common/hashmap.o \
common/md5.o \
common/memorypool.o \
common/str.o \
common/stream.o \
common/util.o \
sound/adpcm.o \
sound/audiostream.o \
sound/voc.o \
sound/wave.o
GRIM_LUA := \
engines/grim/lua/lapi.o \
engines/grim/lua/lauxlib.o \
engines/grim/lua/lbuffer.o \
engines/grim/lua/lbuiltin.o \
engines/grim/lua/ldo.o \
engines/grim/lua/lfunc.o \
engines/grim/lua/lgc.o \
engines/grim/lua/liolib.o \
engines/grim/lua/llex.o \
engines/grim/lua/lmathlib.o \
engines/grim/lua/lmem.o \
engines/grim/lua/lobject.o \
engines/grim/lua/lparser.o \
engines/grim/lua/lstate.o \
engines/grim/lua/lstring.o \
engines/grim/lua/lstrlib.o \
engines/grim/lua/ltable.o \
engines/grim/lua/ltask.o \
engines/grim/lua/ltm.o \
engines/grim/lua/lundump.o \
engines/grim/lua/lvm.o \
engines/grim/lua/lzio.o
decine_OBJS := engines/cine/decine.o
dekyra_OBJS := \
engines/kyra/dekyra.o \
engines/kyra/dekyra_v1.o \
$(UTILS)
extract_hadesch_OBJS := \
engines/hadesch/extract_hadesch.o \
$(UTILS)
saga_unpack_OBJS := \
engines/saga/unpack_saga.o \
$(UTILS)
saga_unpack_amiga_OBJS := \
engines/saga/unpack_amiga.o \
$(UTILS)
extract_hadesch_img_OBJS := \
engines/hadesch/extract_hadesch_img.o \
$(UTILS)
extract_hadesch_img_LIBS := $(LIBS)
extract_lokalizator_OBJS := \
engines/scumm/extract_lokalizator.o
extract_mps_OBJS := \
engines/mads/extract_mps.o \
common/dcl.o \
$(UTILS)
deprince_OBJS := \
engines/prince/deprince.o \
engines/prince/flags.o \
engines/prince/utils.o \
$(UTILS)
descumm_OBJS := \
engines/scumm/descumm.o \
engines/scumm/descumm6.o \
engines/scumm/descumm-common.o \
engines/scumm/descumm-tool.o \
tool.o \
version.o \
$(UTILS)
desword2_OBJS := \
engines/sword2/desword2.o \
tool.o \
version.o \
$(UTILS)
degob_OBJS := \
engines/gob/degob.o \
engines/gob/degob_script.o \
engines/gob/degob_script_v1.o \
engines/gob/degob_script_v2.o \
engines/gob/degob_script_v3.o \
engines/gob/degob_script_v4.o \
engines/gob/degob_script_v5.o \
engines/gob/degob_script_v6.o \
engines/gob/degob_script_v7.o \
engines/gob/degob_script_bargon.o \
engines/gob/degob_script_fascin.o \
engines/gob/degob_script_geisha.o \
engines/gob/degob_script_littlered.o \
tool.o \
version.o \
$(UTILS)
detwine_OBJS := \
engines/twine/detwine.o \
engines/twine/hqr.o \
engines/twine/lba1.o \
engines/twine/lba2.o \
tool.o \
version.o \
$(UTILS)
gob_loadcalc_OBJS := \
engines/gob/gob_loadcalc.o
extract_gob_cdi_OBJS := \
engines/gob/extract_gob_cdi.o \
$(UTILS)
extract_mohawk_OBJS := \
engines/mohawk/archive.o \
engines/mohawk/extract_mohawk.o \
engines/mohawk/utils.o \
$(UTILS)
extract_ngi_OBJS := \
engines/ngi/extract_ngi.o \
$(UTILS)
construct_mohawk_OBJS := \
engines/mohawk/construct_mohawk.o \
engines/mohawk/utils.o \
$(UTILS)
msn_convert_mod_OBJS := \
common/file.o \
common/util.o \
engines/supernova/convert_mod.o
grim_animb2txt_OBJS := \
engines/grim/emi/animb2txt.o \
engines/grim/lab.o
grim_bm2bmp_OBJS := \
engines/grim/bm2bmp.o \
engines/grim/lab.o
grim_cosb2cos_OBJS := \
engines/grim/emi/cosb2cos.o
grim_delua_OBJS := \
engines/grim/delua.o \
$(GRIM_LUA)
ifdef USE_ZLIB
grim_diffr_OBJS := \
engines/grim/diffr.o \
$(UTILS) \
common/zlib.o
grim_diffr_LIBS := $(LIBS)
endif
grim_imc2wav_OBJS := \
engines/grim/imc2wav.o
grim_int2flt_OBJS := \
engines/grim/int2flt.o
grim_luac_OBJS := \
engines/grim/luac/dump.o \
engines/grim/luac/luac.o \
engines/grim/luac/opcode.o \
engines/grim/luac/opt.o \
engines/grim/luac/print.o \
engines/grim/luac/rebase.o \
$(GRIM_LUA)
grim_meshb2obj_OBJS := \
engines/grim/emi/meshb2obj.o \
engines/grim/lab.o
grim_mklab_OBJS := \
engines/grim/mklab.o
grim_patchex_OBJS := \
engines/grim/patchex/patchex.o \
engines/grim/patchex/mszipd.o \
engines/grim/patchex/cabd.o
ifdef USE_ZLIB
grim_patchr_OBJS := \
engines/grim/patchr.o \
$(UTILS) \
common/zlib.o
grim_patchr_LIBS := $(LIBS)
endif
grim_set2fig_OBJS := \
engines/grim/set2fig.o
grim_setb2set_OBJS := \
engines/grim/emi/setb2set.o \
engines/grim/lab.o
grim_sklb2txt_OBJS := \
engines/grim/emi/sklb2txt.o \
engines/grim/lab.o
ifdef USE_ZLIB
grim_til2bmp_OBJS := \
engines/grim/emi/til2bmp.o \
engines/grim/lab.o
grim_til2bmp_LIBS := $(LIBS)
endif
grim_unlab_OBJS := \
engines/grim/unlab.o \
engines/grim/lab.o
grim_vima_OBJS := \
engines/grim/vima.o
pegasus_save_types_OBJS := \
engines/pegasus/pegasus_save_types.o \
$(UTILS)
pegasus_save_types_LIBS := -framework CoreServices
create_sjisfnt_OBJS := create_sjisfnt.o $(UTILS)
create_sjisfnt_LIBS := $(FREETYPE2_LIBS) $(ICONVLIBS)
# Set custom build flags
create_sjisfnt.o: CPPFLAGS+=$(FREETYPE2_CFLAGS) $(ICONVCFLAGS)
sword2_clue_OBJS := engines/sword2/sword2_clue.o common/file.o
sword2_clue_LIBS := `pkg-config --libs gtk+-2.0`
# Set custom build flags
engines/sword2/sword2_clue.o: CPPFLAGS+=`pkg-config --cflags gtk+-2.0`
tools_OBJS := \
engines/agos/compress_agos.o \
engines/bladerunner/pack_bladerunner.o \
engines/gob/compress_gob.o \
engines/gob/extract_fascination_cd.o \
engines/hdb/extract_hdb.o \
engines/kyra/compress_kyra.o \
engines/queen/compress_queen.o \
engines/saga/compress_saga.o \
engines/sci/compress_sci.o \
engines/scumm/compress_scumm_san.o \
engines/scumm/compress_scumm_sou.o \
engines/sword1/compress_sword1.o \
engines/sword2/compress_sword2.o \
engines/tinsel/compress_tinsel.o \
engines/tony/compress_tony.o \
engines/tony/compress_tony_vdb.o \
engines/touche/compress_touche.o \
engines/tucker/compress_tucker.o \
engines/agos/extract_agos.o \
engines/asylum/extract_asylum.o \
engines/cge/extract_cge.o \
engines/cge/pack_cge.o \
engines/cine/extract_cine.o \
engines/cruise/extract_cruise_pc.o \
engines/cryo/extract_cryo.o \
engines/gob/extract_gob_stk.o \
engines/kyra/extract_kyra.o \
engines/prince/extract_prince.o \
engines/prince/pack_prince.o \
engines/prince/utils.o \
engines/parallaction/extract_parallaction.o \
engines/scumm/extract_loom_tg16.o \
engines/scumm/extract_mm_apple.o \
engines/scumm/extract_mm_c64.o \
engines/scumm/extract_mm_nes.o \
engines/scumm/extract_scumm_mac.o \
engines/scumm/extract_zak_c64.o \
engines/kyra/kyra_ins.o \
engines/kyra/kyra_pak.o \
compress.o \
tool.o \
tools.o \
version.o \
$(UTILS)
ifdef USE_PNG
tools_OBJS += \
encode_dxa.o
endif
scummvm-tools_OBJS := \
gui/configuration.o \
gui/gui_tools.o \
gui/main.o \
gui/pages.o \
$(tools_OBJS) \
$(OBJS)
scummvm-tools_LIBS := $(WXLIBS) $(LIBS)
# Set custom build flags for various files
gui/configuration.o: CPPFLAGS+=$(WXINCLUDES)
gui/gui_tools.o: CPPFLAGS+=$(WXINCLUDES)
gui/main.o: CPPFLAGS+=$(WXINCLUDES)
gui/pages.o: CPPFLAGS+=$(WXINCLUDES)
scummvm-tools-cli_OBJS := \
main_cli.o \
scummvm-tools-cli.o \
$(tools_OBJS)
scummvm-tools-cli_LIBS := $(LIBS)
ifdef USE_BOOST
decompile_OBJS := \
common/file.o \
decompiler/codegen.o \
decompiler/control_flow.o \
decompiler/decompiler.o \
decompiler/disassembler.o \
decompiler/reassembler.o \
decompiler/graph.o \
decompiler/instruction.o \
decompiler/simple_disassembler.o \
decompiler/unknown_opcode.o \
decompiler/value.o \
decompiler/groovie/disassembler.o \
decompiler/groovie/engine.o \
decompiler/kyra/codegen.o \
decompiler/kyra/disassembler.o \
decompiler/kyra/engine.o \
decompiler/scummv6/codegen.o \
decompiler/scummv6/disassembler.o \
decompiler/scummv6/engine.o
decompile_LIBS := \
-lboost_program_options$(BOOST_SUFFIX)
# Decompiler tests
-include decompiler/test/module.mk
endif
# Decompiler documentation
doc:
make -C decompiler/doc all
# Make base/version.o depend on all other object files. This way if anything is
# changed, it causes version.cpp to be recompiled. This in turn ensures that
# the build date in gScummVMBuildDate is correct.
version.o: $(filter-out version.o,$(descumm_OBJS))
version.o: $(filter-out version.o,$(desword2_OBJS))
version.o: $(filter-out version.o,$(degob_OBJS))
version.o: $(filter-out version.o,$(scummvm-tools-cli_OBJS))
ifdef USE_WXWIDGETS
version.o: $(filter-out version.o,$(scummvm-tools_OBJS))
endif
version.o: $(filter-out version.o,$(detwine_OBJS))
######################################################################
# The build rules follow - normally you should have no need to
# touch whatever comes after here.
######################################################################
# Replace regular output with quiet messages
ifneq ($(findstring $(MAKEFLAGS),s),s)
ifneq ($(VERBOSE_BUILD),1)
ifneq ($(VERBOSE_BUILD),yes)
QUIET_CXX = @echo ' ' C++ ' ' $@;
QUIET_AR = @echo ' ' AR ' ' $@;
QUIET_RANLIB = @echo ' ' RANLIB ' ' $@;
QUIET_LINK = @echo ' ' LINK ' ' $(1);
QUIET_WINDRES = @echo ' ' WINDRES '' $@;
QUIET = @
endif
endif
endif
######################################################################
# Generate list of tool binaries
TARGETS := $(addsuffix $(EXEEXT),$(PROGRAMS))
all: $(TARGETS)
install: $(TARGETS)
$(INSTALL) -p -m 0755 -d $(DESTDIR)$(BINDIR)
$(INSTALL) -p -m 0755 -d $(DESTDIR)$(DATADIR)/scummvm-tools
for i in $^ ; do $(INSTALL) -p -m 0755 $$i $(DESTDIR)$(BINDIR) ; done
$(INSTALL) -m 0755 -d $(DESTDIR)$(DATADIR)/scummvm-tools
$(INSTALL) -p -m 0644 $(srcdir)/gui/media/*.* $(DESTDIR)$(DATADIR)/scummvm-tools
# Template for all executable targets.
# This also automatically hooks up a "clean" rule.
# It also sets up MODULE_DIRS.
define PROGRAM_template
MODULE_DIRS += $(dir $($(1)_OBJS))
$(1)$(EXEEXT): $$($(1)_OBJS)
$(QUIET_LINK)$(LD) -o $(1)$(EXEEXT) $$($(1)_OBJS) $(LDFLAGS) $$($(1)_LIBS)
#all: $(1)$(EXEEXT)
clean-$(1):
$(RM) $(1)$(EXEEXT)
clean: clean-$(1)
endef
# Generate build rules for all tools
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
# Merge duplicate entries in MODULE_DIRS
MODULE_DIRS := $(sort $(MODULE_DIRS))
######################################################################
clean:
$(RM) $(addsuffix *.o,$(MODULE_DIRS))
# Concat DEFINES and INCLUDES to form the CPPFLAGS
CPPFLAGS := $(DEFINES) $(INCLUDES)
# Include the build instructions for all modules
#-include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
# Depdir information
DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
DEPFILES =
ifdef CXX_UPDATE_DEP_FLAG
# Build rule for C++ files. Makes use of CXX_UPDATE_DEP_FLAG for advanced
# dependency tracking.
%.o: %.cpp
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
else
# Dumb compile rule, for C++ compilers that don't allow dependency tracking or
# where it is broken (such as GCC 2.95).
.cpp.o:
$(QUIET_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
endif
# Include the dependency tracking files.
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
# Mark *.d files and most *.mk files as PHONY. This stops make from trying to
# recreate them (which it can't), and in particular from looking for potential
# source files. This can save quite a bit of disk access time.
.PHONY: $(wildcard $(addsuffix /*.d,$(DEPDIRS))) $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES))) \
$(srcdir)/$(port_mk) $(srcdir)/rules.mk $(srcdir)/engines/engines.mk
######################################################################
# Get the current version information
######################################################################
# AmigaOS4's grep has a problem with "./" in pathnames, so use cat.
VERSION = $(shell cat "${srcdir}/internal_version.h" | grep SCUMMVM_TOOLS_VERSION | cut -d\" -f2)
VER_MAJOR = $(shell echo $(VERSION) | cut -d. -f 1)
VER_MINOR = $(shell echo $(VERSION) | cut -d. -f 2)
VER_PATCH = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c1)
VER_EXTRA = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c2-)
######################################################################
# Get git's working copy information
######################################################################
ifneq ($(shell cd $(srcdir); git rev-parse --verify HEAD 1>/dev/null 2>&1 || echo "error"),error)
GITROOT := $(srcdir)
ifeq ($(origin VER_REV), undefined)
# Are there uncommitted changes? (describe --dirty is only available since 1.6.6)
VER_DIRTY := $(shell cd $(srcdir); git update-index --refresh --unmerged 1>/dev/null 2>&1; git diff-index --quiet HEAD || echo "-dirty")
# Get the working copy base revision
VER_REV := $(shell cd $(srcdir); git describe | cut -d '-' -f 2-)$(VER_DIRTY)
endif
else
GITROOT := git://github.com/scummvm/scummvm-tools.git
endif
# Define the Git revision if available, either autodetected or
# specified by the user, but only for version.cpp.
ifneq ($(origin VER_REV), undefined)
version.o: CXXFLAGS:=$(CXXFLAGS) -DSCUMMVM_TOOLS_REVISION=\"$(VER_REV)\"
endif