Automatic dependency tracking for C++ (GCC only)
This commit is contained in:
parent
86f0812520
commit
30402ce74a
@ -1,5 +1,5 @@
|
|||||||
# -*-makefile-*-
|
# -*-makefile-*-
|
||||||
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.106 2000/10/27 23:59:39 petere Exp $
|
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.107 2000/10/29 16:13:28 petere Exp $
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# All PostgreSQL makefiles include this file and use the variables it sets,
|
# All PostgreSQL makefiles include this file and use the variables it sets,
|
||||||
@ -332,28 +332,48 @@ $(top_builddir)/config.status: $(top_srcdir)/configure
|
|||||||
# that make will update all files that depended on the now removed
|
# that make will update all files that depended on the now removed
|
||||||
# file.)
|
# file.)
|
||||||
|
|
||||||
COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS)
|
|
||||||
|
|
||||||
autodepend = @autodepend@
|
autodepend = @autodepend@
|
||||||
|
|
||||||
ifeq ($(autodepend), yes)
|
ifeq ($(autodepend), yes)
|
||||||
|
|
||||||
|
ifndef COMPILE.c
|
||||||
|
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef COMPILE.cc
|
||||||
|
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
|
||||||
|
endif
|
||||||
|
|
||||||
DEPDIR = .deps
|
DEPDIR = .deps
|
||||||
df = $(DEPDIR)/$(*F)
|
df = $(DEPDIR)/$(*F)
|
||||||
|
|
||||||
|
# This converts a .d file in the current directory to a .P file in the .deps
|
||||||
|
# subdirectory, with the dummy targets as explained above.
|
||||||
|
define postprocess-depend
|
||||||
|
@if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
|
||||||
|
@cp $*.d $(df).P
|
||||||
|
@sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
||||||
|
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
|
||||||
|
@rm -f $*.d
|
||||||
|
endef
|
||||||
|
|
||||||
ifeq ($(GCC), yes)
|
ifeq ($(GCC), yes)
|
||||||
|
|
||||||
# GCC allows us to create object and dependency file in one invocation.
|
# GCC allows us to create object and dependency file in one invocation.
|
||||||
%.o : %.c
|
%.o : %.c
|
||||||
$(COMPILE.c) -MMD $< -o $@
|
$(COMPILE.c) -o $@ $< -MMD
|
||||||
@if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi; \
|
$(postprocess-depend)
|
||||||
cp $*.d $(df).P; \
|
|
||||||
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
|
||||||
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P; \
|
|
||||||
rm -f $*.d
|
|
||||||
|
|
||||||
endif # GCC
|
endif # GCC
|
||||||
|
|
||||||
|
ifeq ($(GXX), yes)
|
||||||
|
|
||||||
|
%.o : %.cc
|
||||||
|
$(COMPILE.cc) -o $@ $< -MMD
|
||||||
|
$(postprocess-depend)
|
||||||
|
|
||||||
|
endif # GXX
|
||||||
|
|
||||||
# Include all the dependency files generated for the current
|
# Include all the dependency files generated for the current
|
||||||
# directory. List /dev/null as dummy because if the wildcard expands
|
# directory. List /dev/null as dummy because if the wildcard expands
|
||||||
# to nothing then make would complain.
|
# to nothing then make would complain.
|
||||||
@ -364,6 +384,6 @@ clean distclean maintainer-clean: clean-deps
|
|||||||
|
|
||||||
.PHONY: clean-deps
|
.PHONY: clean-deps
|
||||||
clean-deps:
|
clean-deps:
|
||||||
@rm -rf $(DEPDIR)
|
@rm -rf $(DEPDIR) *.d
|
||||||
|
|
||||||
endif # autodepend
|
endif # autodepend
|
||||||
|
Loading…
x
Reference in New Issue
Block a user