* ./src/interface/main.c: if Ctrl-C doesn't kill vlc cleanly for any
[vlc.git] / Makefile.modules
blob9fc3070d51763f5df96ac48fb34e31c2e29741c2
1 ###############################################################################
2 # vlc (VideoLAN Client) common module Makefile
3 # (c)2001 VideoLAN
4 ###############################################################################
5 # This file should be included by all module Makefiles
6 ###############################################################################
9 # include the local Makefile
11 include 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)
20 # Compiler flags
22 SRC_C := $(filter %.c,$($(module_name)_SOURCES))
23 SRC_CPP := $(filter %.cpp,$($(module_name)_SOURCES))
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
37
38 # Standard dependencies
40 C_DEP := $(SRC_C:%.c=.dep/%.d)
41 CPP_DEP := $(SRC_CPP:%.cpp=.dep/%.dpp)
43 export
46 # Virtual targets
48 all:
50 clean:
51 #       rm -f $(PLUGIN_ALL) $(BUILTIN_ALL)
52         rm -f *.o *.o.* *.lo *.lo.* *.obj *.moc *.moc.* *.bak
53         rm -rf .dep
55 FORCE:
57 $(OBJ_ALL): ../../Makefile.modules ../../Makefile.dep ../../Makefile ../../Makefile.opts Makefile
58 $(OBJ_ALL): $(H_DEP:%=../../include/%)
60 $(C_DEP): %.d: FORCE
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 $@
78         chmod a-x $@
80 ../$(module_name).a: $(EXTRA_DEP) $(OBJ_ALL)
81         rm -f $@
82         ar rc $@ $(OBJ_ALL)
83         $(RANLIB) $@
84 endif