Only set interface palette when painting backdrop. (This fixes movie palette.)
[scummvm-innocent.git] / rules.mk
blobf2365f892828b9db0c7be15d7156f6feb4fe0f84
1 ###############################################
2 # Common build rules, used by the sub modules and their module.mk files
4 # $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/trunk/Makefile $
5 # $Id$
6 ###############################################
9 # Copy the list of objects to a new variable. The name of the new variable
10 # contains the module name, a trick we use so we can keep multiple different
11 # module object lists, one for each module.
12 MODULE_OBJS-$(MODULE) := $(addprefix $(MODULE)/, $(MODULE_OBJS))
14 # Add all involved directories to the MODULE_DIRS list
15 MODULE_DIRS += $(sort $(dir $(MODULE_OBJS-$(MODULE))))
19 ifdef TOOL_EXECUTABLE
20 ################################################
21 # Build rule for (tool) executables.
22 # TODO: Refactor this, so that even our master executable can use this rule?
23 ################################################
24 TOOL-$(MODULE) := $(MODULE)/$(TOOL_EXECUTABLE)$(EXEEXT)
25 $(TOOL-$(MODULE)): $(MODULE_OBJS-$(MODULE))
26 $(CXX) $(LDFLAGS) $+ -o $@
28 # Reset TOOL_EXECUTABLE var
29 TOOL_EXECUTABLE:=
31 # Add to "tools" target
32 tools: $(TOOL-$(MODULE))
34 # Pseudo target for comfort, allows for "make tools/skycpt", etc.
35 $(MODULE): $(TOOL-$(MODULE))
36 clean-tools: clean-$(MODULE)
38 else
39 ifdef PLUGIN
40 ################################################
41 # Build rule for dynamic (loadable) plugins
42 ################################################
43 PLUGIN-$(MODULE) := plugins/$(PLUGIN_PREFIX)$(notdir $(MODULE))$(PLUGIN_SUFFIX)
44 $(PLUGIN-$(MODULE)): $(MODULE_OBJS-$(MODULE)) $(PLUGIN_EXTRA_DEPS)
45 $(MKDIR) plugins
46 $(CXX) $(filter-out $(PLUGIN_EXTRA_DEPS),$+) $(PLUGIN_LDFLAGS) -o $@
48 # Reset PLUGIN var
49 PLUGIN:=
51 # Add to "plugins" target
52 plugins: $(PLUGIN-$(MODULE))
54 # Add to the PLUGINS variable
55 PLUGINS += $(PLUGIN-$(MODULE))
57 # Pseudo target for comfort, allows for "make common", "make gui" etc.
58 $(MODULE): $(PLUGIN-$(MODULE))
59 clean-plugins: clean-$(MODULE)
61 else
62 ################################################
63 # Build rule for static modules/plugins
64 ################################################
65 MODULE_LIB-$(MODULE) := $(MODULE)/lib$(notdir $(MODULE)).a
67 # If not building as a plugin, add the object files to the main OBJS list
68 OBJS += $(MODULE_LIB-$(MODULE))
70 # Convenience library target
71 $(MODULE_LIB-$(MODULE)): $(MODULE_OBJS-$(MODULE))
72 -$(RM) $@
73 $(AR) $@ $+
74 $(RANLIB) $@
76 # Pseudo target for comfort, allows for "make common", "make gui" etc.
77 $(MODULE): $(MODULE_LIB-$(MODULE))
79 endif # PLUGIN
80 endif # TOOL_EXECUTABLE
82 ###############################################
83 # Clean target, removes all object files. This looks a bit hackish, as we have to
84 # copy the content of MODULE_OBJS to another unique variable (the next module.mk
85 # will overwrite it after all). The same for the libMODULE.a library file.
86 ###############################################
87 clean: clean-$(MODULE)
88 clean-$(MODULE): clean-% :
89 -$(RM) $(MODULE_OBJS-$*) $(MODULE_LIB-$*) $(PLUGIN-$*) $(TOOL-$*)
91 .PHONY: clean-$(MODULE) $(MODULE)