aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-11-21 04:08:37 +0000
committerMax Horn2002-11-21 04:08:37 +0000
commit69bceafc6e1a810f8f66b81bf76e2c2c6fb16fe0 (patch)
tree4e99988488f6ff40ac5b3745f8203d53ff7adc4c
parentc5c1091613249d30259ca0746d9d64160487348f (diff)
downloadscummvm-rg350-69bceafc6e1a810f8f66b81bf76e2c2c6fb16fe0.tar.gz
scummvm-rg350-69bceafc6e1a810f8f66b81bf76e2c2c6fb16fe0.tar.bz2
scummvm-rg350-69bceafc6e1a810f8f66b81bf76e2c2c6fb16fe0.zip
revamped build system somewhat: 'modules' like scumm, simon, gui etc. now all build into a lib, and all have a module.mk file that lists all their file. Advantage: further modularizes the build system, seperating all parts of ScummVM
svn-id: r5653
-rw-r--r--Makefile.common135
-rw-r--r--backends/module.mk9
-rw-r--r--common.rules24
-rw-r--r--common/module.mk15
-rw-r--r--gui/module.mk14
-rw-r--r--scumm/module.mk47
-rw-r--r--simon/module.mk13
-rw-r--r--sound/module.mk9
8 files changed, 165 insertions, 101 deletions
diff --git a/Makefile.common b/Makefile.common
index b39b5aad62..a4748bfd0c 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,117 +1,45 @@
# $Header$
-# This file is used by Makefile, Makefile.irix, Makefile.macosx and declares
-# common rules, a list of common object files etc.
+# This file is used by Makefile and Makefile.mingw and declares common build rules,
+# a list of common object files etc.
-# List of all sub modules
-MODULES += backends/fs/posix common gui scumm simon sound scumm/smush
+# The defaul build target: just build the scummvm executable
+all: scummvm$(EXEEXT)
+
+# 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
+# The dist file name
ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip
-INCS = scumm/scumm.h common/scummsys.h common/stdafx.h
-
-BACKEND_OBJS = \
- backends/fs/posix/posix-fs.o \
- backends/fs/morphos/abox-fs.o \
- backends/fs/windows/windows-fs.o
-
-COMMON_OBJS = \
- common/config-file.o \
- common/engine.o \
- common/file.o \
- common/gameDetector.o \
- common/main.o \
- common/scaler.o \
- common/str.o \
- common/timer.o \
- common/util.o
-
-GUI_OBJS = \
- gui/browser.o \
- gui/dialog.o \
- gui/launcher.o \
- gui/ListWidget.o \
- gui/message.o \
- gui/newgui.o \
- gui/ScrollBarWidget.o \
- gui/widget.o \
-
-SCUMM_OBJS = \
- scumm/actor.o \
- scumm/akos.o \
- scumm/boxes.o \
- scumm/bundle.o \
- scumm/costume.o \
- scumm/debug.o \
- scumm/debugrl.o \
- scumm/dialogs.o \
- scumm/gfx.o \
- scumm/imuse.o \
- scumm/object.o \
- scumm/resource.o \
- scumm/resource_v2.o \
- scumm/resource_v3.o \
- scumm/resource_v4.o \
- scumm/saveload.o \
- scumm/script.o \
- scumm/script_v1.o \
- scumm/script_v2.o \
- scumm/scummvm.o \
- scumm/sound.o \
- scumm/string.o \
- scumm/vars.o \
- scumm/verbs.o \
-
-SIMON_OBJS = \
- simon/debug.o \
- simon/items.o \
- simon/midi.o \
- simon/res.o \
- simon/simon.o \
- simon/verb.o \
- simon/vga.o
-
-SMUSH_OBJS = \
- scumm/smush/blitter.o \
- scumm/smush/brenderer.o \
- scumm/smush/chunk.o \
- scumm/smush/codec1.o \
- scumm/smush/codec37.o \
- scumm/smush/codec44.o \
- scumm/smush/codec47.o \
- scumm/smush/color.o \
- scumm/smush/frenderer.o \
- scumm/smush/imuse_channel.o \
- scumm/smush/player.o \
- scumm/smush/saud_channel.o \
- scumm/smush/scumm_renderer.o
-
-SOUND_OBJS = sound/fmopl.o sound/mididrv.o sound/mixer.o
-
-OBJS += $(BACKEND_OBJS) $(COMMON_OBJS) $(GUI_OBJS) scumm/libscumm.a simon/libsimon.a $(SOUND_OBJS)
-
-DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
- debugrl.h NEWS README COPYING \
- scummvm.dsp scummvm.dsw sound/fmopl.h gui.h sound.h
+# The name for the directory used for depenency tracking
+DEPDIR := .deps
-all: scummvm$(EXEEXT)
+# List of all sub modules.
+# TODO - the nested ones (scumm/smus, backends/...) should be handled from the
+# module.mk of their parents. In fact the only reason they are listed here is to ensure the
+# DEPDIRS directive works correctly.
+MODULES += \
+ backends common gui scumm simon sound \
+ scumm/smush backends/fs/posix backends/fs/morphos backends/fs/windows
-scummvm$(EXEEXT): $(OBJS)
- $(CXX) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
+# Include the build instructions for all modules
+-include $(patsubst %,%/module.mk,$(MODULES))
-scumm/libscumm.a: $(SCUMM_OBJS) $(SMUSH_OBJS)
- $(AR) $@ $+
- $(RANLIB) $@
-simon/libsimon.a: $(SIMON_OBJS)
- $(AR) $@ $+
- $(RANLIB) $@
+scummvm$(EXEEXT): $(OBJS)
+ $(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
clean:
- $(RM) $(OBJS) $(SCUMM_OBJS) $(SIMON_OBJS) $(SMUSH_OBJS) scummvm$(EXEEXT)
+ $(RM) scummvm$(EXEEXT)
.PHONY: all clean dist distclean
# Default (dumb) compile & dependcy rules
+#INCS = scumm/scumm.h common/scummsys.h common/stdafx.h
#.cpp.o:
# $(CXX) $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
#$(OBJS): $(INCS)
@@ -119,9 +47,8 @@ clean:
# If you use GCC, disable the above and enable this for intelligent
# dependency tracking.
-DEPDIR := .deps
DEPDIRS = $(patsubst %,%/$(DEPDIR),$(MODULES))
-DEPFILES = $(wildcard $(patsubst %,%/$(DEPDIR)/*.d,$(MODULES)))
+DEPFILES = $(wildcard $(patsubst %,%/*.d,$(DEPDIRS)))
.cpp.o:
$(MKDIR) $(*D)/$(DEPDIR)
@@ -130,6 +57,12 @@ DEPFILES = $(wildcard $(patsubst %,%/$(DEPDIR)/*.d,$(MODULES)))
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
+# 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 it in the wrong moment.
+#.cpp.o:
+# $(MKDIR) $(*D)/$(DEPDIR)
+# $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+
-include $(DEPFILES) /dev/null
distclean: clean
diff --git a/backends/module.mk b/backends/module.mk
new file mode 100644
index 0000000000..251bf98669
--- /dev/null
+++ b/backends/module.mk
@@ -0,0 +1,9 @@
+MODULE := backends
+
+MODULE_OBJS = \
+ backends/fs/posix/posix-fs.o \
+ backends/fs/morphos/abox-fs.o \
+ backends/fs/windows/windows-fs.o
+
+# Include common rules
+include common.rules
diff --git a/common.rules b/common.rules
new file mode 100644
index 0000000000..71c785fd25
--- /dev/null
+++ b/common.rules
@@ -0,0 +1,24 @@
+# Common build rules, used by the sub modules and their module.mk files
+
+# Convenience library target
+$(MODULE)/lib$(MODULE).a: $(MODULE_OBJS)
+ $(AR) $@ $+
+ $(RANLIB) $@
+
+# Clean target, removes all object files. This looks a bit hackish, as we have to
+# copy the content of MODULE_OBJS to another unique variable (the next module.mk
+# will overwrite it after all). The same for the libMODULE.a library file.
+MODULE_OBJS-$(MODULE) := $(MODULE_OBJS)
+MODULE_LIB-$(MODULE) := $(MODULE)/lib$(MODULE).a
+clean: clean-$(MODULE)
+clean-$(MODULE): clean-% :
+ -$(RM) $(MODULE_OBJS-$*) $(MODULE_LIB-$*)
+
+
+# Pseudo target for comfort, allows for "make common", "make gui" etc.
+$(MODULE): $(MODULE_OBJS)
+
+# Add convenience library to main OBJS list
+OBJS += $(MODULE)/lib$(MODULE).a
+
+.PHONY: clean-$(MODULE) $(MODULE)
diff --git a/common/module.mk b/common/module.mk
new file mode 100644
index 0000000000..400889c24c
--- /dev/null
+++ b/common/module.mk
@@ -0,0 +1,15 @@
+MODULE := common
+
+MODULE_OBJS = \
+ common/config-file.o \
+ common/engine.o \
+ common/file.o \
+ common/gameDetector.o \
+ common/main.o \
+ common/scaler.o \
+ common/str.o \
+ common/timer.o \
+ common/util.o
+
+# Include common rules
+include common.rules
diff --git a/gui/module.mk b/gui/module.mk
new file mode 100644
index 0000000000..ec96344ebf
--- /dev/null
+++ b/gui/module.mk
@@ -0,0 +1,14 @@
+MODULE := gui
+
+MODULE_OBJS = \
+ gui/browser.o \
+ gui/dialog.o \
+ gui/launcher.o \
+ gui/ListWidget.o \
+ gui/message.o \
+ gui/newgui.o \
+ gui/ScrollBarWidget.o \
+ gui/widget.o \
+
+# Include common rules
+include common.rules
diff --git a/scumm/module.mk b/scumm/module.mk
new file mode 100644
index 0000000000..01aded7e40
--- /dev/null
+++ b/scumm/module.mk
@@ -0,0 +1,47 @@
+MODULE := scumm
+
+SCUMM_OBJS = \
+ scumm/actor.o \
+ scumm/akos.o \
+ scumm/boxes.o \
+ scumm/bundle.o \
+ scumm/costume.o \
+ scumm/debug.o \
+ scumm/debugrl.o \
+ scumm/dialogs.o \
+ scumm/gfx.o \
+ scumm/imuse.o \
+ scumm/object.o \
+ scumm/resource.o \
+ scumm/resource_v2.o \
+ scumm/resource_v3.o \
+ scumm/resource_v4.o \
+ scumm/saveload.o \
+ scumm/script.o \
+ scumm/script_v1.o \
+ scumm/script_v2.o \
+ scumm/scummvm.o \
+ scumm/sound.o \
+ scumm/string.o \
+ scumm/vars.o \
+ scumm/verbs.o \
+
+SMUSH_OBJS = \
+ scumm/smush/blitter.o \
+ scumm/smush/brenderer.o \
+ scumm/smush/chunk.o \
+ scumm/smush/codec1.o \
+ scumm/smush/codec37.o \
+ scumm/smush/codec44.o \
+ scumm/smush/codec47.o \
+ scumm/smush/color.o \
+ scumm/smush/frenderer.o \
+ scumm/smush/imuse_channel.o \
+ scumm/smush/player.o \
+ scumm/smush/saud_channel.o \
+ scumm/smush/scumm_renderer.o
+
+MODULE_OBJS = $(SCUMM_OBJS) $(SMUSH_OBJS)
+
+# Include common rules
+include common.rules
diff --git a/simon/module.mk b/simon/module.mk
new file mode 100644
index 0000000000..d9eb461a7d
--- /dev/null
+++ b/simon/module.mk
@@ -0,0 +1,13 @@
+MODULE := simon
+
+MODULE_OBJS = \
+ simon/debug.o \
+ simon/items.o \
+ simon/midi.o \
+ simon/res.o \
+ simon/simon.o \
+ simon/verb.o \
+ simon/vga.o
+
+# Include common rules
+include common.rules
diff --git a/sound/module.mk b/sound/module.mk
new file mode 100644
index 0000000000..8c85db7b78
--- /dev/null
+++ b/sound/module.mk
@@ -0,0 +1,9 @@
+MODULE := sound
+
+MODULE_OBJS = \
+ sound/fmopl.o \
+ sound/mididrv.o \
+ sound/mixer.o
+
+# Include common rules
+include common.rules