2004-04-16 06:56:28 +00:00
|
|
|
# This file is used by Makefile and declares common build rules,
|
2002-11-21 04:08:37 +00:00
|
|
|
# a list of common object files etc.
|
2008-02-25 14:09:04 +00:00
|
|
|
#
|
2002-04-26 13:39:31 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
######################################################################
|
2007-06-15 18:42:00 +00:00
|
|
|
# The default build target: just build the scummvm executable
|
2003-09-08 15:33:26 +00:00
|
|
|
######################################################################
|
|
|
|
|
2007-12-16 21:41:10 +00:00
|
|
|
all: $(EXECUTABLE) plugins
|
2002-04-26 13:39:31 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Module settings
|
|
|
|
######################################################################
|
2003-04-26 11:44:13 +00:00
|
|
|
|
2008-05-02 14:30:06 +00:00
|
|
|
PLUGINS :=
|
2011-04-09 21:47:35 +00:00
|
|
|
MODULES := test devtools base $(MODULES)
|
2003-09-17 22:41:01 +00:00
|
|
|
|
2006-09-23 00:42:35 +00:00
|
|
|
-include $(srcdir)/engines/engines.mk
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
# After the game specific modules follow the shared modules
|
2002-11-21 04:08:37 +00:00
|
|
|
MODULES += \
|
2003-03-07 16:21:28 +00:00
|
|
|
gui \
|
2009-01-30 04:04:10 +00:00
|
|
|
backends \
|
2010-03-30 00:59:08 +00:00
|
|
|
engines \
|
2011-01-23 17:14:43 +00:00
|
|
|
video \
|
2010-03-30 00:59:08 +00:00
|
|
|
graphics \
|
2011-02-09 01:09:01 +00:00
|
|
|
audio \
|
2009-01-30 03:35:47 +00:00
|
|
|
common \
|
2010-06-15 10:44:51 +00:00
|
|
|
po
|
2002-07-06 13:05:42 +00:00
|
|
|
|
2004-11-06 01:41:32 +00:00
|
|
|
ifdef USE_MT32EMU
|
2011-02-09 01:09:01 +00:00
|
|
|
MODULES += audio/softsynth/mt32
|
2004-11-06 01:41:32 +00:00
|
|
|
endif
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# The build rules follow - normally you should have no need to
|
|
|
|
# touch whatever comes after here.
|
|
|
|
######################################################################
|
|
|
|
|
2003-04-26 11:44:13 +00:00
|
|
|
# Concat DEFINES and INCLUDES to form the CPPFLAGS
|
2007-12-16 21:41:10 +00:00
|
|
|
CPPFLAGS := $(DEFINES) $(INCLUDES)
|
2003-04-26 11:44:13 +00:00
|
|
|
|
2002-11-21 04:08:37 +00:00
|
|
|
# Include the build instructions for all modules
|
2004-01-30 21:54:28 +00:00
|
|
|
-include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
|
2002-08-21 16:07:07 +00:00
|
|
|
|
2003-09-19 21:23:23 +00:00
|
|
|
# Depdir information
|
2006-06-24 10:14:18 +00:00
|
|
|
DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
|
2008-01-27 19:47:41 +00:00
|
|
|
DEPFILES =
|
2003-09-19 21:23:23 +00:00
|
|
|
|
2006-04-08 11:36:49 +00:00
|
|
|
# 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
|
2003-07-15 02:16:33 +00:00
|
|
|
# the build date in gScummVMBuildDate is correct.
|
2006-04-08 11:36:49 +00:00
|
|
|
base/version.o: $(filter-out base/libbase.a,$(OBJS))
|
2002-08-21 16:07:07 +00:00
|
|
|
|
2010-09-15 07:44:08 +00:00
|
|
|
ifdef USE_ELF_LOADER
|
|
|
|
backends/plugins/elf/version.o: $(filter-out base/libbase.a,$(filter-out backends/libbackends.a,$(OBJS)))
|
|
|
|
endif
|
|
|
|
|
2009-08-22 11:03:00 +00:00
|
|
|
# Replace regular output with quiet messages
|
|
|
|
ifneq ($(findstring $(MAKEFLAGS),s),s)
|
|
|
|
ifneq ($(VERBOSE_BUILD),1)
|
|
|
|
ifneq ($(VERBOSE_BUILD),yes)
|
2011-05-05 18:24:57 +00:00
|
|
|
QUIET_CXX = @echo ' ' C++ ' ' $@;
|
|
|
|
QUIET_AS = @echo ' ' AS ' ' $@;
|
|
|
|
QUIET_NASM = @echo ' ' NASM ' ' $@;
|
|
|
|
QUIET_AR = @echo ' ' AR ' ' $@;
|
|
|
|
QUIET_RANLIB = @echo ' ' RANLIB ' ' $@;
|
|
|
|
QUIET_PLUGIN = @echo ' ' PLUGIN ' ' $@;
|
|
|
|
QUIET_LINK = @echo ' ' LINK ' ' $@;
|
|
|
|
QUIET_WINDRES = @echo ' ' WINDRES '' $@;
|
|
|
|
QUIET = @
|
2009-08-22 11:03:00 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2003-09-17 22:41:01 +00:00
|
|
|
# The build rule for the ScummVM executable
|
2007-12-16 21:41:10 +00:00
|
|
|
$(EXECUTABLE): $(OBJS)
|
2009-10-09 11:38:13 +00:00
|
|
|
$(QUIET_LINK)$(LD) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
|
2002-07-06 13:05:42 +00:00
|
|
|
|
2003-09-19 21:23:23 +00:00
|
|
|
distclean: clean
|
2007-02-08 22:27:47 +00:00
|
|
|
$(RM) config.h config.mk config.log
|
2003-09-19 21:23:23 +00:00
|
|
|
|
2002-07-06 13:05:42 +00:00
|
|
|
clean:
|
2008-02-17 18:30:18 +00:00
|
|
|
$(RM_REC) $(DEPDIRS)
|
2005-01-11 22:02:05 +00:00
|
|
|
$(RM) $(OBJS) $(EXECUTABLE)
|
2002-07-06 13:05:42 +00:00
|
|
|
|
2009-09-25 12:11:27 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# The build rules for object files.
|
|
|
|
#
|
|
|
|
|
|
|
|
ifdef CXX_UPDATE_DEP_FLAG
|
|
|
|
|
|
|
|
# Build rule for C++ files. Makes use of CXX_UPDATE_DEP_FLAG for advanced
|
2008-01-27 19:47:41 +00:00
|
|
|
# dependency tracking.
|
2008-01-13 17:05:43 +00:00
|
|
|
%.o: %.cpp
|
2009-08-22 11:03:00 +00:00
|
|
|
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
|
2009-09-25 12:11:27 +00:00
|
|
|
$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2009-12-26 13:35:57 +00:00
|
|
|
|
|
|
|
# Build rules for Objective-C and Objective-C++ files. Strictly speaking, this is for OS X only.
|
|
|
|
%.o: %.mm
|
|
|
|
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
|
|
|
|
$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2008-01-13 17:05:43 +00:00
|
|
|
%.o: %.m
|
2009-08-22 11:03:00 +00:00
|
|
|
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
|
2009-09-25 12:11:27 +00:00
|
|
|
$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(OBJCFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2010-03-09 00:45:24 +00:00
|
|
|
# Build rule for assembler files with preprocessing
|
|
|
|
%.o: %.S
|
|
|
|
$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
|
|
|
|
$(QUIET_AS)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(ASFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2009-09-25 12:11:27 +00:00
|
|
|
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:
|
2010-03-09 00:43:31 +00:00
|
|
|
$(QUIET)$(MKDIR) $(*D)
|
2009-09-25 12:11:27 +00:00
|
|
|
$(QUIET_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2010-03-09 00:45:24 +00:00
|
|
|
# Build rule for assembler files with preprocessing
|
|
|
|
%.o: %.S
|
|
|
|
$(QUIET)$(MKDIR) $(*D)
|
|
|
|
$(QUIET_AS)$(CXX) $(ASFLAGS) -c $(<) -o $*.o
|
|
|
|
|
2003-08-02 09:21:34 +00:00
|
|
|
endif
|
2002-08-21 16:53:11 +00:00
|
|
|
|
2009-11-18 23:34:40 +00:00
|
|
|
# Build rule for assembler files
|
2009-08-22 16:30:20 +00:00
|
|
|
%.o: %.s
|
2009-10-04 23:21:01 +00:00
|
|
|
$(QUIET)$(MKDIR) $(*D)
|
2009-08-22 16:30:20 +00:00
|
|
|
$(QUIET_AS)$(AS) $(ASFLAGS) $(<) -o $*.o
|
|
|
|
|
2010-03-08 23:56:59 +00:00
|
|
|
ifdef USE_NASM
|
2009-11-18 23:35:50 +00:00
|
|
|
# Build rule for NASM assembler files
|
2008-01-13 17:05:43 +00:00
|
|
|
%.o: %.asm
|
2009-10-04 23:21:01 +00:00
|
|
|
$(QUIET)$(MKDIR) $(*D)
|
2010-05-09 13:31:34 +00:00
|
|
|
$(QUIET_NASM)$(NASM) $(NASMFLAGS) -o $*.o $(<)
|
2004-05-21 02:08:48 +00:00
|
|
|
endif
|
|
|
|
|
2007-09-29 11:20:07 +00:00
|
|
|
# Include the dependency tracking files.
|
|
|
|
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
|
2007-12-16 21:41:10 +00:00
|
|
|
|
2009-11-18 23:34:40 +00:00
|
|
|
# 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.
|
2009-10-28 13:43:57 +00:00
|
|
|
.PHONY: $(wildcard $(addsuffix /*.d,$(DEPDIRS))) $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES))) \
|
|
|
|
$(srcdir)/$(port_mk) $(srcdir)/rules.mk $(srcdir)/engines/engines.mk
|
2007-12-16 21:41:10 +00:00
|
|
|
|
|
|
|
######################################################################
|
2009-03-19 18:39:47 +00:00
|
|
|
# Get the current version information
|
2007-12-16 21:41:10 +00:00
|
|
|
######################################################################
|
|
|
|
|
2011-04-30 20:00:17 +00:00
|
|
|
VERSION = $(shell grep SCUMMVM_VERSION "${srcdir}/base/internal_version.h" | cut -d\" -f2)
|
2007-12-16 21:41:10 +00:00
|
|
|
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-)
|
|
|
|
|
2009-03-19 18:39:47 +00:00
|
|
|
|
|
|
|
######################################################################
|
2011-02-12 17:54:19 +00:00
|
|
|
# Get git's working copy information
|
2009-03-19 18:39:47 +00:00
|
|
|
######################################################################
|
|
|
|
|
2011-02-12 17:54:19 +00:00
|
|
|
ifneq ($(shell cd $(srcdir); git rev-parse --verify HEAD 1>/dev/null 2>&1 || echo "error"),error)
|
|
|
|
GITROOT := $(srcdir)
|
2011-02-12 16:43:57 +00:00
|
|
|
ifeq ($(origin VER_REV), undefined)
|
2011-02-12 18:18:50 +00:00
|
|
|
# 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")
|
2009-03-19 18:39:47 +00:00
|
|
|
# Get the working copy base revision
|
2011-02-12 18:18:50 +00:00
|
|
|
VER_REV := $(shell cd $(srcdir); git describe --match desc/\* | cut -d '-' -f 2-)$(VER_DIRTY)
|
2009-03-19 18:39:47 +00:00
|
|
|
endif
|
|
|
|
else
|
2011-02-12 17:54:19 +00:00
|
|
|
GITROOT := git://github.com/scummvm/scummvm.git
|
2009-03-19 18:39:47 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Define the Subversion revision if available, either autodetected or
|
2010-08-11 12:50:18 +00:00
|
|
|
# specified by the user, but only for base/version.cpp.
|
2011-02-12 16:43:57 +00:00
|
|
|
ifneq ($(origin VER_REV), undefined)
|
|
|
|
base/version.o: CXXFLAGS:=$(CXXFLAGS) -DSCUMMVM_REVISION=\"$(VER_REV)\"
|
2009-03-19 18:39:47 +00:00
|
|
|
endif
|
|
|
|
|
2007-12-16 21:41:10 +00:00
|
|
|
######################################################################
|
|
|
|
# Distribution settings
|
|
|
|
######################################################################
|
|
|
|
|
2011-02-12 17:54:19 +00:00
|
|
|
ifeq ($(VER_EXTRA),git)
|
2011-02-12 16:43:57 +00:00
|
|
|
ifeq ($(origin VER_REV), undefined)
|
2007-12-16 21:41:10 +00:00
|
|
|
DISTVERSION = $(shell date '+%Y-%m-%d')
|
|
|
|
else
|
2011-02-12 17:54:19 +00:00
|
|
|
DISTVERSION = git$(VER_REV)
|
2009-03-19 19:42:22 +00:00
|
|
|
endif
|
|
|
|
else
|
2007-12-16 21:41:10 +00:00
|
|
|
DISTVERSION = $(VERSION)
|
|
|
|
endif
|
|
|
|
|
|
|
|
DISTNAME := scummvm-$(DISTVERSION)
|
|
|
|
DISTDIR := dist
|
|
|
|
VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
|
|
|
|
|
2011-02-12 17:54:19 +00:00
|
|
|
# TODO git via $(GITROOT)
|
2007-12-16 21:41:10 +00:00
|
|
|
$(VERFILE): $(srcdir)/base/internal_version.h
|
|
|
|
@$(RM_REC) $(DISTDIR)
|
|
|
|
@$(MKDIR) $(DISTDIR)
|
|
|
|
svn export $(SVNROOT) $(DISTDIR)/$(DISTNAME)
|
2011-02-12 16:43:57 +00:00
|
|
|
ifneq ($(origin VER_REV), undefined)
|
2009-03-19 19:42:22 +00:00
|
|
|
@# Use the current SVN revision as a default for the snapshot sources
|
|
|
|
@svn cat $(SVNROOT)/base/internal_version.h | sed -e \
|
2011-02-12 16:43:57 +00:00
|
|
|
"s/^#define SCUMMVM_REVISION$$/#define SCUMMVM_REVISION \"$(VER_REV)\"/g" \
|
2009-03-19 19:42:22 +00:00
|
|
|
> $(VERFILE)
|
|
|
|
endif
|
2007-12-16 21:41:10 +00:00
|
|
|
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.gz: $(VERFILE)
|
|
|
|
cd $(DISTDIR); tar zcf $(DISTNAME).tar.gz $(DISTNAME)
|
|
|
|
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.bz2: $(VERFILE)
|
|
|
|
cd $(DISTDIR); tar jcf $(DISTNAME).tar.bz2 $(DISTNAME)
|
|
|
|
|
|
|
|
$(DISTDIR)/$(DISTNAME).zip: $(VERFILE)
|
|
|
|
cd $(DISTDIR); zip -qr9 $(DISTNAME).zip $(DISTNAME)
|
|
|
|
|
|
|
|
dist-src: \
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.gz \
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.bz2 \
|
|
|
|
$(DISTDIR)/$(DISTNAME).zip
|
|
|
|
@#RPM-src?
|
|
|
|
@#DEB-src?
|
|
|
|
|
2009-06-18 18:40:38 +00:00
|
|
|
# Common files
|
2010-08-09 14:36:35 +00:00
|
|
|
DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.BSD COPYING.LGPL COPYRIGHT NEWS README)
|
2008-01-06 14:08:53 +00:00
|
|
|
|
|
|
|
# Themes files
|
2010-10-01 18:20:41 +00:00
|
|
|
DIST_FILES_THEMES=scummmodern.zip scummclassic.zip
|
2010-08-19 11:46:55 +00:00
|
|
|
ifdef USE_TRANSLATION
|
|
|
|
DIST_FILES_THEMES+=translations.dat
|
|
|
|
endif
|
|
|
|
DIST_FILES_THEMES:=$(addprefix $(srcdir)/gui/themes/,$(DIST_FILES_THEMES))
|
2008-01-06 14:08:53 +00:00
|
|
|
|
|
|
|
# Engine data files
|
|
|
|
DIST_FILES_ENGINEDATA=
|
2008-06-09 12:23:56 +00:00
|
|
|
ifdef ENABLE_DRASCULA
|
|
|
|
DIST_FILES_ENGINEDATA+=drascula.dat
|
|
|
|
endif
|
2010-08-17 09:28:20 +00:00
|
|
|
ifdef ENABLE_HUGO
|
|
|
|
DIST_FILES_ENGINEDATA+=hugo.dat
|
|
|
|
endif
|
2008-05-06 03:00:26 +00:00
|
|
|
ifdef ENABLE_KYRA
|
2008-01-06 14:08:53 +00:00
|
|
|
DIST_FILES_ENGINEDATA+=kyra.dat
|
|
|
|
endif
|
2008-05-06 03:00:26 +00:00
|
|
|
ifdef ENABLE_LURE
|
2008-01-06 14:08:53 +00:00
|
|
|
DIST_FILES_ENGINEDATA+=lure.dat
|
|
|
|
endif
|
2008-05-06 03:00:26 +00:00
|
|
|
ifdef ENABLE_M4
|
2008-04-21 03:55:10 +00:00
|
|
|
DIST_FILES_ENGINEDATA+=m4.dat
|
|
|
|
endif
|
2008-05-06 03:00:26 +00:00
|
|
|
ifdef ENABLE_QUEEN
|
2008-01-06 14:08:53 +00:00
|
|
|
DIST_FILES_ENGINEDATA+=queen.tbl
|
|
|
|
endif
|
2008-05-06 03:00:26 +00:00
|
|
|
ifdef ENABLE_SKY
|
2008-01-06 14:08:53 +00:00
|
|
|
DIST_FILES_ENGINEDATA+=sky.cpt
|
|
|
|
endif
|
2009-09-05 08:24:36 +00:00
|
|
|
ifdef ENABLE_TEENAGENT
|
|
|
|
DIST_FILES_ENGINEDATA+=teenagent.dat
|
|
|
|
endif
|
2010-10-10 11:40:16 +00:00
|
|
|
ifdef ENABLE_TOON
|
|
|
|
DIST_FILES_ENGINEDATA+=toon.dat
|
|
|
|
endif
|
2008-01-06 14:13:40 +00:00
|
|
|
DIST_FILES_ENGINEDATA:=$(addprefix $(srcdir)/dists/engine-data/,$(DIST_FILES_ENGINEDATA))
|
2008-01-06 14:08:53 +00:00
|
|
|
|
2009-06-18 19:39:12 +00:00
|
|
|
# pred.dic is currently only used for the AGI engine
|
|
|
|
ifdef ENABLE_AGI
|
|
|
|
DIST_FILES_ENGINEDATA+=$(srcdir)/dists/pred.dic
|
|
|
|
endif
|
|
|
|
|
2007-12-16 21:41:10 +00:00
|
|
|
.PHONY: all clean distclean plugins dist-src
|