forked from scummvm/scummvm-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
412 lines (335 loc) · 10.7 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
# This file is used by Makefile and declares common build rules,
# a list of common object files etc.
#
# $URL$
# $Id$
######################################################################
# 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 \
deriven \
descumm \
desword2 \
gob_loadcalc \
extract_mohawk \
construct_mohawk \
scummvm-tools-cli
ifdef USE_BOOST
PROGRAMS += \
decompile
endif
ifdef USE_FREETYPE
ifdef USE_ICONV
PROGRAMS += \
create_sjisfnt
endif
endif
ifdef USE_WXWIDGETS
PROGRAMS += \
scummvm-tools
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/util.o \
sound/adpcm.o \
sound/audiostream.o \
sound/voc.o \
sound/wave.o
bundle_name = ScummVM\ Tools.app
bundle: scummvm-tools$(EXEEXT)
mkdir -p $(bundle_name)
mkdir -p $(bundle_name)/Contents
mkdir -p $(bundle_name)/Contents/MacOS
mkdir -p $(bundle_name)/Contents/Resources
echo "APPL????" > $(bundle_name)/Contents/PkgInfo
cp $(srcdir)/dists/macosx/Info.plist $(bundle_name)/Contents/
cp $(srcdir)/gui/media/*.* $(bundle_name)/Contents/Resources
cp scummvm-tools$(EXEEXT) $(bundle_name)/Contents/MacOS/
decine_OBJS := engines/cine/decine.o
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_bargon.o \
engines/gob/degob_script_fascin.o \
tool.o \
version.o \
$(UTILS)
dekyra_OBJS := \
engines/kyra/dekyra.o \
engines/kyra/dekyra_v1.o \
$(UTILS)
deriven_OBJS := \
engines/mohawk/archive.o \
engines/mohawk/deriven.o \
engines/mohawk/utils/file.o \
common/hashmap.o \
common/md5.o \
common/memorypool.o \
common/str.o \
common/util.o
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_bargon.o \
engines/gob/degob_script_fascin.o \
engines/gob/degob_script_geisha.o \
tool.o \
version.o \
$(UTILS)
gob_loadcalc_OBJS := \
engines/gob/gob_loadcalc.o
extract_mohawk_OBJS := \
engines/mohawk/archive.o \
engines/mohawk/extract_mohawk.o \
engines/mohawk/utils/file.o \
common/hashmap.o \
common/md5.o \
common/memorypool.o \
common/str.o \
common/util.o
construct_mohawk_OBJS := \
engines/mohawk/construct_mohawk.o \
$(UTILS)
create_sjisfnt_OBJS := create_sjisfnt.o $(UTILS)
create_sjisfnt_LIBS := $(FREETYPELIBS) $(ICONVLIBS)
# Set custom build flags
create_sjisfnt.o: CPPFLAGS+=$(FREETYPEINCLUDES) $(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/gob/compress_gob.o \
engines/gob/extract_fascination_cd.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_bun.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/touche/compress_touche.o \
engines/tucker/compress_tucker.o \
engines/agos/extract_agos.o \
engines/cine/extract_cine.o \
engines/cruise/extract_cruise_pc.o \
engines/gob/extract_gob_stk.o \
engines/kyra/extract_kyra.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)
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/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
######################################################################
# 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 = @
endif
endif
endif
######################################################################
# Generate list of tool binaries
TARGETS := $(addsuffix $(EXEEXT),$(PROGRAMS))
all: $(TARGETS)
install: $(TARGETS)
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 Subversion's working copy information
######################################################################
ifeq ($(shell LANG=C svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
SVNROOT := $(srcdir)
ifeq ($(origin SVNREV), undefined)
# Get the working copy base revision
VER_SVNREV := $(shell LANG=C svn info $(SVNROOT) | grep "^Revision" | cut -d ' ' -f 2)
endif
else
SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/trunk/
endif
# Define the Subversion revision if available, either autodetected or
# specified by the user
ifneq ($(origin VER_SVNREV), undefined)
CXXFLAGS+= -DSCUMMVM_TOOLS_SVN_REVISION=\"$(VER_SVNREV)\"
endif