diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-12-01 17:19:51 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-12-01 17:19:51 -0500 |
commit | 29180e5d78e545472b1665b8d415e6917a5bf333 (patch) | |
tree | ad23ff16679c6a5a9ddca5a99dcde348c55a8707 /src | |
parent | 3295f82022ff0da95c96d8ca763e1d8902345466 (diff) | |
download | postgresql-29180e5d78e545472b1665b8d415e6917a5bf333.tar.gz postgresql-29180e5d78e545472b1665b8d415e6917a5bf333.zip |
Eliminate parallel-make hazard in ecpg/preproc.
Re-making ecpglib's typename.o is dangerous because another make thread
could be doing that at the same time. While we've not heard field
complaints traceable to this, it seems inevitable that it'd bite someone
eventually. Instead, symlink typename.c into the preproc directory and
recompile it there. That file is small enough that compiling it twice
isn't much of a penalty. Furthermore, this way we get a .o file that's
made without shlib CFLAGS, which seems cleaner.
This requires adding more stuff to the module's -I list. The MSVC
aspect of that is untested, but I'm sure the buildfarm will tell me
if I got it wrong.
Per a suggestion from Peter Eisentraut. Although this is theoretically
a bug fix, the lack of field reports makes me feel we needn't back-patch.
Discussion: https://postgr.es/m/31364.1543511708@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/ecpg/preproc/.gitignore | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/Makefile | 15 | ||||
-rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 1 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/preproc/.gitignore b/src/interfaces/ecpg/preproc/.gitignore index aacfb844bda..38ae2fe4d92 100644 --- a/src/interfaces/ecpg/preproc/.gitignore +++ b/src/interfaces/ecpg/preproc/.gitignore @@ -2,5 +2,5 @@ /preproc.c /preproc.h /pgc.c - +/typename.c /ecpg diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index 07721752c8f..8ceadd112b6 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -16,13 +16,16 @@ top_builddir = ../../../.. include $(top_builddir)/src/Makefile.global override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ - -I. -I$(srcdir) -DECPG_COMPILE \ - $(CPPFLAGS) + -I. -I$(srcdir) \ + -I$(top_srcdir)/src/interfaces/ecpg/ecpglib \ + -I$(libpq_srcdir) \ + -DECPG_COMPILE \ + $(CPPFLAGS) override CFLAGS += $(PTHREAD_CFLAGS) OBJS= preproc.o pgc.o type.o ecpg.o output.o parser.o \ - keywords.o c_keywords.o ecpg_keywords.o ../ecpglib/typename.o descriptor.o variable.o \ + keywords.o c_keywords.o ecpg_keywords.o typename.o descriptor.o variable.o \ $(WIN32RES) # Suppress parallel build to avoid a bug in GNU make 3.82 @@ -36,8 +39,9 @@ all: ecpg ecpg: $(OBJS) | submake-libpgport $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X) -../ecpglib/typename.o: ../ecpglib/typename.c - $(MAKE) -C $(dir $@) $(notdir $@) +# We symlink typename.c from ecpglib and recompile it here +typename.c: % : $(top_srcdir)/src/interfaces/ecpg/ecpglib/% + rm -f $@ && $(LN_S) $< . # See notes in src/backend/parser/Makefile about the following two rules preproc.h: preproc.c @@ -64,6 +68,7 @@ uninstall: clean distclean: rm -f *.o ecpg$(X) + rm -f typename.c # `make distclean' must not remove preproc.y, preproc.c, preproc.h, or pgc.c # since we want to ship those files in the distribution for people with diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index b562044fa71..2921d193a16 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -291,6 +291,7 @@ sub mkvcbuild my $ecpg = $solution->AddProject('ecpg', 'exe', 'interfaces', 'src/interfaces/ecpg/preproc'); $ecpg->AddIncludeDir('src/interfaces/ecpg/include'); + $ecpg->AddIncludeDir('src/interfaces/ecpg/ecpglib'); $ecpg->AddIncludeDir('src/interfaces/libpq'); $ecpg->AddPrefixInclude('src/interfaces/ecpg/preproc'); $ecpg->AddFiles('src/interfaces/ecpg/preproc', 'pgc.l', 'preproc.y'); |