* ./include/modules_inner.h: the module name is now a default shortcut, for
[vlc.git] / Makefile.dep
blobe56e57c62d7556886b071d93f759f6764f0fb04b
1 ################################################################################
2 # vlc (VideoLAN Client) dependencies makefile
3 # (c)1998 VideoLAN
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/
16 # directory.
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 ################################################################################
31 # Default target
32 ################################################################################
34 default:
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
44 # .c and from itself.
46 -include $(MAKECMDGOALS)
48 CFLAGS += -DMAKE_DEP
50 $(C_DEP): .dep/%.d: %.c
51         @test -d .dep/$(dir $*) || mkdir -p $(shell dirname .dep/$*)
52         #@echo "regenerating 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 "regenerating dependencies for $*.c"
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 $@'