1 ###############################################################################
2 # vlc (VideoLAN Client) common module Makefile
4 ###############################################################################
5 # This file should be included by all module Makefiles
6 ###############################################################################
9 # include the local Makefile
14 # Analyze the target we are asked to build
16 module_name := $(shell echo $(MAKECMDGOALS) | sed 's@.*/\(.*\)\..*@\1@')
17 suff := $(shell echo $(MAKECMDGOALS) | sed 's@.*\.@@' | tr so/a lo/o)
22 SRC_C := $(filter %.c,$($(module_name)_SOURCES))
23 SRC_CPP := $(filter %.cpp,$($(module_name)_SOURCES))
26 extra_CFLAGS := $(plugins_CFLAGS) $($(module_name)_CFLAGS) \
27 -DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
28 $($(module_name)_so_CFLAGS)
29 OBJ_ALL := $(SRC_C:%.c=%.lo.$(module_name)) $(SRC_CPP:%.cpp=%.lo.$(module_name))
31 extra_CFLAGS := $(builtins_CFLAGS) $($(module_name)_CFLAGS) \
32 -DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
33 $($(module_name)_a_CFLAGS)
34 OBJ_ALL := $(SRC_C:%.c=%.o.$(module_name)) $(SRC_CPP:%.cpp=%.o.$(module_name))
38 # Standard dependencies
40 C_DEP := $(SRC_C:%.c=.dep/%.d)
41 CPP_DEP := $(SRC_CPP:%.cpp=.dep/%.dpp)
51 # rm -f $(PLUGIN_ALL) $(BUILTIN_ALL)
52 rm -f *.o *.o.* *.lo *.lo.* *.obj *.moc *.moc.* *.bak
57 $(OBJ_ALL): ../../Makefile.modules ../../Makefile.dep ../../Makefile ../../Makefile.opts Makefile
58 $(OBJ_ALL): $(H_DEP:%=../../include/%)
61 @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
63 $(CPP_DEP): %.dpp: FORCE
64 @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
66 $(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.d
67 $(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.c
68 $(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
70 $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dpp
71 $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.cpp
72 $(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
74 # foo_CUSTOM lets us override all target rules for foo.so and foo.a
75 ifeq (,$($(module_name)_CUSTOM))
76 ../$(module_name).so: $(EXTRA_DEP) $(OBJ_ALL)
77 $(CC) $(OBJ_ALL) $(LDFLAGS) $(plugins_LDFLAGS) $($(module_name)_LDFLAGS) -o $@
80 ../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)