mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
52261c0bef
svn-id: r39811
243 lines
6.9 KiB
Makefile
243 lines
6.9 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 scummvm executable
|
|
######################################################################
|
|
|
|
all: $(EXECUTABLE) plugins
|
|
|
|
|
|
######################################################################
|
|
# Module settings
|
|
######################################################################
|
|
|
|
PLUGINS :=
|
|
MODULES := test tools base $(MODULES)
|
|
|
|
-include $(srcdir)/engines/engines.mk
|
|
|
|
# After the game specific modules follow the shared modules
|
|
MODULES += \
|
|
engines \
|
|
gui \
|
|
graphics \
|
|
sound \
|
|
backends \
|
|
common \
|
|
|
|
ifdef USE_MT32EMU
|
|
MODULES += sound/softsynth/mt32
|
|
endif
|
|
|
|
ifdef DISABLE_SCALERS
|
|
DEFINES += -DDISABLE_SCALERS
|
|
endif
|
|
|
|
ifdef DISABLE_HQ_SCALERS
|
|
DEFINES += -DDISABLE_HQ_SCALERS
|
|
endif
|
|
|
|
|
|
######################################################################
|
|
# 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 base/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 gScummVMBuildDate is correct.
|
|
base/version.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) config.h config.mk config.log
|
|
|
|
clean:
|
|
$(RM_REC) $(DEPDIRS)
|
|
$(RM) $(OBJS) $(EXECUTABLE)
|
|
|
|
# Old (dumb) compile & dependcy rules
|
|
#INCS = scumm/scumm.h common/scummsys.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.
|
|
%.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
|
|
|
|
ifdef HAVE_NASM
|
|
%.o: %.asm
|
|
$(NASM) -O1 $(NASMFLAGS) -g -o $*.o $(<)
|
|
endif
|
|
|
|
# Include the dependency tracking files.
|
|
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
|
|
|
|
|
|
######################################################################
|
|
# Get the current version information
|
|
######################################################################
|
|
|
|
# AmigaOS4's grep has a problem with "./" in pathnames, so use cat.
|
|
VERSION = $(shell cat "${srcdir}/base/internal_version.h" | grep SCUMMVM_VERSION | 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-)
|
|
|
|
|
|
######################################################################
|
|
# Get Subversion's working copy information
|
|
######################################################################
|
|
|
|
ifeq ($(shell LANG=C svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
|
|
SVNROOT := $(srcdir)
|
|
ifeq ($(origin SVNREV), undefined)
|
|
# Get the working copy base revision
|
|
VER_SVNREV := $(shell LANG=C svn info $(SVNROOT) | grep "^Revision" | cut -d ' ' -f 2)
|
|
endif
|
|
else
|
|
SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/
|
|
endif
|
|
|
|
# Define the Subversion revision if available, either autodetected or
|
|
# specified by the user
|
|
ifneq ($(origin VER_SVNREV), undefined)
|
|
CXXFLAGS+= -DSCUMMVM_SVN_REVISION=\"$(VER_SVNREV)\"
|
|
endif
|
|
|
|
|
|
######################################################################
|
|
# Create the files that depend on the version
|
|
######################################################################
|
|
|
|
VERSION_FILES = \
|
|
$(srcdir)/dists/iphone/Info.plist \
|
|
$(srcdir)/dists/macosx/Info.plist
|
|
|
|
$(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)
|
|
ifeq ($(origin VER_SVNREV), undefined)
|
|
DISTVERSION = $(shell date '+%Y-%m-%d')
|
|
else
|
|
DISTVERSION = svn$(VER_SVNREV)
|
|
endif
|
|
else
|
|
DISTVERSION = $(VERSION)
|
|
endif
|
|
|
|
DISTNAME := scummvm-$(DISTVERSION)
|
|
DISTDIR := dist
|
|
VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
|
|
|
|
$(VERFILE): $(srcdir)/base/internal_version.h
|
|
@$(RM_REC) $(DISTDIR)
|
|
@$(MKDIR) $(DISTDIR)
|
|
svn export $(SVNROOT) $(DISTDIR)/$(DISTNAME)
|
|
ifneq ($(origin VER_SVNREV), undefined)
|
|
@# Use the current SVN revision as a default for the snapshot sources
|
|
@svn cat $(SVNROOT)/base/internal_version.h | sed -e \
|
|
"s/^#define SCUMMVM_SVN_REVISION$$/#define SCUMMVM_SVN_REVISION \"$(VER_SVNREV)\"/g" \
|
|
> $(VERFILE)
|
|
endif
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.gz: $(VERFILE)
|
|
cd $(DISTDIR); tar zcf $(DISTNAME).tar.gz $(DISTNAME)
|
|
|
|
$(DISTDIR)/$(DISTNAME).tar.bz2: $(VERFILE)
|
|
cd $(DISTDIR); tar jcf $(DISTNAME).tar.bz2 $(DISTNAME)
|
|
|
|
$(DISTDIR)/$(DISTNAME).zip: $(VERFILE)
|
|
cd $(DISTDIR); zip -qr9 $(DISTNAME).zip $(DISTNAME)
|
|
|
|
dist-src: \
|
|
$(DISTDIR)/$(DISTNAME).tar.gz \
|
|
$(DISTDIR)/$(DISTNAME).tar.bz2 \
|
|
$(DISTDIR)/$(DISTNAME).zip
|
|
@#RPM-src?
|
|
@#DEB-src?
|
|
|
|
|
|
# Themes files
|
|
DIST_FILES_THEMES:=$(addprefix $(srcdir)/gui/themes/,scummmodern.zip)
|
|
|
|
# Engine data files
|
|
DIST_FILES_ENGINEDATA=
|
|
ifdef ENABLE_DRASCULA
|
|
DIST_FILES_ENGINEDATA+=drascula.dat
|
|
endif
|
|
ifdef ENABLE_IGOR
|
|
DIST_FILES_ENGINEDATA+=igor.tbl
|
|
endif
|
|
ifdef ENABLE_KYRA
|
|
DIST_FILES_ENGINEDATA+=kyra.dat
|
|
endif
|
|
ifdef ENABLE_LURE
|
|
DIST_FILES_ENGINEDATA+=lure.dat
|
|
endif
|
|
ifdef ENABLE_M4
|
|
DIST_FILES_ENGINEDATA+=m4.dat
|
|
endif
|
|
ifdef ENABLE_QUEEN
|
|
DIST_FILES_ENGINEDATA+=queen.tbl
|
|
endif
|
|
ifdef ENABLE_SKY
|
|
DIST_FILES_ENGINEDATA+=sky.cpt
|
|
endif
|
|
DIST_FILES_ENGINEDATA:=$(addprefix $(srcdir)/dists/engine-data/,$(DIST_FILES_ENGINEDATA))
|
|
|
|
# Plugin files
|
|
DIST_FILES_PLUGINS:=$(addprefix $(srcdir)/,$(PLUGINS))
|
|
|
|
.PHONY: all clean distclean plugins dist-src
|