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))
24 SRC_M := $(filter %.m,$($(module_name)_SOURCES))
27 extra_CFLAGS := $(plugins_CFLAGS) $($(module_name)_CFLAGS) \
28 -DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
29 $($(module_name)_so_CFLAGS)
30 OBJ_ALL := $(SRC_C:%.c=%.lo.$(module_name)) $(SRC_CPP:%.cpp=%.lo.$(module_name))
32 extra_CFLAGS := $(builtins_CFLAGS) $($(module_name)_CFLAGS) \
33 -DMODULE_NAME=$(module_name) -DMODULE_NAME_IS_$(module_name) \
34 $($(module_name)_a_CFLAGS)
35 OBJ_ALL := $(SRC_C:%.c=%.o.$(module_name)) $(SRC_CPP:%.cpp=%.o.$(module_name)) \
36 $(SRC_M:%.m=%.o.$(module_name))
40 # Standard dependencies
42 C_DEP := $(SRC_C:%.c=.dep/%.d)
43 CPP_DEP := $(SRC_CPP:%.cpp=.dep/%.dpp)
44 M_DEP := $(SRC_M:%.m=.dep/%.dm)
54 # rm -f $(PLUGIN_ALL) $(BUILTIN_ALL)
55 rm -f *.o *.o.* *.lo *.lo.* *.obj *.moc *.moc.* *.bak
60 $(OBJ_ALL): ../../Makefile.modules ../../Makefile.dep ../../Makefile ../../Makefile.opts Makefile
61 $(OBJ_ALL): $(H_DEP:%=../../include/%)
64 @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
66 $(CPP_DEP): %.dpp: FORCE
67 @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
70 @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
72 $(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.d
73 $(SRC_C:%.c=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.c
74 $(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
76 $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dpp
77 $(SRC_CPP:%.cpp=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.cpp
78 $(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
80 $(SRC_M:%.m=%.$(suff).$(module_name)): %.$(suff).$(module_name): .dep/%.dm
81 $(SRC_M:%.m=%.$(suff).$(module_name)): %.$(suff).$(module_name): %.m
82 $(CC) $(CFLAGS) $(extra_CFLAGS) -c $< -o $@
84 # foo_CUSTOM lets us override all target rules for foo.so and foo.a
85 ifeq (,$($(module_name)_CUSTOM))
86 ../$(module_name).so: $(EXTRA_DEP) $(OBJ_ALL)
87 $(CC) $(OBJ_ALL) $(LDFLAGS) $(plugins_LDFLAGS) $($(module_name)_LDFLAGS) -o $@
90 ../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)