mirror of
https://github.com/scummvm/scummvm-tools.git
synced 2026-05-21 05:40:44 +00:00
597 lines
14 KiB
Makefile
597 lines
14 KiB
Makefile
# 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 \
|
|
extract_obb \
|
|
extract_lfg \
|
|
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)
|
|
|
|
extract_obb_OBJS := \
|
|
engines/tetraedge/extract_obb.o \
|
|
common/dcl.o \
|
|
$(UTILS)
|
|
|
|
extract_lfg_OBJS := \
|
|
engines/scumm/extract_lfg.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/agos/extract_simon_acorn.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
|