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
This commit is contained in:
Max Horn 2002-11-21 04:08:37 +00:00
parent c5c1091613
commit 69bceafc6e
8 changed files with 169 additions and 105 deletions

View File

@ -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.
# List of all sub modules
MODULES += backends/fs/posix common gui scumm simon sound scumm/smush
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
# 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: 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
# The name for the directory used for depenency tracking
DEPDIR := .deps
# 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
# Include the build instructions for all modules
-include $(patsubst %,%/module.mk,$(MODULES))
scummvm$(EXEEXT): $(OBJS)
$(CXX) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS)
scumm/libscumm.a: $(SCUMM_OBJS) $(SMUSH_OBJS)
$(AR) $@ $+
$(RANLIB) $@
simon/libsimon.a: $(SIMON_OBJS)
$(AR) $@ $+
$(RANLIB) $@
$(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

9
backends/module.mk Normal file
View File

@ -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

24
common.rules Normal file
View File

@ -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)

15
common/module.mk Normal file
View File

@ -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

14
gui/module.mk Normal file
View File

@ -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

47
scumm/module.mk Normal file
View File

@ -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

13
simon/module.mk Normal file
View File

@ -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

9
sound/module.mk Normal file
View File

@ -0,0 +1,9 @@
MODULE := sound
MODULE_OBJS = \
sound/fmopl.o \
sound/mididrv.o \
sound/mixer.o
# Include common rules
include common.rules