1 # This file is used by Makefile and declares common build rules,
2 # a list of common object files etc.
7 ######################################################################
8 # The default build target: just build the scummvm executable
9 ######################################################################
11 all: $(EXECUTABLE) plugins
14 ######################################################################
16 ######################################################################
19 MODULES := test tools base $(MODULES)
21 -include $(srcdir)/engines/engines.mk
23 # After the game specific modules follow the shared modules
33 MODULES += sound/softsynth/mt32
37 DEFINES += -DDISABLE_SCALERS
40 ifdef DISABLE_HQ_SCALERS
41 DEFINES += -DDISABLE_HQ_SCALERS
45 ######################################################################
46 # The build rules follow - normally you should have no need to
47 # touch whatever comes after here.
48 ######################################################################
50 # Concat DEFINES and INCLUDES to form the CPPFLAGS
51 CPPFLAGS := $(DEFINES) $(INCLUDES)
53 # Include the build instructions for all modules
54 -include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
57 DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
60 # Make base/version.o depend on all other object files. This way if anything is
61 # changed, it causes version.cpp to be recompiled. This in turn ensures that
62 # the build date in gScummVMBuildDate is correct.
63 base/version.o: $(filter-out base/libbase.a,$(OBJS))
65 # The build rule for the ScummVM executable
66 $(EXECUTABLE): $(OBJS)
67 $(CXX) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
70 $(RM) config.h config.mk config.log
74 $(RM) $(OBJS) $(EXECUTABLE)
76 # Old (dumb) compile & dependcy rules
77 #INCS = scumm/scumm.h common/scummsys.h
79 # $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
83 # If you use GCC, disable the above and enable this for intelligent
84 # dependency tracking.
86 $(MKDIR) $(*D)/$(DEPDIR)
87 $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
88 $(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
89 $(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
90 $(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
92 # If you even have GCC 3.x, you can use this build rule, which is safer; the above
93 # rule can get you into a bad state if you Ctrl-C at the wrong moment.
94 # Also, with this GCC inserts additional dummy rules for the involved headers,
95 # which ensures a smooth compilation even if said headers become obsolete.
97 $(MKDIR) $(*D)/$(DEPDIR)
98 $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
100 $(MKDIR) $(*D)/$(DEPDIR)
101 $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o
106 $(NASM) -O1 $(NASMFLAGS) -g -o $*.o $(<)
109 # Include the dependency tracking files.
110 -include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
113 ######################################################################
114 # Get the current version information
115 ######################################################################
117 # AmigaOS4's grep has a problem with "./" in pathnames, so use cat.
118 VERSION = $(shell cat "${srcdir}/base/internal_version.h" | grep SCUMMVM_VERSION | cut -d\" -f2)
119 VER_MAJOR = $(shell echo $(VERSION) | cut -d. -f 1)
120 VER_MINOR = $(shell echo $(VERSION) | cut -d. -f 2)
121 VER_PATCH = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c1)
122 VER_EXTRA = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c2-)
125 ######################################################################
126 # Get Subversion's working copy information
127 ######################################################################
129 ifeq ($(shell LANG=C svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
131 ifeq ($(origin SVNREV), undefined)
132 # Get the working copy base revision
133 VER_SVNREV := $(shell LANG=C svn info $(SVNROOT) | grep "^Revision" | cut -d ' ' -f 2)
136 SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/
139 # Define the Subversion revision if available, either autodetected or
140 # specified by the user
141 ifneq ($(origin VER_SVNREV), undefined)
142 CXXFLAGS+= -DSCUMMVM_SVN_REVISION=\"$(VER_SVNREV)\"
146 ######################################################################
147 # Create the files that depend on the version
148 ######################################################################
151 $(srcdir)/dists/iphone/Info.plist \
152 $(srcdir)/dists/macosx/Info.plist
154 $(VERSION_FILES): %: %.in
157 -e "s/@VER_MAJOR@/$(VER_MAJOR)/g" \
158 -e "s/@VER_MINOR@/$(VER_MINOR)/g" \
159 -e "s/@VER_PATCH@/$(VER_PATCH)/g" \
160 -e "s/@VER_EXTRA@/$(VER_EXTRA)/g" \
161 -e "s/@VERSION@/$(VERSION)/g" \
165 ######################################################################
166 # Distribution settings
167 ######################################################################
169 ifeq ($(VER_EXTRA),svn)
170 ifeq ($(origin VER_SVNREV), undefined)
171 DISTVERSION = $(shell date '+%Y-%m-%d')
173 DISTVERSION = svn$(VER_SVNREV)
176 DISTVERSION = $(VERSION)
179 DISTNAME := scummvm-$(DISTVERSION)
181 VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
183 $(VERFILE): $(srcdir)/base/internal_version.h
184 @$(RM_REC) $(DISTDIR)
186 svn export $(SVNROOT) $(DISTDIR)/$(DISTNAME)
187 ifneq ($(origin VER_SVNREV), undefined)
188 @# Use the current SVN revision as a default for the snapshot sources
189 @svn cat $(SVNROOT)/base/internal_version.h | sed -e \
190 "s/^#define SCUMMVM_SVN_REVISION$$/#define SCUMMVM_SVN_REVISION \"$(VER_SVNREV)\"/g" \
194 $(DISTDIR)/$(DISTNAME).tar.gz: $(VERFILE)
195 cd $(DISTDIR); tar zcf $(DISTNAME).tar.gz $(DISTNAME)
197 $(DISTDIR)/$(DISTNAME).tar.bz2: $(VERFILE)
198 cd $(DISTDIR); tar jcf $(DISTNAME).tar.bz2 $(DISTNAME)
200 $(DISTDIR)/$(DISTNAME).zip: $(VERFILE)
201 cd $(DISTDIR); zip -qr9 $(DISTNAME).zip $(DISTNAME)
204 $(DISTDIR)/$(DISTNAME).tar.gz \
205 $(DISTDIR)/$(DISTNAME).tar.bz2 \
206 $(DISTDIR)/$(DISTNAME).zip
211 DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.LGPL COPYRIGHT NEWS README)
214 DIST_FILES_THEMES:=$(addprefix $(srcdir)/gui/themes/,scummmodern.zip)
217 DIST_FILES_ENGINEDATA=
218 ifdef ENABLE_DRASCULA
219 DIST_FILES_ENGINEDATA+=drascula.dat
222 DIST_FILES_ENGINEDATA+=igor.tbl
225 DIST_FILES_ENGINEDATA+=kyra.dat
228 DIST_FILES_ENGINEDATA+=lure.dat
231 DIST_FILES_ENGINEDATA+=m4.dat
234 DIST_FILES_ENGINEDATA+=queen.tbl
237 DIST_FILES_ENGINEDATA+=sky.cpt
239 DIST_FILES_ENGINEDATA:=$(addprefix $(srcdir)/dists/engine-data/,$(DIST_FILES_ENGINEDATA))
241 # pred.dic is currently only used for the AGI engine
243 DIST_FILES_ENGINEDATA+=$(srcdir)/dists/pred.dic
247 DIST_FILES_PLUGINS:=$(addprefix $(srcdir)/,$(PLUGINS))
249 .PHONY: all clean distclean plugins dist-src