Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8a3cbc8

Browse files
committed
Repair parallel make in backend tree (and make it really parallel).
Make Gen_fmgrtab.sh reasonably robust against concurrent invocation.
1 parent9191d68 commit8a3cbc8

File tree

8 files changed

+107
-157
lines changed

8 files changed

+107
-157
lines changed

‎src/backend/Makefile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.59 2000/07/08 02:40:27 tgl Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.60 2000/07/13 16:06:42 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -34,22 +34,16 @@ endif
3434

3535
all: postgres$(POSTGRES_IMP)
3636

37-
# Note that this is bogus. The desired effect is to build these
38-
# commonly used headers before doing much else. However, nothing says
39-
# that make is required to update these dependencies in any particular
40-
# order, it just happens to do that. Parallel make is broken though.
41-
4237
ifneq ($(PORTNAME), win)
4338

44-
postgres:$(top_srcdir)/src/include/parser/parse.h$(top_builddir)/src/include/utils/fmgroids.h$(OBJS)
45-
$(CC)$(CFLAGS) -o$@$(OBJS)$(LDFLAGS)
39+
postgres:$(OBJS)
40+
$(CC)$(CFLAGS) -o$@$^$(LDFLAGS)
4641

4742
else # win
4843

4944
# No points for style here. How about encapsulating some of these
5045
# commands into variables?
51-
postgres:$(top_srcdir)/src/include/parser/parse.h$(top_builddir)/src/include/utils/fmgroids.h\
52-
$(DLLOBJS)$(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
46+
postgres:$(DLLOBJS)$(top_builddir)/src/utils/dllinit.o postgres.def libpostgres.a
5347
dlltool --dllname$@$(X) --output-exp$@.exp --def postgres.def
5448
gcc -g -o$@$(X) -Wl,--base-file,$@.base$@.exp$(DLLOBJS)$(DLLLIBS)
5549
dlltool --dllname$@$(X) --base-file$@.base --output-exp$@.exp --def postgres.def
@@ -60,11 +54,12 @@ endif # win
6054

6155

6256
# Parallel make trickery
63-
$(OBJS):$(DIRS:%=%.dir)
57+
$(OBJS):$(DIRS:%=%-recursive)
6458

65-
.PHONY:$(DIRS:%=%.dir)
66-
$(DIRS:%=%.dir):
67-
$(MAKE) -C $(subst .dir,,$@) all
59+
.PHONY:$(DIRS:%=%-recursive)
60+
# Update the commonly used headers before building the subdirectories
61+
$(DIRS:%=%-recursive):$(top_srcdir)/src/include/parser/parse.h$(top_builddir)/src/include/utils/fmgroids.h
62+
$(MAKE) -C $(subst -recursive,,$@) all
6863

6964

7065
ifeq ($(MAKE_DLL), true)
@@ -166,7 +161,7 @@ ifeq ($(MAKE_DLL), true)
166161
rm -f postgres.dll postgres.def libpostgres.a
167162
endif
168163
endif
169-
for i in $(DIRS); do $(MAKE) -C $$i clean; done
164+
for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
170165

171166
distclean: clean
172167
rm -f port/Makefile port/tas.s port/dynloader.c

‎src/backend/access/Makefile

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,30 @@
1-
#-------------------------------------------------------------------------
21
#
3-
# Makefile--
4-
# Makefile for the access methods module
2+
# Makefile for the access methods module
53
#
6-
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.5 1999/12/13 22:32:17 momjian Exp $
4+
# $Header: /cvsroot/pgsql/src/backend/access/Makefile,v 1.6 2000/07/13 16:06:42 petere Exp $
85
#
9-
#-------------------------------------------------------------------------
106

11-
SRCDIR = ../..
7+
subdir = src/backend/access
8+
top_builddir = ../../..
129
include ../../Makefile.global
1310

14-
OBJS= common/SUBSYS.o gist/SUBSYS.o hash/SUBSYS.o heap/SUBSYS.o\
15-
index/SUBSYS.o rtree/SUBSYS.o nbtree/SUBSYS.o transam/SUBSYS.o
11+
SUBDIRS := common gist hash heap index nbtree rtree transam
12+
SUBDIROBJS :=$(SUBDIRS:%=%/SUBSYS.o)
1613

14+
all: SUBSYS.o
1715

18-
all: submake SUBSYS.o
16+
SUBSYS.o:$(SUBDIROBJS)
17+
$(LD)$(LDREL)$(LDOUT)$@$^
1918

20-
SUBSYS.o:$(OBJS)
21-
$(LD)$(LDREL)$(LDOUT) SUBSYS.o$(OBJS)
19+
$(SUBDIROBJS):$(SUBDIRS:%=%-recursive)
2220

23-
.PHONY: submake
24-
submake:
25-
$(MAKE) -C common SUBSYS.o
26-
$(MAKE) -C gist SUBSYS.o
27-
$(MAKE) -Chash SUBSYS.o
28-
$(MAKE) -C heap SUBSYS.o
29-
$(MAKE) -C index SUBSYS.o
30-
$(MAKE) -C rtree SUBSYS.o
31-
$(MAKE) -C nbtree SUBSYS.o
32-
$(MAKE) -C transam SUBSYS.o
21+
.PHONY:$(SUBDIRS:%=%-recursive)
22+
$(SUBDIRS:%=%-recursive):
23+
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
3324

3425
clean:
26+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done
3527
rm -f SUBSYS.o
36-
$(MAKE) -C common clean
37-
$(MAKE) -C gist clean
38-
$(MAKE) -Chash clean
39-
$(MAKE) -C heap clean
40-
$(MAKE) -C index clean
41-
$(MAKE) -C rtree clean
42-
$(MAKE) -C nbtree clean
43-
$(MAKE) -C transam clean
44-
45-
.DEFAULT:
46-
$(MAKE) -C common$@
47-
$(MAKE) -C gist$@
48-
$(MAKE) -Chash$@
49-
$(MAKE) -C heap$@
50-
$(MAKE) -C index$@
51-
$(MAKE) -C rtree$@
52-
$(MAKE) -C nbtree$@
53-
$(MAKE) -C transam$@
5428

29+
depdepend:
30+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done

‎src/backend/optimizer/Makefile

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
#-------------------------------------------------------------------------
21
#
3-
# Makefile--
4-
# Makefile for optimizer
2+
# Makefile for optimizer
53
#
6-
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.7 1999/12/13 22:32:48 momjian Exp $
4+
# $Header: /cvsroot/pgsql/src/backend/optimizer/Makefile,v 1.8 2000/07/13 16:06:44 petere Exp $
85
#
9-
#-------------------------------------------------------------------------
106

11-
SRCDIR= ../..
7+
subdir = src/backend/optimizer
8+
top_builddir = ../../..
129
include ../../Makefile.global
1310

14-
all: submake SUBSYS.o
11+
SUBDIRS := geqo path plan prep util
12+
SUBDIROBJS :=$(SUBDIRS:%=%/SUBSYS.o)
1513

16-
OBJS = path/SUBSYS.o plan/SUBSYS.o prep/SUBSYS.o util/SUBSYS.o geqo/SUBSYS.o
14+
all:SUBSYS.o
1715

18-
DIRS = path plan prep util geqo
16+
SUBSYS.o:$(SUBDIROBJS)
17+
$(LD)$(LDREL)$(LDOUT)$@$^
1918

20-
SUBSYS.o:$(OBJS)
21-
$(LD)$(LDREL)$(LDOUT) SUBSYS.o$(OBJS)
19+
$(SUBDIROBJS):$(SUBDIRS:%=%-recursive)
2220

23-
.PHONY:submake clean dep depend
24-
submake:
25-
foriin$(DIRS);do$(MAKE) -C$$i SUBSYS.o;done
21+
.PHONY:$(SUBDIRS:%=%-recursive)
22+
$(SUBDIRS:%=%-recursive):
23+
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
2624

2725
clean:
26+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done
2827
rm -f SUBSYS.o
29-
foriin$(DIRS);do$(MAKE) -C$$i clean;done
3028

31-
.DEFAULT:
32-
foriin$(DIRS);do$(MAKE) -C$$i$@;done
29+
depdepend:
30+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done

‎src/backend/storage/Makefile

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
1-
#-------------------------------------------------------------------------
21
#
3-
# Makefile--
4-
# Makefile for the storage manager subsystem
2+
# Makefile for the storage manager subsystem
53
#
6-
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.6 1999/12/13 22:33:33 momjian Exp $
4+
# $Header: /cvsroot/pgsql/src/backend/storage/Makefile,v 1.7 2000/07/13 16:06:48 petere Exp $
85
#
9-
#-------------------------------------------------------------------------
106

11-
SRCDIR= ../..
7+
subdir = src/backend/storage
8+
top_builddir = ../../..
129
include ../../Makefile.global
1310

14-
all: submake SUBSYS.o
11+
SUBDIRS := buffer file ipc large_object lmgr page smgr
12+
SUBDIROBJS :=$(SUBDIRS:%=%/SUBSYS.o)
1513

16-
OBJS = buffer/SUBSYS.o file/SUBSYS.o ipc/SUBSYS.o large_object/SUBSYS.o\
17-
lmgr/SUBSYS.o page/SUBSYS.o smgr/SUBSYS.o
14+
all: SUBSYS.o
1815

19-
DIRS = buffer file ipc large_object lmgr page smgr
16+
SUBSYS.o:$(SUBDIROBJS)
17+
$(LD)$(LDREL)$(LDOUT)$@$^
2018

21-
SUBSYS.o:$(OBJS)
22-
$(LD)$(LDREL)$(LDOUT) SUBSYS.o$(OBJS)
19+
$(SUBDIROBJS):$(SUBDIRS:%=%-recursive)
2320

24-
.PHONY: submake clean dep
25-
26-
submake:
27-
foriin$(DIRS);do$(MAKE) -C$$i SUBSYS.o;done
21+
.PHONY:$(SUBDIRS:%=%-recursive)
22+
$(SUBDIRS:%=%-recursive):
23+
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
2824

2925
clean:
26+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done
3027
rm -f SUBSYS.o
31-
foriin$(DIRS);do$(MAKE) -C$$i clean;done
3228

33-
.DEFAULT:
34-
foriin$(DIRS);do$(MAKE) -C$$i$@;done
29+
depdepend:
30+
fordirin$(SUBDIRS);do$(MAKE) -C$$dir$@||exit;done

‎src/backend/storage/ipc/Makefile

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
#-------------------------------------------------------------------------
21
#
3-
# Makefile--
4-
# Makefile for storage/ipc
2+
# Makefile for storage/ipc
53
#
6-
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.11 2000/05/29 05:45:06 tgl Exp $
4+
# $Header: /cvsroot/pgsql/src/backend/storage/ipc/Makefile,v 1.12 2000/07/13 16:06:54 petere Exp $
85
#
9-
#-------------------------------------------------------------------------
106

11-
SRCDIR = ../../..
7+
subdir = src/backend/storage/ipc
8+
top_builddir = ../../../..
129
include ../../../Makefile.global
1310

1411
# seems to be required 1999/07/22 bjm
15-
ifeq ($(CPU),alpha)
16-
ifeq ($(CC), gcc)
17-
CFLAGS+= -fno-inline
18-
endif
19-
ifeq ($(CC), egcs)
12+
ifeq ($(CPU), alpha)
13+
ifeq ($(GCC), yes)
2014
CFLAGS+= -fno-inline
2115
endif
2216
endif
@@ -38,4 +32,3 @@ clean:
3832
ifeq (depend,$(wildcard depend))
3933
include depend
4034
endif
41-

‎src/backend/utils/Gen_fmgrtab.sh

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
#
1111
# IDENTIFICATION
12-
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.16 2000/07/06 21:33:30 petere Exp $
12+
# $Header: /cvsroot/pgsql/src/backend/utils/Attic/Gen_fmgrtab.sh,v 1.17 2000/07/13 16:07:06 petere Exp $
1313
#
1414
#-------------------------------------------------------------------------
1515

@@ -19,7 +19,7 @@ CMDNAME=`basename $0`
1919
:${CPP='cc -E'}
2020

2121
cleanup(){
22-
[ x"$noclean"!= x"t" ]&& rm -f"$CPPTMPFILE""$RAWFILE"
22+
[ x"$noclean"!= x"t" ]&& rm -f"$CPPTMPFILE""$RAWFILE""$$-$OIDSFILE""$$-$TABLEFILE"
2323
}
2424

2525
BKIOPTS=
@@ -71,13 +71,13 @@ if [ x"$INFILE" = x ] ; then
7171
exit 1
7272
fi
7373

74-
CPPTMPFILE=fmgrtmp.c
75-
RAWFILE=fmgr.raw
74+
CPPTMPFILE="$$-fmgrtmp.c"
75+
RAWFILE="$$-fmgr.raw"
7676
OIDSFILE=fmgroids.h
7777
TABLEFILE=fmgrtab.c
7878

7979

80-
trap'echo "Caught signal." ; cleanup ; exit 1' 1 2315
80+
trap'echo "Caught signal." ; cleanup ; exit 1' 1 2 15
8181

8282

8383
#
@@ -124,7 +124,7 @@ cpp_define=`echo $OIDSFILE | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTU
124124
#
125125
# Generate fmgroids.h
126126
#
127-
cat>"$OIDSFILE"<<FuNkYfMgRsTuFf
127+
cat>"$$-$OIDSFILE"<<FuNkYfMgRsTuFf
128128
/*-------------------------------------------------------------------------
129129
*
130130
*$OIDSFILE
@@ -165,15 +165,15 @@ FuNkYfMgRsTuFf
165165
tr'abcdefghijklmnopqrstuvwxyz''ABCDEFGHIJKLMNOPQRSTUVWXYZ'<$RAWFILE| \
166166
$AWK'
167167
BEGIN{ OFS = ""; }
168-
{ if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }'>>"$OIDSFILE"
168+
{ if (seenit[$(NF-1)]++ == 0) print "#define F_", $(NF-1), " ", $1; }'>>"$$-$OIDSFILE"
169169

170170
if [$?-ne 0 ];then
171171
cleanup
172172
echo"$CMDNAME failed"
173173
exit 1
174174
fi
175175

176-
cat>>"$OIDSFILE"<<FuNkYfMgRsTuFf
176+
cat>>"$$-$OIDSFILE"<<FuNkYfMgRsTuFf
177177
178178
#endif/*$cpp_define */
179179
FuNkYfMgRsTuFf
@@ -187,7 +187,7 @@ FuNkYfMgRsTuFf
187187
# this table definition as a separate C file that won't need to include any
188188
# "real" declarations for those functions!
189189
#
190-
cat>"$TABLEFILE"<<FuNkYfMgRtAbStUfF
190+
cat>"$$-$TABLEFILE"<<FuNkYfMgRtAbStUfF
191191
/*-------------------------------------------------------------------------
192192
*
193193
*$TABLEFILE
@@ -218,7 +218,7 @@ cat > "$TABLEFILE" <<FuNkYfMgRtAbStUfF
218218
219219
FuNkYfMgRtAbStUfF
220220

221-
$AWK'{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }'$RAWFILE>>"$TABLEFILE"
221+
$AWK'{ print "extern Datum", $(NF-1), "(PG_FUNCTION_ARGS);"; }'$RAWFILE>>"$$-$TABLEFILE"
222222

223223
if [$?-ne 0 ];then
224224
cleanup
@@ -227,7 +227,7 @@ if [ $? -ne 0 ]; then
227227
fi
228228

229229

230-
cat>>"$TABLEFILE"<<FuNkYfMgRtAbStUfF
230+
cat>>"$$-$TABLEFILE"<<FuNkYfMgRtAbStUfF
231231
232232
const FmgrBuiltin fmgr_builtins[] = {
233233
FuNkYfMgRtAbStUfF
@@ -244,15 +244,15 @@ $AWK 'BEGIN {
244244
}
245245
{ printf (" { %d, \"%s\", %d, %s, %s, %s },\n"), \
246246
$1, $(NF-1), $9, Strict[$8], OldStyle[$4], $(NF-1)
247-
}'$RAWFILE>>"$TABLEFILE"
247+
}'$RAWFILE>>"$$-$TABLEFILE"
248248

249249
if [$?-ne 0 ];then
250250
cleanup
251251
echo"$CMDNAME failed"
252252
exit 1
253253
fi
254254

255-
cat>>"$TABLEFILE"<<FuNkYfMgRtAbStUfF
255+
cat>>"$$-$TABLEFILE"<<FuNkYfMgRtAbStUfF
256256
/* dummy entry is easier than getting rid of comma after last real one */
257257
/* (not that there has ever been anything wrong with *having* a
258258
comma after the last field in an array initializer) */
@@ -264,5 +264,10 @@ const int fmgr_nbuiltins = (sizeof(fmgr_builtins) / sizeof(FmgrBuiltin)) - 1;
264264
265265
FuNkYfMgRtAbStUfF
266266

267+
# We use the temporary files to avoid problems with concurrent runs
268+
# (which can happen during parallel make).
269+
mv"$$-$OIDSFILE"$OIDSFILE
270+
mv"$$-$TABLEFILE"$TABLEFILE
271+
267272
cleanup
268273
exit 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp