1 ################################################################################
2 # vlc (VideoLAN Client) dependancies 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 dependancies
11 ###############################################################################
13 # Note on dependancies: 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 dependancies 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 # dependancies 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 # Dependancies creation
40 ################################################################################
42 # A dependancies file needs to be rebuilt if the .c changed or if one of the
43 # dependancies files have been changed. In other words, it depends from the
46 -include $(MAKECMDGOALS)
48 $(C_DEP): .dep/%.d: %.c
49 @test -d .dep/$(dir $*) || mkdir -p .dep/$(dir $*)
50 #@echo "generating dependancies for $*.c"
51 @$(SHELL) -ec '$(CC) $(DCFLAGS) $(CFLAGS) $(DEFINE) 2>/dev/null $< \
52 | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
53 .dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
54 [ -s $@ ] || rm -f $@'
56 $(CPP_DEP): .dep/%.dpp: %.cpp
57 @test -d .dep/$(dir $*) || mkdir -p .dep/$(dir $*)
58 #@echo "generating dependancies for $*.c"
59 @$(SHELL) -ec '$(CC) $(DCFLAGS) $(CFLAGS) $(DEFINE) 2>/dev/null $< \
60 | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
61 .dep\/$(subst /,\/,$*).dpp : /g'\'' > $@; \
62 [ -s $@ ] || rm -f $@'