]> git.sesse.net Git - vlc/blob - Makefile.modules
* ./doc/developer/decoders.xml: fixed a typo preventing compilation.
[vlc] / Makefile.modules
1 ###############################################################################
2 # vlc (VideoLAN Client) common module Makefile
3 # (c)2001 VideoLAN
4 ###############################################################################
5 # This file should be included by all module Makefiles
6 ###############################################################################
7
8 #
9 # include the local Makefile
10 #
11 include Makefile
12
13 #
14 # Analyze the target we are asked to build
15 #
16 module_name := $(shell echo $(MAKECMDGOALS) | sed 's@.*/\(.*\)\..*@\1@')
17 suff := $(shell echo $(MAKECMDGOALS) | sed 's@.*\.@@' | tr so/a lo/o)
18
19 #
20 # Compiler flags
21 #
22 SRC_C := $(filter %.c,$($(module_name)_SOURCES))
23 SRC_CPP := $(filter %.cpp,$($(module_name)_SOURCES))
24
25 ifeq (lo,$(suff))
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))
30 else
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))
35 endif
36
37
38 # Standard dependencies
39 #
40 C_DEP := $(SRC_C:%.c=.dep/%.d)
41 CPP_DEP := $(SRC_CPP:%.cpp=.dep/%.dpp)
42
43 export
44
45 #
46 # Virtual targets
47 #
48 all:
49
50 clean:
51 #       rm -f $(PLUGIN_ALL) $(BUILTIN_ALL)
52         rm -f *.o *.o.* *.lo *.lo.* *.obj *.moc *.moc.* *.bak
53         rm -rf .dep
54
55 FORCE:
56
57 $(OBJ_ALL): ../../Makefile.modules ../../Makefile.dep ../../Makefile ../../Makefile.opts Makefile
58 $(OBJ_ALL): $(H_DEP:%=../../include/%)
59
60 $(C_DEP): %.d: FORCE
61         @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
62
63 $(CPP_DEP): %.dpp: FORCE
64         @$(MAKE) -s --no-print-directory -f ../../Makefile.dep $@ CFLAGS="$(CFLAGS) $(extra_CFLAGS)"
65
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 $@
69
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 $@
73
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 $@
78         chmod a-x $@
79
80 ../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)
81         rm -f $@
82         ar rc $@ $(OBJ_ALL)
83         $(RANLIB) $@
84 endif
85