Skip to content

Commit 0474dcb

Browse files
committed
Refactor backend makefiles to remove lots of duplicate code
1 parent a74e041 commit 0474dcb

File tree

53 files changed

+137
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+137
-443
lines changed

src/backend/access/Makefile

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
#
22
# Makefile for the access methods module
33
#
4-
# $PostgreSQL: pgsql/src/backend/access/Makefile,v 1.13 2007/02/09 15:55:58 petere Exp $
4+
# $PostgreSQL: pgsql/src/backend/access/Makefile,v 1.14 2008/02/19 10:30:06 petere Exp $
55
#
66

77
subdir = src/backend/access
88
top_builddir = ../../..
99
include $(top_builddir)/src/Makefile.global
1010

1111
SUBDIRS = common gist hash heap index nbtree transam gin
12-
SUBDIROBJS = $(SUBDIRS:%=%/SUBSYS.o)
1312

14-
all: SUBSYS.o
15-
16-
SUBSYS.o: $(SUBDIROBJS)
17-
$(LD) $(LDREL) $(LDOUT) $@ $^
18-
19-
$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
20-
21-
.PHONY: $(SUBDIRS:%=%-recursive)
22-
$(SUBDIRS:%=%-recursive):
23-
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
24-
25-
clean:
26-
for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
27-
rm -f SUBSYS.o
13+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/common/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/common
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.23 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/common/Makefile,v 1.24 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -16,8 +16,4 @@ OBJS = heaptuple.o indextuple.o printtup.o reloptions.o scankey.o tupdesc.o
1616

1717
all: SUBSYS.o
1818

19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
19+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/gin/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/gin
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/gin/Makefile,v 1.2 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/gin/Makefile,v 1.3 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -16,10 +16,4 @@ OBJS = ginutil.o gininsert.o ginxlog.o ginentrypage.o gindatapage.o \
1616
ginbtree.o ginscan.o ginget.o ginvacuum.o ginarrayproc.o \
1717
ginbulk.o
1818

19-
all: SUBSYS.o
20-
21-
SUBSYS.o: $(OBJS)
22-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
23-
24-
clean:
25-
rm -f SUBSYS.o $(OBJS)
19+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/gist/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/gist
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/gist/Makefile,v 1.17 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/gist/Makefile,v 1.18 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -15,10 +15,4 @@ include $(top_builddir)/src/Makefile.global
1515
OBJS = gist.o gistutil.o gistxlog.o gistvacuum.o gistget.o gistscan.o \
1616
gistproc.o gistsplit.o
1717

18-
all: SUBSYS.o
19-
20-
SUBSYS.o: $(OBJS)
21-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
22-
23-
clean:
24-
rm -f SUBSYS.o $(OBJS)
18+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/hash/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/hash
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/hash/Makefile,v 1.13 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/hash/Makefile,v 1.14 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -15,10 +15,4 @@ include $(top_builddir)/src/Makefile.global
1515
OBJS = hash.o hashfunc.o hashinsert.o hashovfl.o hashpage.o hashscan.o \
1616
hashsearch.o hashutil.o
1717

18-
all: SUBSYS.o
19-
20-
SUBSYS.o: $(OBJS)
21-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
22-
23-
clean:
24-
rm -f SUBSYS.o $(OBJS)
18+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/heap/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/heap
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/heap/Makefile,v 1.17 2007/09/20 17:56:30 tgl Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/heap/Makefile,v 1.18 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,10 +14,4 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = heapam.o hio.o pruneheap.o rewriteheap.o syncscan.o tuptoaster.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
17+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/index/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/index
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/index/Makefile,v 1.13 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/index/Makefile,v 1.14 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,10 +14,4 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = genam.o indexam.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
17+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/nbtree/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/nbtree
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/nbtree/Makefile,v 1.15 2007/01/20 17:16:10 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/nbtree/Makefile,v 1.16 2008/02/19 10:30:06 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -15,10 +15,4 @@ include $(top_builddir)/src/Makefile.global
1515
OBJS = nbtcompare.o nbtinsert.o nbtpage.o nbtree.o nbtsearch.o \
1616
nbtutils.o nbtsort.o nbtxlog.o
1717

18-
all: SUBSYS.o
19-
20-
SUBSYS.o: $(OBJS)
21-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
22-
23-
clean:
24-
rm -f SUBSYS.o $(OBJS)
18+
include $(top_srcdir)/src/backend/common.mk

src/backend/access/transam/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for access/transam
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/access/transam/Makefile,v 1.21 2005/06/17 22:32:42 tgl Exp $
7+
# $PostgreSQL: pgsql/src/backend/access/transam/Makefile,v 1.22 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,13 +14,7 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = clog.o transam.o varsup.o xact.o xlog.o xlogutils.o rmgr.o slru.o subtrans.o multixact.o twophase.o twophase_rmgr.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
17+
include $(top_srcdir)/src/backend/common.mk
2418

2519
# ensure that version checks in xlog.c get recompiled when catversion.h changes
2620
xlog.o: xlog.c $(top_srcdir)/src/include/catalog/catversion.h

src/backend/bootstrap/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for the bootstrap module
44
#
5-
# $PostgreSQL: pgsql/src/backend/bootstrap/Makefile,v 1.35 2007/01/20 17:16:11 petere Exp $
5+
# $PostgreSQL: pgsql/src/backend/bootstrap/Makefile,v 1.36 2008/02/19 10:30:07 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -14,10 +14,7 @@ override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
1414

1515
OBJS= bootparse.o bootstrap.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) $@ $^
17+
include $(top_srcdir)/src/backend/common.mk
2118

2219

