Only set interface palette when painting backdrop. (This fixes movie palette.)
[scummvm-innocent.git] / Makefile.common
blob51261d65d978637f0e7158c0d05acb09a3f85175
1 # This file is used by Makefile and declares common build rules,
2 # a list of common object files etc.
4 # $URL$
5 # $Id$
7 ######################################################################
8 # The default build target: just build the scummvm executable
9 ######################################################################
11 all: $(EXECUTABLE) plugins
14 ######################################################################
15 # Module settings
16 ######################################################################
18 PLUGINS :=
19 MODULES := test tools base $(MODULES)
21 -include $(srcdir)/engines/engines.mk
23 # After the game specific modules follow the shared modules
24 MODULES += \
25         engines \
26         gui \
27         graphics \
28         sound \
29         backends \
30         common \
32 ifdef USE_MT32EMU
33 MODULES += sound/softsynth/mt32
34 endif
36 ifdef DISABLE_SCALERS
37 DEFINES += -DDISABLE_SCALERS
38 endif
40 ifdef DISABLE_HQ_SCALERS
41 DEFINES += -DDISABLE_HQ_SCALERS
42 endif
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)))
56 # Depdir information
57 DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
58 DEPFILES =
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 $@
69 distclean: clean
70         $(RM) config.h config.mk config.log
72 clean:
73         $(RM_REC) $(DEPDIRS)
74         $(RM) $(OBJS) $(EXECUTABLE)
76 # Old (dumb) compile & dependcy rules
77 #INCS   = scumm/scumm.h common/scummsys.h
78 #.cpp.o:
79 #       $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
80 #$(OBJS): $(INCS)
82 ifndef HAVE_GCC3
83 # If you use GCC, disable the above and enable this for intelligent
84 # dependency tracking.
85 %.o: %.cpp
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"
91 else
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.
96 %.o: %.cpp
97         $(MKDIR) $(*D)/$(DEPDIR)
98         $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
99 %.o: %.m
100         $(MKDIR) $(*D)/$(DEPDIR)
101         $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o
102 endif
104 ifdef HAVE_NASM
105 %.o: %.asm
106         $(NASM) -O1 $(NASMFLAGS) -g -o $*.o $(<)
107 endif
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"),)
130 SVNROOT := $(srcdir)
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)
134 endif
135 else
136 SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/
137 endif
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)\"
143 endif
146 ######################################################################
147 # Create the files that depend on the version
148 ######################################################################
150 VERSION_FILES = \
151         $(srcdir)/dists/iphone/Info.plist \
152         $(srcdir)/dists/macosx/Info.plist
154 $(VERSION_FILES): %: %.in
155         @echo "Creating $@"
156         @cat $< | sed \
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" \
162                 > $@
165 ######################################################################
166 # Distribution settings
167 ######################################################################
169 ifeq ($(VER_EXTRA),svn)
170 ifeq ($(origin VER_SVNREV), undefined)
171 DISTVERSION = $(shell date '+%Y-%m-%d')
172 else
173 DISTVERSION = svn$(VER_SVNREV)
174 endif
175 else
176 DISTVERSION = $(VERSION)
177 endif
179 DISTNAME := scummvm-$(DISTVERSION)
180 DISTDIR := dist
181 VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
183 $(VERFILE): $(srcdir)/base/internal_version.h
184         @$(RM_REC) $(DISTDIR)
185         @$(MKDIR) $(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" \
191                 > $(VERFILE)
192 endif
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)
203 dist-src: \
204         $(DISTDIR)/$(DISTNAME).tar.gz \
205         $(DISTDIR)/$(DISTNAME).tar.bz2 \
206         $(DISTDIR)/$(DISTNAME).zip
207         @#RPM-src?
208         @#DEB-src?
210 # Common files
211 DIST_FILES_DOCS:=$(addprefix $(srcdir)/,AUTHORS COPYING COPYING.LGPL COPYRIGHT NEWS README)
213 # Themes files
214 DIST_FILES_THEMES:=$(addprefix $(srcdir)/gui/themes/,scummmodern.zip)
216 # Engine data files
217 DIST_FILES_ENGINEDATA=
218 ifdef ENABLE_DRASCULA
219 DIST_FILES_ENGINEDATA+=drascula.dat
220 endif
221 ifdef ENABLE_IGOR
222 DIST_FILES_ENGINEDATA+=igor.tbl
223 endif
224 ifdef ENABLE_KYRA
225 DIST_FILES_ENGINEDATA+=kyra.dat
226 endif
227 ifdef ENABLE_LURE
228 DIST_FILES_ENGINEDATA+=lure.dat
229 endif
230 ifdef ENABLE_M4
231 DIST_FILES_ENGINEDATA+=m4.dat
232 endif
233 ifdef ENABLE_QUEEN
234 DIST_FILES_ENGINEDATA+=queen.tbl
235 endif
236 ifdef ENABLE_SKY
237 DIST_FILES_ENGINEDATA+=sky.cpt
238 endif
239 DIST_FILES_ENGINEDATA:=$(addprefix $(srcdir)/dists/engine-data/,$(DIST_FILES_ENGINEDATA))
241 # pred.dic is currently only used for the AGI engine
242 ifdef ENABLE_AGI
243 DIST_FILES_ENGINEDATA+=$(srcdir)/dists/pred.dic
244 endif
246 # Plugin files
247 DIST_FILES_PLUGINS:=$(addprefix $(srcdir)/,$(PLUGINS))
249 .PHONY: all clean distclean plugins dist-src