Makefile.dep 2.6 KB
Newer Older
1 2 3 4
################################################################################
# vls (VideoLAN Server) dependencies Makefile
#-------------------------------------------------------------------------------
# (c)1999-2001 VideoLAN
5
# $Id: Makefile.dep,v 1.3 2002/12/08 14:50:43 massiot Exp $
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
################################################################################


################################################################################
# Note on generic rules and dependencies
################################################################################
#
# Note on dependencies: each .cpp file is associated with a .d file, which
# depends of it. The .o file associated with a .cpp file depends of the .d, of
# the .cpp itself, and of Makefile. The .d files are stored in a separate dep/
# directory.
# The dep directory should be ignored by CVS.
#
# Note on inclusions: depending of the target, the dependencies files must
# or must not be included. The problem is that if we ask make to include a file,
# and this file does not exist, it is made before it can be included. In a
# general way, a .d file should be included if and only if the corresponding .o
# needs to be re-made.
#
# The object Makefile knows how to make a .o from a .cpp, and includes
# dependencies for the target, but only those required.
#
# All settings and options are passed through main Makefile


################################################################################
# Default target
################################################################################

default:
	@echo "This Makefile should not be called directly,"


################################################################################
# Dependencies creation
################################################################################

# A dependencies file needs to be rebuilt if the .cpp  changed or if one of the 
# dependencies files have been changed. In other words, it depends from the
# .cpp and from itself.

-include $(MAKECMDGOALS)

49
$(DEP): dep/%.dpp: src/%.cpp
50 51
	@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
	@echo "Generating dependancies for $<..."
52
	@$(SHELL) -ec '$(CXX) $(DCFLAGS) $(INCLUDE) $< \
53 54 55 56
	| sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/src\/$(subst /,\/,$*).o \
	dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
	[ -s $@ ] || rm -f $@'

57 58 59 60 61 62 63 64
$(C_DEP): dep/%.d: src/%.c
	@test -d dep/$(dir $*) || mkdir -p dep/$(dir $*)
	@echo "Generating dependancies for $<..."
	@$(SHELL) -ec '$(CC) $(DCFLAGS) $(INCLUDE) $< \
	| sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/src\/$(subst /,\/,$*).o \
	dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
	[ -s $@ ] || rm -f $@'