From da76ac5890ee662cb8026ea07a0566c61889df4a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 30 Jan 2004 21:54:28 +0000 Subject: Various changes to the build system which allow building ScummVM in an external directory (and as such, allow you to have a debug, a profiling, and a release build from the same set of source files in parallel). Work in progress svn-id: r12680 --- Makefile | 13 ++++++++----- Makefile.common | 4 ++-- backends/module.mk | 2 +- base/module.mk | 2 +- common/module.mk | 2 +- gui/module.mk | 2 +- queen/module.mk | 2 +- scumm/module.mk | 2 +- simon/module.mk | 2 +- sky/module.mk | 2 +- sound/module.mk | 2 +- sword1/module.mk | 2 +- sword2/module.mk | 2 +- 13 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 8916b44038..926d73ca92 100644 --- a/Makefile +++ b/Makefile @@ -15,19 +15,22 @@ CP := cp # Default compilation parameters. Normally don't edit these # ####################################################################### +srcdir ?= . +builddir ?= . + DEFINES := -DHAVE_CONFIG_H LDFLAGS := -INCLUDES := -I. -Icommon +INCLUDES := -I$(srcdir) -I$(srcdir)/common LIBS := OBJS := MODULES := MODULE_DIRS := -EXECUTABLE := scummvm$(EXEEXT) +EXECUTABLE := scummvm$(EXEEXT) # Load the make rules generated by configure -include config.mak +include $(builddir)/config.mak # Uncomment this for stricter compile time code verification # CXXFLAGS+= -Werror @@ -44,10 +47,10 @@ CXXFLAGS+= -Wno-reorder -Wwrite-strings -fcheck-new -Wctor-dtor-privacy # Misc stuff - you should normally never have to edit this # ####################################################################### -include Makefile.common +include $(srcdir)/Makefile.common # check if configure has been run or has been changed since last run -config.mak: configure +$(builddir)/config.mak: $(srcdir)/configure @echo "You need to run ./configure before you can run make" @echo "Either you haven't run it before or it has changed." @echo "If you cannot run configure, use 'make -f Makefile.noconf'" diff --git a/Makefile.common b/Makefile.common index c2447197ac..12e3ea0e26 100644 --- a/Makefile.common +++ b/Makefile.common @@ -120,7 +120,7 @@ MODULES += \ CPPFLAGS:= $(DEFINES) $(INCLUDES) # Include the build instructions for all modules --include $(addsuffix /module.mk,$(MODULES)) +-include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES))) # Depdir information DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULE_DIRS)) @@ -171,4 +171,4 @@ 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 +-include $(wildcard $(addprefix $(srcdir)/, $(addsuffix /*.d,$(DEPDIRS)))) /dev/null diff --git a/backends/module.mk b/backends/module.mk index 80030f0781..45a9206323 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -22,4 +22,4 @@ MODULE_DIRS += \ backends/midi # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/base/module.mk b/base/module.mk index d2c567e82b..9aad4e6bb0 100644 --- a/base/module.mk +++ b/base/module.mk @@ -17,4 +17,4 @@ MODULE_DIRS += \ #base/gameDetector.o base/plugins.o: config.mak # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/common/module.mk b/common/module.mk index e67de1f56e..694128f8f6 100644 --- a/common/module.mk +++ b/common/module.mk @@ -20,4 +20,4 @@ MODULE_DIRS += \ common/scaler # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/gui/module.mk b/gui/module.mk index dc7e5a597a..018c0fd651 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -22,4 +22,4 @@ MODULE_DIRS += \ gui # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/queen/module.mk b/queen/module.mk index eaa678e5bf..4f52ba4e35 100644 --- a/queen/module.mk +++ b/queen/module.mk @@ -31,4 +31,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/scumm/module.mk b/scumm/module.mk index da5d148120..fd62437a64 100644 --- a/scumm/module.mk +++ b/scumm/module.mk @@ -76,4 +76,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/simon/module.mk b/simon/module.mk index c3724794d0..9b3677995f 100644 --- a/simon/module.mk +++ b/simon/module.mk @@ -22,4 +22,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/sky/module.mk b/sky/module.mk index 55be926baf..2370eb404b 100644 --- a/sky/module.mk +++ b/sky/module.mk @@ -35,4 +35,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/sound/module.mk b/sound/module.mk index 859a8b9975..61bf20f658 100644 --- a/sound/module.mk +++ b/sound/module.mk @@ -20,4 +20,4 @@ MODULE_DIRS += \ sound # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/sword1/module.mk b/sword1/module.mk index 686ed9008f..1c2d01580e 100644 --- a/sword1/module.mk +++ b/sword1/module.mk @@ -28,4 +28,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules diff --git a/sword2/module.mk b/sword2/module.mk index e552165c23..784f541fcc 100644 --- a/sword2/module.mk +++ b/sword2/module.mk @@ -48,4 +48,4 @@ PLUGIN := 1 endif # Include common rules -include common.rules +include $(srcdir)/common.rules -- cgit v1.2.3