11# -*-makefile-*-
2- # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.223 2006/07/20 09:30:18 petere Exp $
2+ # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.224 2006/07/21 22:37:37 petere Exp $
33
44# ------------------------------------------------------------------------------
55# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -511,17 +511,6 @@ install-strip:
511511# Next time we invoke make we will have top-notch information about
512512# whether this file needs to be updated. The dependency files are kept
513513# in the .deps subdirectory of each directory.
514- #
515- # The sed command is necessary to post-process the dependency file:
516- # Each dependency file becomes a target of its own, without
517- # dependencies or commands. This is because if you happen to remove a
518- # file that is a dependency (say, you rename a header file) the
519- # dependency would point to a non-existing file and make would fail.
520- # But if the file is listed as a target of its own, without
521- # prerequisites and commands, and doesn't exist then make will
522- # consider it updated. (That in turn also has the nice side effect
523- # that make will update all files that depended on the now removed
524- # file.)
525514
526515autodepend = @autodepend@
527516
@@ -532,38 +521,27 @@ COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
532521endif
533522
534523DEPDIR = .deps
535- df =$(DEPDIR ) /$(*F )
536-
537- # This converts a .d file in the current directory to a .P file in the .deps
538- # subdirectory, with the dummy targets as explained above.
539- define postprocess-depend
540- @if test ! -d$(DEPDIR ) ; then mkdir -p$(DEPDIR ) ; fi
541- @cp$* .d$(df ) .P
542- @sed -e 's/# .*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//'\
543- -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
544- @rm -f$* .d
545- endef
546524
547525ifeq ($(GCC ) , yes)
548526
549527# GCC allows us to create object and dependency file in one invocation.
550528% .o :% .c
551- $( COMPILE.c ) -o $@ $< -MMD
552- $(postprocess-depend )
529+ @if test ! -d $( DEPDIR ) ; then mkdir -p $( DEPDIR ) ; fi
530+ $(COMPILE.c ) -o $@ $< -MMD -MP -MF $( DEPDIR ) / $( *F ) .Po
553531
554532endif # GCC
555533
556534# Include all the dependency files generated for the current
557535# directory. List /dev/null as dummy because if the wildcard expands
558536# to nothing then make would complain.
559- -include $(wildcard $(DEPDIR ) /* .P ) /dev/null
537+ -include $(wildcard $(DEPDIR ) /* .Po ) /dev/null
560538
561539# hook for clean-up
562540clean distclean maintainer-clean : clean-deps
563541
564542.PHONY : clean-deps
565543clean-deps :
566- @rm -rf$(DEPDIR ) * .d
544+ @rm -rf$(DEPDIR )
567545
568546endif # autodepend
569547