scummvm/Makefile.common
Pawel Kolodziejski 66cfc0cfaa added mac os x bundle build support based on patch #1995510,
modified copyright strings in plist and rc files
2008-06-16 21:46:32 +00:00

157 lines
4.7 KiB
Makefile

# This file is used by Makefile and declares common build rules,
# a list of common object files etc.
#
# $URL$
# $Id$
######################################################################
# The default build target: just build the residual executable
######################################################################
all: $(EXECUTABLE)
######################################################################
# Module settings
######################################################################
MODULES := tools $(MODULES)
# After the game specific modules follow the shared modules
MODULES += \
engine \
engine/backend \
engine/imuse \
engine/lua \
engine/smush \
engine/tinygl \
common \
mixer
######################################################################
# 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 $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
# Depdir information
DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
DEPFILES =
# Make engine/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
# the build date in gResidualBuildDate is correct.
engine/version.o: $(filter-out engine/libengine.a,$(OBJS))
# The build rule for the Residual executable
$(EXECUTABLE): $(OBJS)
$(CXX) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) -o $@
distclean: clean
$(RM) config.h config.mk config.log
clean:
$(RM_REC) $(DEPDIRS)
$(RM) $(OBJS) $(EXECUTABLE)
ifndef HAVE_GCC3
# If you use GCC, disable the above and enable this for intelligent
# dependency tracking.
%.o: %.cpp
$(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.
%.o: %.cpp
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
%.o: %.m
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o
endif
# Include the dependency tracking files.
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
######################################################################
# Create the files that depend on the version
######################################################################
VERSION_FILES = \
$(srcdir)/dists/macosx/Info.plist
#$(srcdir)/dists/iphone/Info.plist
VERSION = $(shell cat "${srcdir}/engine/internal_version.h" | cut -d\" -f2)
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-)
$(VERSION_FILES): %: %.in
@echo "Creating $@"
@cat $< | sed \
-e "s/@VER_MAJOR@/$(VER_MAJOR)/g" \
-e "s/@VER_MINOR@/$(VER_MINOR)/g" \
-e "s/@VER_PATCH@/$(VER_PATCH)/g" \
-e "s/@VER_EXTRA@/$(VER_EXTRA)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> $@
######################################################################
# Distribution settings
######################################################################
ifeq ($(VER_EXTRA),svn)
DISTVERSION = $(shell date '+%Y-%m-%d')
else
DISTVERSION = $(VERSION)
endif
DISTNAME := residual-$(DISTVERSION)
DISTDIR := dist
VERFILE := $(DISTDIR)/$(DISTNAME)/engine/internal_version.h
ifeq ($(shell svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
SVNROOT := $(srcdir)
else
SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/residual/trunk/
endif
$(VERFILE): $(srcdir)/engine/internal_version.h
@$(RM_REC) $(DISTDIR)
@$(MKDIR) $(DISTDIR)
svn export $(SVNROOT) $(DISTDIR)/$(DISTNAME)
$(DISTDIR)/$(DISTNAME).tar.gz:
cd $(DISTDIR); tar zcf $(DISTNAME).tar.gz $(DISTNAME)
$(DISTDIR)/$(DISTNAME).tar.bz2:
cd $(DISTDIR); tar jcf $(DISTNAME).tar.bz2 $(DISTNAME)
$(DISTDIR)/$(DISTNAME).zip:
cd $(DISTDIR); zip -qr9 $(DISTNAME).zip $(DISTNAME)
dist-src: \
$(DISTDIR)/$(DISTNAME).tar.gz \
$(DISTDIR)/$(DISTNAME).tar.bz2 \
$(DISTDIR)/$(DISTNAME).zip
@#RPM-src?
@#DEB-src?
.PHONY: all clean distclean dist-src