2002-04-26 13:39:31 +00:00
|
|
|
# $Header$
|
2002-11-21 04:08:37 +00:00
|
|
|
# This file is used by Makefile and Makefile.mingw and declares common build rules,
|
|
|
|
# a list of common object files etc.
|
2002-04-26 13:39:31 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
######################################################################
|
2002-11-21 04:08:37 +00:00
|
|
|
# The defaul build target: just build the scummvm executable
|
2003-09-08 15:33:26 +00:00
|
|
|
######################################################################
|
2003-09-28 10:44:31 +00:00
|
|
|
all: $(EXECUTABLE) plugins
|
2002-11-21 04:08:37 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Various minor settings
|
|
|
|
######################################################################
|
|
|
|
|
2002-11-21 04:08:37 +00:00
|
|
|
# Files that are to be included in the archive built by "make dist"
|
|
|
|
DISTFILES := \
|
|
|
|
Makefile Makefile.common Makefile.mingw \
|
|
|
|
NEWS README COPYING scummvm.6 Info.plist \
|
|
|
|
scumm.dsp scummvm.dsp scummvm.dsw scummvm.icns scummvm.ico \
|
2003-07-19 14:55:58 +00:00
|
|
|
scummvm.proj scummvm.rc scummvm.spec scummvm.xpm simon.dsp sky.dsp \
|
|
|
|
scummvm.vcproj scumm.vcproj simon.vcproj sky.vcproj scummvm.sln
|
2002-08-21 16:28:19 +00:00
|
|
|
|
2002-11-21 04:08:37 +00:00
|
|
|
# The dist file name
|
2002-04-26 13:39:31 +00:00
|
|
|
ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
|
|
|
|
|
2002-11-21 04:08:37 +00:00
|
|
|
# The name for the directory used for depenency tracking
|
|
|
|
DEPDIR := .deps
|
2002-04-26 13:39:31 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Plugin settings
|
|
|
|
######################################################################
|
|
|
|
|
2003-09-18 13:03:56 +00:00
|
|
|
# Whether to build plugins or now (TODO: should be set by configure script
|
|
|
|
#BUILD_PLUGINS := 1
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
# Plugin prefix. Typically "lib" on Unix, and nothing everywhere else
|
|
|
|
PLUGIN_PREFIX := lib
|
|
|
|
# Plugin suffix. For static/shared libs this is typically ".so"/".a" on Unix,
|
|
|
|
# ".dll"/".lib" on Windows, ".bundle"/".a" on OS X, etc.
|
2003-09-18 13:03:56 +00:00
|
|
|
PLUGIN_SUFFIX := .so
|
2003-09-08 15:33:26 +00:00
|
|
|
|
2003-09-18 13:03:56 +00:00
|
|
|
ifdef BUILD_PLUGINS
|
2003-09-19 21:23:23 +00:00
|
|
|
# TODO: The following stuff should be controlled by 'configure'
|
|
|
|
|
|
|
|
# Define DYNAMIC_MODULES during building
|
2003-09-18 18:23:53 +00:00
|
|
|
CXXFLAGS += -DDYNAMIC_MODULES
|
2003-09-19 21:23:23 +00:00
|
|
|
|
|
|
|
# Uncomment these for Mac OS X
|
2003-09-20 00:07:37 +00:00
|
|
|
#PLUGIN_LDFLAGS += -bundle -bundle_loader $(EXECUTABLE)
|
|
|
|
#PRE_OBJS_FLAGS := -all_load
|
|
|
|
#POST_OBJS_FLAGS :=
|
|
|
|
#LIBS += -ldl
|
2003-09-19 21:23:23 +00:00
|
|
|
|
|
|
|
# Uncomment these for Linux
|
2003-09-20 00:07:37 +00:00
|
|
|
CXXFLAGS += -fpic
|
|
|
|
PLUGIN_LDFLAGS += -shared
|
|
|
|
PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
|
|
|
|
POST_OBJS_FLAGS := -Wl,-no-whole-archive
|
|
|
|
LIBS += -ldl
|
2003-09-19 21:23:23 +00:00
|
|
|
|
2003-09-18 13:03:56 +00:00
|
|
|
endif
|
2003-09-08 15:33:26 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Module settings
|
|
|
|
######################################################################
|
2003-04-26 11:44:13 +00:00
|
|
|
|
2003-09-17 22:41:01 +00:00
|
|
|
MODULES := base $(MODULES)
|
|
|
|
|
2003-04-26 11:44:13 +00:00
|
|
|
ifdef DISABLE_SCUMM
|
|
|
|
DEFINES += -DDISABLE_SCUMM
|
|
|
|
else
|
2003-09-17 21:53:13 +00:00
|
|
|
MODULES += scumm
|
2003-04-26 11:44:13 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef DISABLE_SIMON
|
|
|
|
DEFINES += -DDISABLE_SIMON
|
|
|
|
else
|
|
|
|
MODULES += simon
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef DISABLE_SKY
|
|
|
|
DEFINES += -DDISABLE_SKY
|
|
|
|
else
|
2003-09-17 21:53:13 +00:00
|
|
|
MODULES += sky
|
2003-04-26 11:44:13 +00:00
|
|
|
endif
|
|
|
|
|
2003-07-30 20:01:26 +00:00
|
|
|
ifdef DISABLE_SWORD2
|
2003-07-30 19:25:31 +00:00
|
|
|
DEFINES += -DDISABLE_SWORD2
|
2003-07-28 01:50:45 +00:00
|
|
|
else
|
2003-09-17 21:53:13 +00:00
|
|
|
MODULES += bs2
|
2003-07-28 01:50:45 +00:00
|
|
|
endif
|
|
|
|
|
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 \
|
2003-09-08 17:48:34 +00:00
|
|
|
backends \
|
2003-09-08 22:38:21 +00:00
|
|
|
sound \
|
2003-09-08 17:48:34 +00:00
|
|
|
common
|
2002-07-06 13:05:42 +00:00
|
|
|
|
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
|
|
|
|
CPPFLAGS:= $(DEFINES) $(INCLUDES)
|
|
|
|
|
2002-11-21 04:08:37 +00:00
|
|
|
# Include the build instructions for all modules
|
2003-04-26 11:44:13 +00:00
|
|
|
-include $(addsuffix /module.mk,$(MODULES))
|
2002-08-21 16:07:07 +00:00
|
|
|
|
2003-09-19 21:23:23 +00:00
|
|
|
# Depdir information
|
|
|
|
DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULE_DIRS))
|
|
|
|
DEPFILES =
|
|
|
|
|
2003-09-17 22:41:01 +00:00
|
|
|
# Make main.o depend on all other object files. This way if anything is
|
|
|
|
# changed, it causes main.cpp to be recompiled. This in turn ensures that
|
2003-07-15 02:16:33 +00:00
|
|
|
# the build date in gScummVMBuildDate is correct.
|
2003-09-17 23:59:13 +00:00
|
|
|
base/main.o: $(filter-out base/libbase.a,$(OBJS))
|
2002-08-21 16:07:07 +00:00
|
|
|
|
2003-09-17 22:41:01 +00:00
|
|
|
# The build rule for the ScummVM executable
|
2003-09-18 13:03:56 +00:00
|
|
|
$(EXECUTABLE): $(OBJS)
|
2003-09-20 00:07:37 +00:00
|
|
|
$(CXX) $(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
|
|
|
|
$(RM_REC) $(DEPDIRS)
|
|
|
|
$(RM) build.rules config.h config.mak config.log
|
|
|
|
|
2002-07-06 13:05:42 +00:00
|
|
|
clean:
|
2003-09-18 13:03:56 +00:00
|
|
|
$(RM) $(OBJS) $(EXECUTABLE)
|
2002-07-06 13:05:42 +00:00
|
|
|
|
2003-09-28 10:53:28 +00:00
|
|
|
.PHONY: all clean dist distclean plugins
|
2002-07-06 13:05:42 +00:00
|
|
|
|
2003-09-08 15:33:26 +00:00
|
|
|
# Old (dumb) compile & dependcy rules
|
2002-11-21 04:08:37 +00:00
|
|
|
#INCS = scumm/scumm.h common/scummsys.h common/stdafx.h
|
2002-08-21 16:28:19 +00:00
|
|
|
#.cpp.o:
|
2002-12-09 13:38:01 +00:00
|
|
|
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
2002-08-21 16:28:19 +00:00
|
|
|
#$(OBJS): $(INCS)
|
2002-07-06 13:02:57 +00:00
|
|
|
|
2003-08-02 11:17:11 +00:00
|
|
|
ifndef HAVE_GCC3
|
|
|
|
# If you use GCC, disable the above and enable this for intelligent
|
|
|
|
# dependency tracking.
|
2002-11-21 20:36:33 +00:00
|
|
|
.cpp.o:
|
|
|
|
$(MKDIR) $(*D)/$(DEPDIR)
|
2002-12-09 13:38:01 +00:00
|
|
|
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
2002-11-21 20:36:33 +00:00
|
|
|
$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
|
|
|
|
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
|
|
|
|
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
|
2003-08-02 09:21:34 +00:00
|
|
|
else
|
2002-11-21 04:08:37 +00:00
|
|
|
# If you even have GCC 3.x, you can use this build rule, which is safer; the above
|
2003-07-31 18:41:05 +00:00
|
|
|
# rule can get you into a bad state if you Ctrl-C at the wrong moment.
|
|
|
|
# Also, with this GCC inserts additional dummy rules for the involved headers,
|
|
|
|
# which ensures a smooth compilation even if said headers become obsolete.
|
2003-08-02 11:17:59 +00:00
|
|
|
.cpp.o:
|
2003-08-02 09:21:34 +00:00
|
|
|
$(MKDIR) $(*D)/$(DEPDIR)
|
|
|
|
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
|
|
|
endif
|
2002-08-21 16:53:11 +00:00
|
|
|
|
2003-09-19 21:23:23 +00:00
|
|
|
# Include the dependency tracking files. We add /dev/null at the end
|
|
|
|
# of the list to avoid a warning/error if no .d file exist
|
|
|
|
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS))) /dev/null
|