55# Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
66# Portions Copyright (c) 1994, Regents of the University of California
77#
8- # $PostgreSQL: pgsql/src/backend/Makefile,v 1.125 2008/01/01 19:45:45 momjian Exp $
8+ # $PostgreSQL: pgsql/src/backend/Makefile,v 1.126 2008/02/25 17:55:42 petere Exp $
99#
1010# -------------------------------------------------------------------------
1111
@@ -14,17 +14,17 @@ subdir = src/backend
1414top_builddir = ../..
1515include $(top_builddir ) /src/Makefile.global
1616
17- DIRS = access bootstrap catalog parser commands executor lib libpq \
17+ SUBDIRS = access bootstrap catalog parser commands executor lib libpq \
1818 main nodes optimizer port postmaster regex rewrite \
1919 storage tcop tsearch utils $(top_builddir ) /src/timezone
2020
21- SUBSYSOBJS = $( DIRS:%=%/SUBSYS.o )
21+ include $( srcdir ) /common.mk
2222
2323ifeq ($(enable_dtrace ) , yes)
2424LOCALOBJS += utils/probes.o
2525endif
2626
27- OBJS = $(SUBSYSOBJS ) $(LOCALOBJS ) $(top_builddir ) /src/port/libpgport_srv.a
27+ OBJS = $(SUBDIROBJS ) $(LOCALOBJS ) $(top_builddir ) /src/port/libpgport_srv.a
2828
2929# We put libpgport into OBJS, so remove it from LIBS; also add libldap
3030LIBS := $(filter-out -lpgport, $(LIBS ) ) $(LDAP_LIBS_BE )
@@ -41,7 +41,7 @@ ifneq ($(PORTNAME), win32)
4141ifneq ($(PORTNAME ) , aix)
4242
4343postgres : $(OBJS )
44- $(CC ) $(CFLAGS ) $(LDFLAGS ) $(export_dynamic ) $^ $(LIBS ) -o $@
44+ $(CC ) $(CFLAGS ) $(LDFLAGS ) $(export_dynamic ) $( call expand_subsys, $^ ) $(LIBS ) -o $@
4545
4646endif
4747endif
@@ -51,13 +51,13 @@ ifeq ($(PORTNAME), cygwin)
5151
5252postgres : $(OBJS ) postgres.def libpostgres.a
5353 $(DLLTOOL ) --dllname $@ $(X ) --output-exp $@ .exp --def postgres.def
54- $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $(X ) -Wl,--base-file,$@ .base $@ .exp $(OBJS ) $(LIBS )
54+ $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $(X ) -Wl,--base-file,$@ .base $@ .exp $(call expand_subsys, $( OBJS ) ) $(LIBS )
5555 $(DLLTOOL ) --dllname $@ $(X ) --base-file $@ .base --output-exp $@ .exp --def postgres.def
56- $(CC ) $(CFLAGS ) $(LDFLAGS ) -Wl,--stack,$(WIN32_STACK_RLIMIT ) -o $@ $(X ) $@ .exp $(OBJS ) $(LIBS )
56+ $(CC ) $(CFLAGS ) $(LDFLAGS ) -Wl,--stack,$(WIN32_STACK_RLIMIT ) -o $@ $(X ) $@ .exp $(call expand_subsys, $( OBJS ) ) $(LIBS )
5757 rm -f $@ .exp $@ .base
5858
5959postgres.def : $(OBJS )
60- $(DLLTOOL ) --export-all --output-def $@ $^
60+ $(DLLTOOL ) --export-all --output-def $@ $( call expand_subsys, $^ )
6161
6262libpostgres.a : postgres.def
6363 $(DLLTOOL ) --dllname postgres.exe --def postgres.def --output-lib $@
@@ -69,13 +69,13 @@ LIBS += -lsecur32
6969
7070postgres : $(OBJS ) postgres.def libpostgres.a $(WIN32RES )
7171 $(DLLTOOL ) --dllname $@ $(X ) --output-exp $@ .exp --def postgres.def
72- $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $(X ) -Wl,--base-file,$@ .base $@ .exp $(OBJS ) $(WIN32RES ) $(LIBS )
72+ $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $(X ) -Wl,--base-file,$@ .base $@ .exp $(call expand_subsys, $( OBJS ) ) $(WIN32RES ) $(LIBS )
7373 $(DLLTOOL ) --dllname $@ $(X ) --base-file $@ .base --output-exp $@ .exp --def postgres.def
74- $(CC ) $(CFLAGS ) $(LDFLAGS ) -Wl,--stack=$(WIN32_STACK_RLIMIT ) -o $@ $(X ) $@ .exp $(OBJS ) $(WIN32RES ) $(LIBS )
74+ $(CC ) $(CFLAGS ) $(LDFLAGS ) -Wl,--stack=$(WIN32_STACK_RLIMIT ) -o $@ $(X ) $@ .exp $(call expand_subsys, $( OBJS ) ) $(WIN32RES ) $(LIBS )
7575 rm -f $@ .exp $@ .base
7676
7777postgres.def : $(OBJS )
78- $(DLLTOOL ) --export-all --output-def $@ $^
78+ $(DLLTOOL ) --export-all --output-def $@ $( call expand_subsys, $^ )
7979
8080libpostgres.a : postgres.def
8181 $(DLLTOOL ) --dllname postgres.exe --def postgres.def --output-lib $@
@@ -85,10 +85,10 @@ endif # win32
8585ifeq ($(PORTNAME ) , aix)
8686
8787postgres : $(POSTGRES_IMP )
88- $(CC ) $(CFLAGS ) $(LDFLAGS ) $(OBJS ) -Wl,-bE:$(top_builddir ) /src/backend/$(POSTGRES_IMP ) $(LIBS ) -o $@
88+ $(CC ) $(CFLAGS ) $(LDFLAGS ) $(call expand_subsys, $( OBJS ) ) -Wl,-bE:$(top_builddir ) /src/backend/$(POSTGRES_IMP ) $(LIBS ) -o $@
8989
9090$(POSTGRES_IMP ) : $(OBJS )
91- $(LD ) $(LDREL ) $(LDOUT ) SUBSYS.o $^
91+ $(LD ) $(LDREL ) $(LDOUT ) SUBSYS.o $( call expand_subsys, $^ )
9292ifeq ($(host_os ) , aix3.2.5)
9393 $(MKLDEXPORT) SUBSYS.o $(bindir)/postgres > $@
9494else
@@ -102,19 +102,14 @@ endif
102102
103103endif # aix
104104
105- # Parallel make trickery
106- $(SUBSYSOBJS ) : $(DIRS:%=%-recursive ) ;
107-
108- .PHONY : $(DIRS:%=%-recursive )
109105# Update the commonly used headers before building the subdirectories
110- $(DIRS:% =%-recursive): $(top_builddir ) /src/include/parser/parse.h $(top_builddir ) /src/include/utils/fmgroids.h
111- $(MAKE) -C $(subst -recursive,,$@) all
106+ $(SUBDIRS:% =%-recursive): $(top_builddir ) /src/include/parser/parse.h $(top_builddir ) /src/include/utils/fmgroids.h
112107
113108
114109# The postgres.o target is needed by the rule in Makefile.global that
115110# creates the exports file when MAKE_EXPORTS = true.
116111postgres.o : $(OBJS )
117- $(CC ) $(LDREL ) $(LDFLAGS ) $^ $(LIBS ) -o $@
112+ $(CC ) $(LDREL ) $(LDFLAGS ) $( call expand_subsys, $^ ) $(LIBS ) -o $@
118113
119114
120115# The following targets are specified in make commands that appear in
@@ -141,7 +136,7 @@ $(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
141136 $(LN_S ) ../../../$(subdir ) /utils/fmgroids.h .
142137
143138
144- utils/probes.o : utils/probes.d $(SUBSYSOBJS )
139+ utils/probes.o : utils/probes.d $(SUBDIROBJS )
145140 $(DTRACE ) $(DTRACEFLAGS ) -G -s $^ -o $@
146141
147142
@@ -241,7 +236,6 @@ endif
241236ifeq ($(PORTNAME ) , win32)
242237 rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES)
243238endif
244- for i in $(DIRS); do $(MAKE) -C $$i clean || exit; done
245239
246240distclean : clean
247241 rm -f port/tas.s port/dynloader.c port/pg_sema.c port/pg_shmem.c
@@ -264,4 +258,4 @@ maintainer-clean: distclean
264258# are up to date. It saves the time of doing all the submakes.
265259.PHONY : quick
266260quick : $(OBJS )
267- $(CC ) $(CFLAGS ) $(LDFLAGS ) $(export_dynamic ) $^ $(LIBS ) -o postgres
261+ $(CC ) $(CFLAGS ) $(LDFLAGS ) $(export_dynamic ) $( call expand_subsys, $^ ) $(LIBS ) -o postgres
0 commit comments