From: Peter Eisentraut Date: Thu, 13 Jul 2000 16:07:14 +0000 (+0000) Subject: Repair parallel make in backend tree (and make it really parallel). X-Git-Tag: REL7_1_BETA~943 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a3cbc84efdf3ba205b5aece838ffbe1d548e851;p=postgresql Repair parallel make in backend tree (and make it really parallel). Make Gen_fmgrtab.sh reasonably robust against concurrent invocation. --- diff --git a/src/backend/Makefile b/src/backend/Makefile index b84af541c8..0b541a6b46 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -4,7 +4,7 @@ # # 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 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) -postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) +postgres: $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) else # win # No points for style here. How about encapsulating some of these # commands into variables? -postgres: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h \ - $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a +postgres: $(DLLOBJS) $(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a dlltool --dllname $@$(X) --output-exp $@.exp --def postgres.def gcc -g -o $@$(X) -Wl,--base-file,$@.base $@.exp $(DLLOBJS) $(DLLLIBS) dlltool --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def @@ -60,11 +54,12 @@ endif # win # Parallel make trickery -$(OBJS): $(DIRS:%=%.dir) +$(OBJS): $(DIRS:%=%-recursive) -.PHONY: $(DIRS:%=%.dir) -$(DIRS:%=%.dir): - $(MAKE) -C $(subst .dir,,$@) all +.PHONY: $(DIRS:%=%-recursive) +# Update the commonly used headers before building the subdirectories +$(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) @@ -166,7 +161,7 @@ ifeq ($(MAKE_DLL), true) rm -f postgres.dll postgres.def libpostgres.a 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 rm -f port/Makefile port/tas.s port/dynloader.c diff --git a/src/backend/access/Makefile b/src/backend/access/Makefile index bee3c48d24..fb1a19f000 100644 --- a/src/backend/access/Makefile +++ b/src/backend/access/Makefile @@ -1,54 +1,30 @@ -#------------------------------------------------------------------------- # -# Makefile-- -# Makefile for the access methods module +# Makefile for the access methods module # -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.5 1999/12/13 22:32:17 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.6 2000/07/13 16:06:42 petere Exp $ # -#------------------------------------------------------------------------- -SRCDIR = ../.. +subdir = src/backend/access +top_builddir = ../../.. include ../../Makefile.global -OBJS = common/SUBSYS.o gist/SUBSYS.o hash/SUBSYS.o heap/SUBSYS.o \ - index/SUBSYS.o rtree/SUBSYS.o nbtree/SUBSYS.o transam/SUBSYS.o +SUBDIRS := common gist hash heap index nbtree rtree transam +SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o) +all: SUBSYS.o -all: submake SUBSYS.o +SUBSYS.o: $(SUBDIROBJS) + $(LD) $(LDREL) $(LDOUT) $@ $^ -SUBSYS.o: $(OBJS) - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) +$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) -.PHONY: submake -submake: - $(MAKE) -C common 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 +.PHONY: $(SUBDIRS:%=%-recursive) +$(SUBDIRS:%=%-recursive): + $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o clean: + for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done 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 diff --git a/src/backend/optimizer/Makefile b/src/backend/optimizer/Makefile index d99ea9c4f6..accb3c033d 100644 --- a/src/backend/optimizer/Makefile +++ b/src/backend/optimizer/Makefile @@ -1,32 +1,30 @@ -#------------------------------------------------------------------------- # -# Makefile-- -# Makefile for optimizer +# Makefile for optimizer # -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.7 1999/12/13 22:32:48 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.8 2000/07/13 16:06:44 petere Exp $ # -#------------------------------------------------------------------------- -SRCDIR= ../.. +subdir = src/backend/optimizer +top_builddir = ../../.. 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) - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) +$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) -.PHONY: submake clean dep depend -submake: - for i in $(DIRS); do $(MAKE) -C $$i SUBSYS.o; done +.PHONY: $(SUBDIRS:%=%-recursive) +$(SUBDIRS:%=%-recursive): + $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o clean: + for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done rm -f SUBSYS.o - for i in $(DIRS); do $(MAKE) -C $$i clean; done -.DEFAULT: - for i in $(DIRS); do $(MAKE) -C $$i $@; done +dep depend: + for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done diff --git a/src/backend/storage/Makefile b/src/backend/storage/Makefile index 73dcf0cf1b..812fd53e80 100644 --- a/src/backend/storage/Makefile +++ b/src/backend/storage/Makefile @@ -1,34 +1,30 @@ -#------------------------------------------------------------------------- # -# Makefile-- -# Makefile for the storage manager subsystem +# Makefile for the storage manager subsystem # -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.6 1999/12/13 22:33:33 momjian Exp $ +# $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.7 2000/07/13 16:06:48 petere Exp $ # -#------------------------------------------------------------------------- -SRCDIR= ../.. +subdir = src/backend/storage +top_builddir = ../../.. 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 \ - lmgr/SUBSYS.o page/SUBSYS.o smgr/SUBSYS.o +all: SUBSYS.o -DIRS = buffer file ipc large_object lmgr page smgr +SUBSYS.o: $(SUBDIROBJS) + $(LD) $(LDREL) $(LDOUT) $@ $^ -SUBSYS.o: $(OBJS) - $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) +$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) -.PHONY: submake clean dep - -submake: - for i in $(DIRS); do $(MAKE) -C $$i SUBSYS.o; done +.PHONY: $(SUBDIRS:%=%-recursive) +$(SUBDIRS:%=%-recursive): + $(MAKE) -C $(subst -recursive,,$@) SUBSYS.o clean: + for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done rm -f SUBSYS.o - for i in $(DIRS); do $(MAKE) -C $$i clean; done -.DEFAULT: - for i in $(DIRS); do $(MAKE) -C $$i $@; done +dep depend: + for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done diff --git a/src/backend/storage/ipc/Makefile b/src/backend/storage/ipc/Makefile index 7d9a662055..dc6989bbcd 100644 --- a/src/backend/storage/ipc/Makefile +++ b/src/backend/storage/ipc/Makefile @@ -1,22 +1,16 @@ -#------------------------------------------------------------------------- # -# Makefile-- -# Makefile for storage/ipc +# Makefile for storage/ipc # -# IDENTIFICATION -# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.11 2000/05/29 05:45:06 tgl Exp $ +# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.12 2000/07/13 16:06:54 petere Exp $ # -#------------------------------------------------------------------------- -SRCDIR = ../../.. +subdir = src/backend/storage/ipc +top_builddir = ../../../.. include ../../../Makefile.global # seems to be required 1999/07/22 bjm -ifeq ($(CPU),alpha) -ifeq ($(CC), gcc) -CFLAGS+= -fno-inline -endif -ifeq ($(CC), egcs) +ifeq ($(CPU), alpha) +ifeq ($(GCC), yes) CFLAGS+= -fno-inline endif endif @@ -38,4 +32,3 @@ clean: ifeq (depend,$(wildcard depend)) include depend endif - diff --git a/src/backend/utils/Gen_fmgrtab.sh b/src/backend/utils/Gen_fmgrtab.sh index b532e0f338..41a0bc3d71 100644 --- a/src/backend/utils/Gen_fmgrtab.sh +++ b/src/backend/utils/Gen_fmgrtab.sh @@ -9,7 +9,7 @@ # # # 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` : ${CPP='cc -E'} cleanup(){ - [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" + [ x"$noclean" != x"t" ] && rm -f "$CPPTMPFILE" "$RAWFILE" "$$-$OIDSFILE" "$$-$TABLEFILE" } BKIOPTS= @@ -71,13 +71,13 @@ if [ x"$INFILE" = x ] ; then exit 1 fi -CPPTMPFILE=fmgrtmp.c -RAWFILE=fmgr.raw +CPPTMPFILE="$$-fmgrtmp.c" +RAWFILE="$$-fmgr.raw" OIDSFILE=fmgroids.h 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 # # Generate fmgroids.h # -cat > "$OIDSFILE" < "$$-$OIDSFILE" <> "$OIDSFILE" + { if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }' >> "$$-$OIDSFILE" if [ $? -ne 0 ]; then cleanup @@ -173,7 +173,7 @@ if [ $? -ne 0 ]; then exit 1 fi -cat >> "$OIDSFILE" <> "$$-$OIDSFILE" < "$TABLEFILE" < "$$-$TABLEFILE" < "$TABLEFILE" <> "$TABLEFILE" +$AWK '{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }' $RAWFILE >> "$$-$TABLEFILE" if [ $? -ne 0 ]; then cleanup @@ -227,7 +227,7 @@ if [ $? -ne 0 ]; then fi -cat >> "$TABLEFILE" <> "$$-$TABLEFILE" <> "$TABLEFILE" +}' $RAWFILE >> "$$-$TABLEFILE" if [ $? -ne 0 ]; then cleanup @@ -252,7 +252,7 @@ if [ $? -ne 0 ]; then exit 1 fi -cat >> "$TABLEFILE" <> "$$-$TABLEFILE" <