提交 8a3cbc84 编写于 作者: P Peter Eisentraut

Repair parallel make in backend tree (and make it really parallel).

Make Gen_fmgrtab.sh reasonably robust against concurrent invocation.
上级 9191d684
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.59 2000/07/08 02:40:27 tgl Exp $ # $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.60 2000/07/13 16:06:42 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -34,22 +34,16 @@ endif ...@@ -34,22 +34,16 @@ endif
all: postgres $(POSTGRES_IMP) all: postgres $(POSTGRES_IMP)
# Note that this is bogus. The desired effect is to build these
# commonly used headers before doing much else. However, nothing says
# that make is required to update these dependencies in any particular
# order, it just happens to do that. Parallel make is broken though.
ifneq ($(PORTNAME), win) ifneq ($(PORTNAME), win)
postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h $(OBJS) postgres: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
else # win else # win
# No points for style here. How about encapsulating some of these # No points for style here. How about encapsulating some of these
# commands into variables? # commands into variables?
postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h \ postgres: $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
$(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def
gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS) gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS)
dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
...@@ -60,11 +54,12 @@ endif # win ...@@ -60,11 +54,12 @@ endif # win
# Parallel make trickery # Parallel make trickery
$(OBJS): $(DIRS:%=%.dir) $(OBJS): $(DIRS:%=%-recursive)
.PHONY: $(DIRS:%=%.dir) .PHONY: $(DIRS:%=%-recursive)
$(DIRS:%=%.dir): # Update the commonly used headers before building the subdirectories
$(MAKE) -C $(subst .dir,,$@) all $(DIRS:%=%-recursive): $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
$(MAKE) -C $(subst -recursive,,$@) all
ifeq ($(MAKE_DLL), true) ifeq ($(MAKE_DLL), true)
...@@ -166,7 +161,7 @@ ifeq ($(MAKE_DLL), true) ...@@ -166,7 +161,7 @@ ifeq ($(MAKE_DLL), true)
rm -f postgres.dll postgres.def libpostgres.a rm -f postgres.dll postgres.def libpostgres.a
endif endif
endif endif
for i in $(DIRS); do $(MAKE) -C $$i clean; done for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
distclean: clean distclean: clean
rm -f port/Makefile port/tas.s port/dynloader.c rm -f port/Makefile port/tas.s port/dynloader.c
......
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for the access methods module
# Makefile for the access methods module
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.6 2000/07/13 16:06:42 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.5 1999/12/13 22:32:17 momjian Exp $
# #
#-------------------------------------------------------------------------
SRCDIR = ../.. subdir = src/backend/access
top_builddir = ../../..
include ../../Makefile.global include ../../Makefile.global
OBJS = common/SUBSYS.o gist/SUBSYS.o hash/SUBSYS.o heap/SUBSYS.o \ SUBDIRS := common gist hash heap index nbtree rtree transam
index/SUBSYS.o rtree/SUBSYS.o nbtree/SUBSYS.o transam/SUBSYS.o SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o)
all: SUBSYS.o
all: submake SUBSYS.o SUBSYS.o: $(SUBDIROBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^
SUBSYS.o: $(OBJS) $(SUBDIROBJS): $(SUBDIRS:%=%-recursive)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
.PHONY: submake .PHONY: $(SUBDIRS:%=%-recursive)
submake: $(SUBDIRS:%=%-recursive):
$(MAKE) -C common SUBSYS.o $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
$(MAKE) -C gist SUBSYS.o
$(MAKE) -C hash SUBSYS.o
$(MAKE) -C heap SUBSYS.o
$(MAKE) -C index SUBSYS.o
$(MAKE) -C rtree SUBSYS.o
$(MAKE) -C nbtree SUBSYS.o
$(MAKE) -C transam SUBSYS.o
clean: clean:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
rm -f SUBSYS.o rm -f SUBSYS.o
$(MAKE) -C common clean
$(MAKE) -C gist clean
$(MAKE) -C hash clean
$(MAKE) -C heap clean
$(MAKE) -C index clean
$(MAKE) -C rtree clean
$(MAKE) -C nbtree clean
$(MAKE) -C transam clean
.DEFAULT:
$(MAKE) -C common $@
$(MAKE) -C gist $@
$(MAKE) -C hash $@
$(MAKE) -C heap $@
$(MAKE) -C index $@
$(MAKE) -C rtree $@
$(MAKE) -C nbtree $@
$(MAKE) -C transam $@
dep depend:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for optimizer
# Makefile for optimizer
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.8 2000/07/13 16:06:44 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.7 1999/12/13 22:32:48 momjian Exp $
# #
#-------------------------------------------------------------------------
SRCDIR= ../.. subdir = src/backend/optimizer
top_builddir = ../../..
include ../../Makefile.global include ../../Makefile.global
all: submake SUBSYS.o SUBDIRS := geqo path plan prep util
SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o)
OBJS = path/SUBSYS.o plan/SUBSYS.o prep/SUBSYS.o util/SUBSYS.o geqo/SUBSYS.o all: SUBSYS.o
DIRS = path plan prep util geqo SUBSYS.o: $(SUBDIROBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^
SUBSYS.o: $(OBJS) $(SUBDIROBJS): $(SUBDIRS:%=%-recursive)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
.PHONY: submake clean dep depend .PHONY: $(SUBDIRS:%=%-recursive)
submake: $(SUBDIRS:%=%-recursive):
for i in $(DIRS); do $(MAKE) -C $$i SUBSYS.o; done $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
clean: clean:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
rm -f SUBSYS.o rm -f SUBSYS.o
for i in $(DIRS); do $(MAKE) -C $$i clean; done
.DEFAULT: dep depend:
for i in $(DIRS); do $(MAKE) -C $$i $@; done for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for the storage manager subsystem
# Makefile for the storage manager subsystem
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.7 2000/07/13 16:06:48 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.6 1999/12/13 22:33:33 momjian Exp $
# #
#-------------------------------------------------------------------------
SRCDIR= ../.. subdir = src/backend/storage
top_builddir = ../../..
include ../../Makefile.global include ../../Makefile.global
all: submake SUBSYS.o SUBDIRS := buffer file ipc large_object lmgr page smgr
SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o)
OBJS = buffer/SUBSYS.o file/SUBSYS.o ipc/SUBSYS.o large_object/SUBSYS.o \ all: SUBSYS.o
lmgr/SUBSYS.o page/SUBSYS.o smgr/SUBSYS.o
DIRS = buffer file ipc large_object lmgr page smgr SUBSYS.o: $(SUBDIROBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^
SUBSYS.o: $(OBJS) $(SUBDIROBJS): $(SUBDIRS:%=%-recursive)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
.PHONY: submake clean dep .PHONY: $(SUBDIRS:%=%-recursive)
$(SUBDIRS:%=%-recursive):
submake: $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
for i in $(DIRS); do $(MAKE) -C $$i SUBSYS.o; done
clean: clean:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
rm -f SUBSYS.o rm -f SUBSYS.o
for i in $(DIRS); do $(MAKE) -C $$i clean; done
.DEFAULT: dep depend:
for i in $(DIRS); do $(MAKE) -C $$i $@; done for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for storage/ipc
# Makefile for storage/ipc
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.12 2000/07/13 16:06:54 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.11 2000/05/29 05:45:06 tgl Exp $
# #
#-------------------------------------------------------------------------
SRCDIR = ../../.. subdir = src/backend/storage/ipc
top_builddir = ../../../..
include ../../../Makefile.global include ../../../Makefile.global
# seems to be required 1999/07/22 bjm # seems to be required 1999/07/22 bjm
ifeq ($(CPU),alpha) ifeq ($(CPU), alpha)
ifeq ($(CC), gcc) ifeq ($(GCC), yes)
CFLAGS+= -fno-inline
endif
ifeq ($(CC), egcs)
CFLAGS+= -fno-inline CFLAGS+= -fno-inline
endif endif
endif endif
...@@ -38,4 +32,3 @@ clean: ...@@ -38,4 +32,3 @@ clean:
ifeq (depend,$(wildcard depend)) ifeq (depend,$(wildcard depend))
include depend include depend
endif endif
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.16 2000/07/06 21:33:30 petere Exp $ # $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.17 2000/07/13 16:07:06 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -19,7 +19,7 @@ CMDNAME=`basename $0` ...@@ -19,7 +19,7 @@ CMDNAME=`basename $0`
: ${CPP='cc -E'} : ${CPP='cc -E'}
cleanup(){ cleanup(){
[ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$$-$OIDSFILE" "$$-$TABLEFILE"
} }
BKIOPTS= BKIOPTS=
...@@ -71,13 +71,13 @@ if [ x"$INFILE" = x ] ; then ...@@ -71,13 +71,13 @@ if [ x"$INFILE" = x ] ; then
exit 1 exit 1
fi fi
CPPTMPFILE=fmgrtmp.c CPPTMPFILE="$$-fmgrtmp.c"
RAWFILE=fmgr.raw RAWFILE="$$-fmgr.raw"
OIDSFILE=fmgroids.h OIDSFILE=fmgroids.h
TABLEFILE=fmgrtab.c TABLEFILE=fmgrtab.c
trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 3 15 trap 'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
# #
...@@ -124,7 +124,7 @@ cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTU ...@@ -124,7 +124,7 @@ cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTU
# #
# Generate fmgroids.h # Generate fmgroids.h
# #
cat > "$OIDSFILE" <<FuNkYfMgRsTuFf cat > "$$-$OIDSFILE" <<FuNkYfMgRsTuFf
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* $OIDSFILE * $OIDSFILE
...@@ -165,7 +165,7 @@ FuNkYfMgRsTuFf ...@@ -165,7 +165,7 @@ FuNkYfMgRsTuFf
tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \ tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' < $RAWFILE | \
$AWK ' $AWK '
BEGIN { OFS = ""; } BEGIN { OFS = ""; }
{ if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> "$OIDSFILE" { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> "$$-$OIDSFILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
...@@ -173,7 +173,7 @@ if [ $? -ne 0 ]; then ...@@ -173,7 +173,7 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
cat >> "$OIDSFILE" <<FuNkYfMgRsTuFf cat >> "$$-$OIDSFILE" <<FuNkYfMgRsTuFf
#endif /* $cpp_define */ #endif /* $cpp_define */
FuNkYfMgRsTuFf FuNkYfMgRsTuFf
...@@ -187,7 +187,7 @@ FuNkYfMgRsTuFf ...@@ -187,7 +187,7 @@ FuNkYfMgRsTuFf
# this table definition as a separate C file that won't need to include any # this table definition as a separate C file that won't need to include any
# "real" declarations for those functions! # "real" declarations for those functions!
# #
cat > "$TABLEFILE" <<FuNkYfMgRtAbStUfF cat > "$$-$TABLEFILE" <<FuNkYfMgRtAbStUfF
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* $TABLEFILE * $TABLEFILE
...@@ -218,7 +218,7 @@ cat > "$TABLEFILE" <<FuNkYfMgRtAbStUfF ...@@ -218,7 +218,7 @@ cat > "$TABLEFILE" <<FuNkYfMgRtAbStUfF
FuNkYfMgRtAbStUfF FuNkYfMgRtAbStUfF
$AWK '{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$TABLEFILE" $AWK '{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
...@@ -227,7 +227,7 @@ if [ $? -ne 0 ]; then ...@@ -227,7 +227,7 @@ if [ $? -ne 0 ]; then
fi fi
cat >> "$TABLEFILE" <<FuNkYfMgRtAbStUfF cat >> "$$-$TABLEFILE" <<FuNkYfMgRtAbStUfF
const FmgrBuiltin fmgr_builtins[] = { const FmgrBuiltin fmgr_builtins[] = {
FuNkYfMgRtAbStUfF FuNkYfMgRtAbStUfF
...@@ -244,7 +244,7 @@ $AWK 'BEGIN { ...@@ -244,7 +244,7 @@ $AWK 'BEGIN {
} }
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \ { printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1) $1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
}' $RAWFILE >> "$TABLEFILE" }' $RAWFILE >> "$$-$TABLEFILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cleanup cleanup
...@@ -252,7 +252,7 @@ if [ $? -ne 0 ]; then ...@@ -252,7 +252,7 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
cat >> "$TABLEFILE" <<FuNkYfMgRtAbStUfF cat >> "$$-$TABLEFILE" <<FuNkYfMgRtAbStUfF
/* dummy entry is easier than getting rid of comma after last real one */ /* dummy entry is easier than getting rid of comma after last real one */
/* (not that there has ever been anything wrong with *having* a /* (not that there has ever been anything wrong with *having* a
comma after the last field in an array initializer) */ comma after the last field in an array initializer) */
...@@ -264,5 +264,10 @@ const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1; ...@@ -264,5 +264,10 @@ const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
FuNkYfMgRtAbStUfF FuNkYfMgRtAbStUfF
# We use the temporary files to avoid problems with concurrent runs
# (which can happen during parallel make).
mv "$$-$OIDSFILE" $OIDSFILE
mv "$$-$TABLEFILE" $TABLEFILE
cleanup cleanup
exit 0 exit 0
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for utils
# Makefile for utils
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/utils/Makefile,v 1.17 2000/07/13 16:07:06 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/Makefile,v 1.16 2000/07/01 21:16:44 petere Exp $
# #
#-------------------------------------------------------------------------
SRCDIR = ../.. subdir = src/backend/utils/
include $(SRCDIR)/Makefile.global top_builddir = ../../..
include ../../Makefile.global
all: submake SUBSYS.o
OBJS = fmgrtab.o adt/SUBSYS.o cache/SUBSYS.o error/SUBSYS.o \
fmgr/SUBSYS.o hash/SUBSYS.o init/SUBSYS.o misc/SUBSYS.o mmgr/SUBSYS.o \
sort/SUBSYS.o time/SUBSYS.o
DIRS = adt cache error fmgr hash init misc mmgr sort time
SUBDIRS := adt cache error fmgr hash init misc mmgr sort time
ifdef MULTIBYTE ifdef MULTIBYTE
OBJS += mb/SUBSYS.o SUBDIRS += mb
DIRS += mb
endif endif
SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o)
SUBSYS.o: $(OBJS) all: SUBSYS.o fmgroids.h
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
.PHONY: submake clean dep depend SUBSYS.o: fmgrtab.o $(SUBDIROBJS)
$(LD) $(LDREL) $(LDOUT) $@ $^
submake: $(SUBDIROBJS): $(SUBDIRS:%=%-recursive)
for i in $(DIRS); do $(MAKE) -C $$i SUBSYS.o; done
.PHONY: $(SUBDIRS:%=%-recursive)
$(SUBDIRS:%=%-recursive): fmgroids.h
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(SRCDIR)/include/catalog/pg_proc.h fmgroids.h fmgrtab.c: Gen_fmgrtab.sh $(top_srcdir)/src/include/catalog/pg_proc.h
CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(SRCDIR)/include/catalog/pg_proc.h CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $< $(top_srcdir)/src/include/catalog/pg_proc.h
clean: clean:
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
rm -f SUBSYS.o fmgrtab.o fmgroids.h fmgrtab.c rm -f SUBSYS.o fmgrtab.o fmgroids.h fmgrtab.c
for i in $(DIRS); do $(MAKE) -C $$i clean; done
dep depend: fmgroids.h fmgrtab.c dep depend: fmgroids.h fmgrtab.c
for i in $(DIRS); do $(MAKE) -C $$i depend; done for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
ifeq (depend,$(wildcard depend)) ifeq (depend,$(wildcard depend))
include depend include depend
......
#-------------------------------------------------------------------------
# #
# Makefile-- # Makefile for utils/adt
# Makefile for utils/adt
# #
# IDENTIFICATION # $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.39 2000/07/13 16:07:14 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/adt/Makefile,v 1.38 2000/07/07 19:24:37 petere Exp $
# #
#-------------------------------------------------------------------------
SRCDIR = ../../.. subdir = src/backend/utils/adt
top_builddir = ../../../..
include ../../../Makefile.global include ../../../Makefile.global
# seems to be required for some date/time stuff 1999/07/22 bjm # seems to be required for some date/time stuff 1999/07/22 bjm
ifeq ($(CPU),alpha) ifeq ($(CPU),alpha)
ifeq ($(CC), gcc) ifeq ($(GCC), yes)
CFLAGS+= -mieee
endif
ifeq ($(CC), egcs)
CFLAGS+= -mieee CFLAGS+= -mieee
endif endif
endif endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册