diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | Makefile.common | 20 | ||||
-rw-r--r-- | common.rules | 30 | ||||
-rw-r--r-- | scumm/module.mk | 5 | ||||
-rw-r--r-- | simon/module.mk | 5 | ||||
-rw-r--r-- | sky/module.mk | 5 | ||||
-rw-r--r-- | sword2/module.mk | 5 |
7 files changed, 57 insertions, 15 deletions
@@ -26,6 +26,8 @@ OBJS := MODULES := MODULE_DIRS := +EXECUTABLE := scummvm$(EXEEXT) + # Load the make rules generated by configure include config.mak diff --git a/Makefile.common b/Makefile.common index 27acb8c9d2..5da0612341 100644 --- a/Makefile.common +++ b/Makefile.common @@ -5,7 +5,7 @@ ###################################################################### # The defaul build target: just build the scummvm executable ###################################################################### -all: scummvm$(EXEEXT) +all: $(EXECUTABLE) ###################################################################### @@ -31,15 +31,21 @@ DEPDIR := .deps # Plugin settings ###################################################################### -# For now we only support "static" plugins -STATIC_PLUGINS := 1 +# Whether to build plugins or now (TODO: should be set by configure script +#BUILD_PLUGINS := 1 # Plugin prefix. Typically "lib" on Unix, and nothing everywhere else PLUGIN_PREFIX := lib # Plugin suffix. For static/shared libs this is typically ".so"/".a" on Unix, # ".dll"/".lib" on Windows, ".bundle"/".a" on OS X, etc. -PLUGIN_SUFFIX := .a +PLUGIN_SUFFIX := .so +ifdef BUILD_PLUGINS +# FIXME/TODO: The following is OS X specific (and the '-m' is an evil hack +# to work around the conflict between our operators new/delete and the +# ones provided by libstdc++.a) +LDFLAGS += -all_load -m +endif ###################################################################### # Module settings @@ -96,11 +102,11 @@ CPPFLAGS:= $(DEFINES) $(INCLUDES) base/main.o: $(filter-out base/libbase.a,$(OBJS)) # The build rule for the ScummVM executable -scummvm$(EXEEXT): $(OBJS) - $(CXX) $(LDFLAGS) -o $@ $+ $(LIBS) +$(EXECUTABLE): $(OBJS) + $(CXX) $(LDFLAGS) $+ $(LIBS) -o $@ clean: - $(RM) $(OBJS) scummvm$(EXEEXT) + $(RM) $(OBJS) $(EXECUTABLE) .PHONY: all clean dist distclean diff --git a/common.rules b/common.rules index 97e7507d99..3c7b732728 100644 --- a/common.rules +++ b/common.rules @@ -1,13 +1,32 @@ # Common build rules, used by the sub modules and their module.mk files +MODULE_OBJS-$(MODULE) := $(MODULE_OBJS) +MODULE_LIB-$(MODULE) := $(MODULE)/lib$(MODULE).a + +ifdef PLUGIN +# Plugin build rule +# TODO: Right now, for Mac OS X only. We either will have to generate this +# via the configure script, or put in some 'if' statements to choose from +# one of several build rules +PLUGIN-$(MODULE) := $(MODULE)/$(PLUGIN_PREFIX)$(MODULE)$(PLUGIN_SUFFIX) +$(PLUGIN-$(MODULE)): $(MODULE_OBJS) $(EXECUTABLE) + $(CXX) -bundle -bundle_loader $(EXECUTABLE) $(filter-out $(EXECUTABLE),$+) -o $@ +PLUGIN:= +plugins: $(PLUGIN-$(MODULE)) + +else + +# If not building as a plugin, add the object files to the main OBJS list +OBJS += $(MODULE_LIB-$(MODULE)) +endif + + # 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)/$(PLUGIN_PREFIX)$(MODULE)$(PLUGIN_SUFFIX) clean: clean-$(MODULE) clean-$(MODULE): clean-% : - -$(RM) $(MODULE_OBJS-$*) $(MODULE_LIB-$*) + -$(RM) $(MODULE_OBJS-$*) $(MODULE_LIB-$*) $(PLUGIN-$*) # Convenience library target $(MODULE_LIB-$(MODULE)): $(MODULE_OBJS) @@ -19,9 +38,4 @@ $(MODULE_LIB-$(MODULE)): $(MODULE_OBJS) # Pseudo target for comfort, allows for "make common", "make gui" etc. $(MODULE): $(MODULE_LIB-$(MODULE)) -ifdef STATIC_PLUGINS -# Add static plugin object files to the main OBJS list -OBJS += $(MODULE_LIB-$(MODULE)) -endif - .PHONY: clean-$(MODULE) $(MODULE) diff --git a/scumm/module.mk b/scumm/module.mk index 1fb64fe684..9aaafe5b84 100644 --- a/scumm/module.mk +++ b/scumm/module.mk @@ -55,5 +55,10 @@ MODULE_DIRS += \ scumm \ scumm/smush +# This module can be built as a plugin +ifdef BUILD_PLUGINS +PLUGIN := 1 +endif + # Include common rules include common.rules diff --git a/simon/module.mk b/simon/module.mk index 2e57a98460..b671ff0e39 100644 --- a/simon/module.mk +++ b/simon/module.mk @@ -15,5 +15,10 @@ MODULE_OBJS := \ MODULE_DIRS += \ simon +# This module can be built as a plugin +ifdef BUILD_PLUGINS +PLUGIN := 1 +endif + # Include common rules include common.rules diff --git a/sky/module.mk b/sky/module.mk index eba12e9a15..6fb563e6e0 100644 --- a/sky/module.mk +++ b/sky/module.mk @@ -29,5 +29,10 @@ MODULE_DIRS += \ sky/music \ sky/compacts +# This module can be built as a plugin +ifdef BUILD_PLUGINS +PLUGIN := 1 +endif + # Include common rules include common.rules diff --git a/sword2/module.mk b/sword2/module.mk index e15914f2ec..c3a00dd009 100644 --- a/sword2/module.mk +++ b/sword2/module.mk @@ -45,5 +45,10 @@ MODULE_DIRS += \ bs2 \ bs2/driver +# This module can be built as a plugin +ifdef BUILD_PLUGINS +PLUGIN := 1 +endif + # Include common rules include common.rules |