2320
# bootscanner is compiled as part of bootparse
@@ -50,6 +47,5 @@ bootstrap.o bootparse.o: $(srcdir)/bootstrap_tokens.h
5047
# bootparse.c, bootstrap_tokens.h, and bootscanner.c are in the distribution
5148
# tarball, so they are not cleaned here.
5249
clean:
53-
rm -f SUBSYS.o $(OBJS)
5450
# And the garbage that might have been left behind by partial build:
5551
@rm -f y.tab.h y.tab.c y.output lex.yy.c

src/backend/catalog/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for backend/catalog
44
#
5-
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.65 2007/08/21 01:11:13 tgl Exp $
5+
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.66 2008/02/19 10:30:07 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -17,10 +17,9 @@ OBJS = catalog.o dependency.o heap.o index.o indexing.o namespace.o aclchk.o \
1717

1818
BKIFILES = postgres.bki postgres.description postgres.shdescription
1919

20-
all: SUBSYS.o $(BKIFILES)
20+
include $(top_srcdir)/src/backend/common.mk
2121

22-
SUBSYS.o: $(OBJS)
23-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
22+
all: $(BKIFILES)
2423

2524
# Note: there are some undocumented dependencies on the ordering in which
2625
# the catalog header files are assembled into postgres.bki. In particular,
@@ -67,4 +66,4 @@ uninstall-data:
6766
rm -f $(addprefix '$(DESTDIR)$(datadir)'/, $(BKIFILES) system_views.sql information_schema.sql sql_features.txt)
6867

6968
clean:
70-
rm -f SUBSYS.o $(OBJS) $(BKIFILES)
69+
rm -f $(BKIFILES)

src/backend/commands/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for backend/commands
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.37 2007/08/21 01:11:14 tgl Exp $
7+
# $PostgreSQL: pgsql/src/backend/commands/Makefile,v 1.38 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -21,10 +21,4 @@ OBJS = aggregatecmds.o alter.o analyze.o async.o cluster.o comment.o \
2121
tsearchcmds.o typecmds.o user.o vacuum.o vacuumlazy.o \
2222
variable.o view.o
2323

24-
all: SUBSYS.o
25-
26-
SUBSYS.o: $(OBJS)
27-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
28-
29-
clean:
30-
rm -f SUBSYS.o $(OBJS)
24+
include $(top_srcdir)/src/backend/common.mk

src/backend/common.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Common make rules for backend
3+
#
4+
# $PostgreSQL: pgsql/src/backend/common.mk,v 1.1 2008/02/19 10:30:06 petere Exp $
5+
#
6+
7+
SUBDIROBJS = $(SUBDIRS:%=%/SUBSYS.o)
8+
9+
all: SUBSYS.o
10+
11+
SUBSYS.o: $(SUBDIROBJS) $(OBJS)
12+
$(LD) $(LDREL) $(LDOUT) $@ $^
13+
14+
$(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ;
15+
16+
.PHONY: $(SUBDIRS:%=%-recursive)
17+
$(SUBDIRS:%=%-recursive):
18+
$(MAKE) -C $(subst -recursive,,$@) SUBSYS.o
19+
20+
clean: clean-local
21+
clean-local:
22+
ifdef SUBDIRS
23+
for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
24+
endif
25+
rm -f SUBSYS.o $(OBJS)

src/backend/executor/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for executor
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/executor/Makefile,v 1.26 2007/06/11 01:16:22 tgl Exp $
7+
# $PostgreSQL: pgsql/src/backend/executor/Makefile,v 1.27 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -23,10 +23,4 @@ OBJS = execAmi.o execCurrent.o execGrouping.o execJunk.o execMain.o \
2323
nodeValuesscan.o nodeLimit.o nodeGroup.o \
2424
nodeSubplan.o nodeSubqueryscan.o nodeTidscan.o tstoreReceiver.o spi.o
2525

26-
all: SUBSYS.o
27-
28-
SUBSYS.o: $(OBJS)
29-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
30-
31-
clean:
32-
rm -f SUBSYS.o $(OBJS)
26+
include $(top_srcdir)/src/backend/common.mk

src/backend/lib/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for lib (miscellaneous stuff)
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/lib/Makefile,v 1.20 2007/01/20 17:16:11 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/lib/Makefile,v 1.21 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,10 +14,4 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = dllist.o stringinfo.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
17+
include $(top_srcdir)/src/backend/common.mk

src/backend/libpq/Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for libpq subsystem (backend half of libpq interface)
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/libpq/Makefile,v 1.38 2007/01/20 17:16:11 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/libpq/Makefile,v 1.39 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -17,11 +17,4 @@ include $(top_builddir)/src/Makefile.global
1717
OBJS = be-fsstubs.o be-secure.o auth.o crypt.o hba.o ip.o md5.o pqcomm.o \
1818
pqformat.o pqsignal.o
1919

20-
21-
all: SUBSYS.o
22-
23-
SUBSYS.o: $(OBJS)
24-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
25-
26-
clean:
27-
rm -f SUBSYS.o $(OBJS)
20+
include $(top_srcdir)/src/backend/common.mk

src/backend/main/Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for main
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/main/Makefile,v 1.11 2007/01/20 17:16:11 petere Exp $
7+
# $PostgreSQL: pgsql/src/backend/main/Makefile,v 1.12 2008/02/19 10:30:07 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,10 +14,4 @@ include $(top_builddir)/src/Makefile.global
1414

1515
OBJS = main.o
1616

17-
all: SUBSYS.o
18-
19-
SUBSYS.o: $(OBJS)
20-
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
21-
22-
clean:
23-
rm -f SUBSYS.o $(OBJS)
17+
include $(top_srcdir)/src/backend/common.mk

0 commit comments

Comments
 (0)