Commit 0d59dad7 authored by Peter Eisentraut's avatar Peter Eisentraut

Automatic dependency tracking

The .DEFAULT rule in backend/Makefile is harmful -- removed.
Replace `::' rules by `:'.
parent 81fd7532
#
# PostgreSQL top level makefile
#
# $Header: /cvsroot/pgsql/GNUmakefile.in,v 1.6 2000/06/28 18:29:11 petere Exp $
# $Header: /cvsroot/pgsql/GNUmakefile.in,v 1.7 2000/07/16 14:50:28 petere Exp $
#
subdir =
......@@ -30,9 +30,6 @@ distclean maintainer-clean:
GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
$(top_builddir)/config.status: $(top_srcdir)/configure
cd $(top_builddir) && ./config.status --recheck
# These dependencies are risky because both the target and the sources
# are in CVS and CVS doesn't preserve timestamps, thus leading to
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -287,6 +287,18 @@ fi
AC_DEFINE_UNQUOTED(PG_VERSION_STR, ["PostgreSQL $VERSION on $host, compiled by $cc_string"], [A canonical string containing the version number, platform, and C compiler])
#
# Automatic dependency tracking
#
AC_ARG_ENABLE(depend, [ --enable-depend turn on automatic dependency tracking],
[
if test x"$enableval" = x"yes" ; then
autodepend=yes
fi
])
AC_SUBST(autodepend)
# --enable-debug adds -g to compiler flags
# --disable-debug will forcefully remove it
AC_MSG_CHECKING(setting debug compiler flag)
......
#
# The PostgreSQL contrib tree Makefile
#
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.6 2000/07/09 13:12:57 petere Exp $
# $Header: /cvsroot/pgsql/contrib/Makefile,v 1.7 2000/07/16 14:50:29 petere Exp $
#
subdir = contrib
......@@ -29,7 +29,7 @@ WANTED_DIRS = array \
vacuumlo
# odbc
all .DEFAULT:
all install installdirs uninstall clean distclean maintainer-clean:
for dir in $(WANTED_DIRS); do \
if [ -e $$dir/Makefile ]; then \
$(MAKE) -C $$dir $@ ; \
......
......@@ -18,7 +18,7 @@ TARGETS= $(TARGETS_7)
CLEANFILES+= $(TARGETS) $(TARGETS_PRE7)
all:: $(TARGETS)
all: $(TARGETS)
install: all
ifneq ($(filter odbc$(DLSUFFIX), $(TARGETS)),)
......
......@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/doc/Makefile,v 1.16 2000/07/09 13:13:55 petere Exp $
# $Header: /cvsroot/pgsql/doc/Makefile,v 1.17 2000/07/16 14:50:32 petere Exp $
#
#----------------------------------------------------------------------------
......@@ -40,22 +40,22 @@ TARGETS= $(MODULES:%=%.html)
.PRECIOUS: postgres.tex postgres.dvi
.PHONY: beforeinstall install all clean distclean
beforeinstall::
beforeinstall:
-@if [ ! -d $(PGDOCS) ]; then mkdir $(PGDOCS); fi
install::
install:
$(MAKE) all
$(MAKE) man
all:: beforeinstall $(MODULES)
all: beforeinstall $(MODULES)
clean::
clean:
rm -rf $(MODULES)
distclean::
distclean:
$(MAKE) clean
man::
man:
-@if test ! -d $(POSTMANDIR) ; then mkdir $(POSTMANDIR) ; fi
gunzip -c man.tar.gz | (cd $(POSTMANDIR) ; $(TAR) xf - )
......
......@@ -23,19 +23,19 @@ TARGETS= $(SRC:%=%.tar.gz)
.PRECIOUS:
.PHONY: install all sources clean distclean
install::
install:
$(MAKE) all
(mv -f *.gz ..)
clean::
clean:
$(MAKE) -C sgml clean
distclean::
distclean:
$(MAKE) -C sgml distclean
all:: $(TARGETS)
all: $(TARGETS)
sources::
sources:
$(MAKE) sources.tar.gz
sources.tar:
......
......@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.15 2000/06/18 21:24:51 petere Exp $
# $Header: /cvsroot/pgsql/doc/src/sgml/Makefile,v 1.16 2000/07/16 14:50:38 petere Exp $
#
#----------------------------------------------------------------------------
......@@ -121,9 +121,9 @@ SQLTARGETS= $(XSQLTARGETS:-ref.l=.l)
.PRECIOUS: postgres.tex postgres.dvi
.PHONY: install all clean distclean
install::
install:
all::
all:
man:
$(MAKE) man1 manl
......@@ -143,10 +143,10 @@ manl: $(SQLTARGETS) manpage.refs
if [ ! -d manl ]; then mkdir manl; fi
cp *.l manl/
clean::
clean:
(rm -rf HTML.manifest *.html *.htm *.1 *.l man1 manl manpage*)
distclean::
distclean:
$(MAKE) clean
#
......
......@@ -7,7 +7,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.86 2000/07/09 13:13:59 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.87 2000/07/16 14:50:41 petere Exp $
#
# NOTES
# Essentially all Postgres make files include this file and use the
......@@ -283,3 +283,71 @@ STRDUP = @STRDUP@
.PHONY: all install installdirs uninstall dep depend clean distclean maintainer-clean
.SILENT: installdirs
# make `all' the default target
all:
$(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
cd $(top_builddir) && CONFIG_FILES=src/Makefile.global CONFIG_HEADERS= ./config.status
$(top_builddir)/config.status: $(top_srcdir)/configure
cd $(top_builddir) && ./config.status --recheck
COMPILE.c = $(CC) -c $(CPPFLAGS) $(CFLAGS)
# Automatic dependency generation
# -------------------------------
# When we configure with --enable-depend then we override the default
# compilation rule with the magic below. While or after creating the
# actual output file we also create a dependency list for the .c file.
# Next time we invoke make we will have top-notch information about
# whether this file needs to be updated. The dependency files are kept
# in the .deps subdirectory of each directory.
#
# The sed command is necessary to post-process the dependency file:
# Each dependency file becomes a target of its own, without
# dependencies or commands. This is because if you happen to remove a
# file that is a dependency (say, you rename a header file) the
# dependency would point to a non-existing file and make would fail.
# But if the file is listed as a target of its own, without
# prerequisites and commands, and doesn't exist then make will
# consider it updated. (That in turn also has the nice side effect
# that make will update all files that depended on the now removed
# file.)
autodepend = @autodepend@
ifdef autodepend
DEPDIR = .deps
df = $(DEPDIR)/$(*F)
ifeq ($(GCC), yes)
# GCC allows us to create object and dependency file in one invocation.
%.o : %.c
$(COMPILE.c) -MMD $< -o $@
@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
endif # GCC
# Include all the dependency files generated for the current
# directory. List /dev/null as dummy because if the wildcard expands
# to nothing then make would complain.
-include $(wildcard $(DEPDIR)/*.P) /dev/null
# hook for clean-up
clean: clean-deps
.PHONY: clean-deps
clean-deps:
@rm -rf $(DEPDIR)
endif # autodepend
......@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.61 2000/07/14 15:30:56 thomas Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.62 2000/07/16 14:50:44 petere Exp $
#
#-------------------------------------------------------------------------
......@@ -188,6 +188,3 @@ quick: $(OBJS)
depend dep: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
for i in $(DIRS); do $(MAKE) -C $$i $@; done
.DEFAULT:
for i in $(DIRS); do $(MAKE) -C $$i $@; done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment