scummvm/Makefile.common
Max Horn 48da9f38de add plugins to .PHONY list
svn-id: r10458
2003-09-28 10:53:28 +00:00

163 lines
4.8 KiB
Makefile

# $Header$
# This file is used by Makefile and Makefile.mingw and declares common build rules,
# a list of common object files etc.
######################################################################
# The defaul build target: just build the scummvm executable
######################################################################
all: $(EXECUTABLE) plugins
######################################################################
# Various minor settings
######################################################################
# 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 \
scummvm.proj scummvm.rc scummvm.spec scummvm.xpm simon.dsp sky.dsp \
scummvm.vcproj scumm.vcproj simon.vcproj sky.vcproj scummvm.sln
# The dist file name
ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
# The name for the directory used for depenency tracking
DEPDIR := .deps
######################################################################
# Plugin settings
######################################################################
# Whether to build plugins or now (TODO: should be set by configure script
#BUILD_PLUGINS := 1
# 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.
PLUGIN_SUFFIX := .so
ifdef BUILD_PLUGINS
# TODO: The following stuff should be controlled by 'configure'
# Define DYNAMIC_MODULES during building
CXXFLAGS += -DDYNAMIC_MODULES
# Uncomment these for Mac OS X
#PLUGIN_LDFLAGS += -bundle -bundle_loader $(EXECUTABLE)
#PRE_OBJS_FLAGS := -all_load
#POST_OBJS_FLAGS :=
#LIBS += -ldl
# Uncomment these for Linux
CXXFLAGS += -fpic
PLUGIN_LDFLAGS += -shared
PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
POST_OBJS_FLAGS := -Wl,-no-whole-archive
LIBS += -ldl
endif
######################################################################
# Module settings
######################################################################
MODULES := base $(MODULES)
ifdef DISABLE_SCUMM
DEFINES += -DDISABLE_SCUMM
else
MODULES += scumm
endif
ifdef DISABLE_SIMON
DEFINES += -DDISABLE_SIMON
else
MODULES += simon
endif
ifdef DISABLE_SKY
DEFINES += -DDISABLE_SKY
else
MODULES += sky
endif
ifdef DISABLE_SWORD2
DEFINES += -DDISABLE_SWORD2
else
MODULES += bs2
endif
# After the game specific modules follow the shared modules
MODULES += \
gui \
backends \
sound \
common
######################################################################
# The build rules follow - normally you should have no need to
# touch whatever comes after here.
######################################################################
# Concat DEFINES and INCLUDES to form the CPPFLAGS
CPPFLAGS:= $(DEFINES) $(INCLUDES)
# Include the build instructions for all modules
-include $(addsuffix /module.mk,$(MODULES))
# Depdir information
DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULE_DIRS))
DEPFILES =
# 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
# the build date in gScummVMBuildDate is correct.
base/main.o: $(filter-out base/libbase.a,$(OBJS))
# The build rule for the ScummVM executable
$(EXECUTABLE): $(OBJS)
$(CXX) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
distclean: clean
$(RM_REC) $(DEPDIRS)
$(RM) build.rules config.h config.mak config.log
clean:
$(RM) $(OBJS) $(EXECUTABLE)
.PHONY: all clean dist distclean plugins
# Old (dumb) compile & dependcy rules
#INCS = scumm/scumm.h common/scummsys.h common/stdafx.h
#.cpp.o:
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
#$(OBJS): $(INCS)
ifndef HAVE_GCC3
# If you use GCC, disable the above and enable this for intelligent
# dependency tracking.
.cpp.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
else
# If you even have GCC 3.x, you can use this build rule, which is safer; the above
# 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.
.cpp.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
endif
# 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