Skip to content
Snippets Groups Projects
Commit 19e231bb authored by Peter Eisentraut's avatar Peter Eisentraut
Browse files

Improved parallel make support

Replace for loops in makefiles with proper dependencies.  Parallel
make can now span across directories.  Also, make -k and make -q work
properly.

GNU make 3.80 or newer is now required.
parent d6754f67
No related branches found
No related tags found
No related merge requests found
...@@ -14,5 +14,4 @@ include $(top_builddir)/src/Makefile.global ...@@ -14,5 +14,4 @@ include $(top_builddir)/src/Makefile.global
SUBDIRS = libpq ecpg SUBDIRS = libpq ecpg
all install installdirs uninstall distprep clean distclean maintainer-clean: $(recurse)
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
...@@ -2,19 +2,13 @@ subdir = src/interfaces/ecpg ...@@ -2,19 +2,13 @@ subdir = src/interfaces/ecpg
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
all install installdirs uninstall distprep: SUBDIRS = include pgtypeslib ecpglib compatlib preproc
$(MAKE) -C include $@
$(MAKE) -C pgtypeslib $@ $(recurse)
$(MAKE) -C ecpglib $@
$(MAKE) -C compatlib $@ all-compatlib-recursive: all-ecpglib-recursive
$(MAKE) -C preproc $@
clean distclean maintainer-clean: clean distclean maintainer-clean:
$(MAKE) -C include $@
$(MAKE) -C pgtypeslib $@
$(MAKE) -C ecpglib $@
$(MAKE) -C compatlib $@
$(MAKE) -C preproc $@
$(MAKE) -C test clean $(MAKE) -C test clean
check checktcp installcheck: all check checktcp installcheck: all
......
...@@ -23,6 +23,7 @@ override CFLAGS += $(PTHREAD_CFLAGS) ...@@ -23,6 +23,7 @@ override CFLAGS += $(PTHREAD_CFLAGS)
SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \ SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
$(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS) $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
SHLIB_PREREQS = submake-ecpglib submake-pgtypeslib
SHLIB_EXPORTS = exports.txt SHLIB_EXPORTS = exports.txt
...@@ -33,6 +34,14 @@ OBJS= informix.o $(filter snprintf.o, $(LIBOBJS)) ...@@ -33,6 +34,14 @@ OBJS= informix.o $(filter snprintf.o, $(LIBOBJS))
all: all-lib all: all-lib
.PHONY: submake-ecpglib submake-pgtypeslib
submake-ecpglib:
$(MAKE) -C $(top_builddir)/src/interfaces/ecpg/ecpglib all
submake-pgtypeslib:
$(MAKE) -C $(top_builddir)/src/interfaces/ecpg/pgtypeslib all
# Shared library stuff # Shared library stuff
include $(top_srcdir)/src/Makefile.shlib include $(top_srcdir)/src/Makefile.shlib
......
...@@ -34,6 +34,7 @@ OBJS += thread.o ...@@ -34,6 +34,7 @@ OBJS += thread.o
endif endif
SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS) SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS)
SHLIB_PREREQS = submake-libpq submake-pgtypeslib
SHLIB_EXPORTS = exports.txt SHLIB_EXPORTS = exports.txt
...@@ -42,12 +43,10 @@ ifeq ($(PORTNAME), win32) ...@@ -42,12 +43,10 @@ ifeq ($(PORTNAME), win32)
SHLIB_LINK += -lshfolder SHLIB_LINK += -lshfolder
endif endif
all: libpq pgtypeslib all-lib all: all-lib
libpq: .PHONY: submake-pgtypeslib
$(MAKE) -C $(top_builddir)/src/interfaces/libpq all submake-pgtypeslib:
pgtypeslib:
$(MAKE) -C $(top_builddir)/src/interfaces/ecpg/pgtypeslib all $(MAKE) -C $(top_builddir)/src/interfaces/ecpg/pgtypeslib all
# Shared library stuff # Shared library stuff
......
...@@ -30,11 +30,14 @@ OBJS= preproc.o type.o ecpg.o output.o parser.o \ ...@@ -30,11 +30,14 @@ OBJS= preproc.o type.o ecpg.o output.o parser.o \
keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \ keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \
$(WIN32RES) $(WIN32RES)
all: submake-libpgport ecpg all: ecpg
ecpg: $(OBJS) ecpg: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X) $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
../ecpglib/typename.o: ../ecpglib/typename.c
$(MAKE) -C $(dir $@) $(notdir $@)
# pgc is compiled as part of preproc # pgc is compiled as part of preproc
preproc.o: pgc.c preproc.o: pgc.c
......
...@@ -26,12 +26,4 @@ ifeq ($(with_tcl), yes) ...@@ -26,12 +26,4 @@ ifeq ($(with_tcl), yes)
SUBDIRS += tcl SUBDIRS += tcl
endif endif
all install installdirs uninstall distprep clean distclean maintainer-clean: $(recurse)
@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
# We'd like check operations to run all the subtests before failing.
check installcheck:
@CHECKERR=0; for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
done; \
exit $$CHECKERR
...@@ -50,9 +50,9 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \ ...@@ -50,9 +50,9 @@ EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
# Build regression test driver # Build regression test driver
all: submake-libpgport pg_regress$(X) all: pg_regress$(X)
pg_regress$(X): pg_regress.o pg_regress_main.o pg_regress$(X): pg_regress.o pg_regress_main.o | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@ $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
# dependencies ensure that path changes propagate # dependencies ensure that path changes propagate
...@@ -131,8 +131,6 @@ $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX): $(top_builddir ...@@ -131,8 +131,6 @@ $(top_builddir)/contrib/dummy_seclabel/dummy_seclabel$(DLSUFFIX): $(top_builddir
# Tablespace setup # Tablespace setup
all: tablespace-setup
.PHONY: tablespace-setup .PHONY: tablespace-setup
tablespace-setup: tablespace-setup:
rm -rf ./testtablespace rm -rf ./testtablespace
...@@ -145,13 +143,13 @@ tablespace-setup: ...@@ -145,13 +143,13 @@ tablespace-setup:
pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) $(NOLOCALE) pg_regress_call = ./pg_regress --inputdir=$(srcdir) --dlpath=. --multibyte=$(MULTIBYTE) $(NOLOCALE)
check: all check: all tablespace-setup
$(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF) $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(TEMP_CONF)
installcheck: all installcheck: all tablespace-setup
$(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule
installcheck-parallel: all installcheck-parallel: all tablespace-setup
$(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT)
standbycheck: all standbycheck: all
...@@ -163,10 +161,10 @@ runcheck: check ...@@ -163,10 +161,10 @@ runcheck: check
runtest: installcheck runtest: installcheck
runtest-parallel: installcheck-parallel runtest-parallel: installcheck-parallel
bigtest: all bigtest: all tablespace-setup
$(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule numeric_big $(pg_regress_call) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule numeric_big
bigcheck: all bigcheck: all tablespace-setup
$(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big $(pg_regress_call) --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) numeric_big
......
...@@ -35,7 +35,7 @@ endif ...@@ -35,7 +35,7 @@ endif
include $(top_srcdir)/src/backend/common.mk include $(top_srcdir)/src/backend/common.mk
ifeq (,$(with_system_tzdata)) ifeq (,$(with_system_tzdata))
all: submake-libpgport zic all: zic
endif endif
# We could do this test in the action section: # We could do this test in the action section:
...@@ -46,7 +46,7 @@ ifeq (,$(ZIC)) ...@@ -46,7 +46,7 @@ ifeq (,$(ZIC))
ZIC= ./zic ZIC= ./zic
endif endif
zic: $(ZICOBJS) zic: $(ZICOBJS) | submake-libpgport
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
install: all installdirs install: all installdirs
......
...@@ -16,9 +16,9 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) ...@@ -16,9 +16,9 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= findoidjoins.o OBJS= findoidjoins.o
all: submake-libpq submake-libpgport findoidjoins all: findoidjoins
findoidjoins: findoidjoins.o $(libpq_builddir)/libpq.a findoidjoins: findoidjoins.o | submake-libpq submake-libpgport
$(CC) $(CFLAGS) findoidjoins.o $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) findoidjoins.o $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
clean distclean maintainer-clean: clean distclean maintainer-clean:
......
...@@ -16,9 +16,9 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) ...@@ -16,9 +16,9 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= test_fsync.o OBJS= test_fsync.o
all: submake-libpq submake-libpgport test_fsync all: test_fsync
test_fsync: test_fsync.o $(libpq_builddir)/libpq.a test_fsync: test_fsync.o | submake-libpq submake-libpgport
$(CC) $(CFLAGS) test_fsync.o $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) test_fsync.o $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
clean distclean maintainer-clean: clean distclean maintainer-clean:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment