1 ################################################################################
2 # vlc (VideoLAN Client) dependencies makefile
4 ################################################################################
5 # This Makefile is dedicated to build of .d files. It should not be called
6 # directly by user, but only through main Makefile.
7 ################################################################################
9 ###############################################################################
10 # Note on generic rules and dependencies
11 ###############################################################################
13 # Note on dependencies: each .c file is associated with a .d file, which
14 # depends of it. The .o file associated with a .c file depends of the .d, of the
15 # .c itself, and of Makefile. The .d files are stored in a separate .dep/
17 # The dep directory should be ignored by CVS.
19 # Note on inclusions: depending of the target, the dependencies files must
20 # or must not be included. The problem is that if we ask make to include a file,
21 # and this file does not exist, it is made before it can be included. In a
22 # general way, a .d file should be included if and only if the corresponding .o
23 # needs to be re-made.
25 # The object Makefile knows how to make a .o from a .c, and includes
26 # dependencies for the target, but only those required.
28 # All settings and options are passed through main Makefile
30 ################################################################################
32 ################################################################################
35 @echo "This Makefile should not be called directly,"
36 @echo "see notes at end of main Makefile."
38 ################################################################################
39 # Dependencies creation
40 ################################################################################
42 # A dependencies file needs to be rebuilt if the .c changed or if one of the
43 # dependencies files have been changed. In other words, it depends from the
46 -include $(MAKECMDGOALS)
50 $(C_DEP): .dep/%.d: %.c
51 @test -d .dep/$(dir $*) || mkdir -p $(shell dirname .dep/$*)
52 @echo "make[$(MAKELEVEL)]: Generating dependencies for \`$*.c'"
53 @$(SHELL) -ec '$(CC) -M $(CFLAGS) 2>/dev/null $< \
54 | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
55 .dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
56 [ -s $@ ] || rm -f $@'
58 $(CPP_DEP): .dep/%.dpp: %.cpp
59 @test -d .dep/$(dir $*) || mkdir -p $(shell dirname .dep/$*)
60 @echo "make[$(MAKELEVEL)]: Generating dependencies for \`$*.cpp'"
61 @$(SHELL) -ec '$(CC) -M $(CFLAGS) 2>/dev/null $< \
62 | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
63 .dep\/$(subst /,\/,$*).dpp : /g'\'' > $@; \
64 [ -s $@ ] || rm -f $@'
66 $(M_DEP): .dep/%.dm: %.m
67 @test -d .dep/$(dir $*) || mkdir -p $(shell dirname .dep/$*)
68 @echo "make[$(MAKELEVEL)]: Generating dependencies for \`$*.m'"
69 @$(SHELL) -ec '$(CC) -M $(CFLAGS) 2>/dev/null $< \
70 | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
71 .dep\/$(subst /,\/,$*).dm : /g'\'' > $@; \
72 [ -s $@ ] || rm -f $@'