Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit acb9198

Browse files
committed
Make distprep and *clean build targets recurse into all subdirectories.
Certain subdirectories do not get built if corresponding options are not selected at configure time. However, "make distprep" should visit such directories anyway, so that constructing derived files to be included in the tarball happens without requiring all configure options to be given in the tarball build script. Likewise, it's better if cleanup actions unconditionally visit all directories (for example, this ensures proper cleanup if someone has done a manual make in such a subdirectory). To handle this, set up a convention that subdirectories that are conditionally included in SUBDIRS should be added to ALWAYS_SUBDIRS instead when they are excluded. Back-patch to 9.1, so that plpython's spiexceptions.h will get provided in 9.1 tarballs. There don't appear to be any instances where distprep actions got missed in previous releases, and anyway this fix requires gmake 3.80 so we don't want to apply it before 9.1.
1 parent 19b7fac commit acb9198

File tree

5 files changed

+48
-14
lines changed

5 files changed

+48
-14
lines changed

contrib/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,31 @@ SUBDIRS = \
5252

5353
ifeq ($(with_openssl),yes)
5454
SUBDIRS += sslinfo
55+
else
56+
ALWAYS_SUBDIRS += sslinfo
5557
endif
5658

5759
ifeq ($(with_ossp_uuid),yes)
5860
SUBDIRS += uuid-ossp
61+
else
62+
ALWAYS_SUBDIRS += uuid-ossp
5963
endif
6064

6165
ifeq ($(with_libxml),yes)
6266
SUBDIRS += xml2
67+
else
68+
ALWAYS_SUBDIRS += xml2
6369
endif
6470

6571
ifeq ($(with_selinux),yes)
6672
SUBDIRS += sepgsql
73+
else
74+
ALWAYS_SUBDIRS += sepgsql
6775
endif
6876

6977
# Missing:
7078
# start-scripts \ (does not have a makefile)
7179

7280

7381
$(recurse)
82+
$(recurse_always)

src/Makefile.global.in

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# Meta configuration
2020

2121
standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck maintainer-check
22+
# these targets should recurse even into subdirectories not being built:
23+
standard_always_targets = distprep clean distclean maintainer-clean
2224

2325
.PHONY: $(standard_targets) install-strip html man installcheck-parallel
2426

@@ -603,6 +605,16 @@ endef
603605
# $3: target to run in subdir (defaults to current element of $1)
604606
recurse = $(foreach target,$(if $1,$1,$(standard_targets)),$(foreach subdir,$(if $2,$2,$(SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
605607

608+
# If a makefile's list of SUBDIRS varies depending on configuration, then
609+
# any subdirectories excluded from SUBDIRS should instead be added to
610+
# ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
611+
# This ensures that distprep, distclean, etc will apply to all subdirectories.
612+
# In the normal case all arguments will be defaulted.
613+
# $1: targets to make recursive (defaults to standard_always_targets)
614+
# $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
615+
# $3: target to run in subdir (defaults to current element of $1)
616+
recurse_always = $(foreach target,$(if $1,$1,$(standard_always_targets)),$(foreach subdir,$(if $2,$2,$(ALWAYS_SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
617+
606618

607619
##########################################################################
608620
#

src/bin/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ include $(top_builddir)/src/Makefile.global
1515

1616
SUBDIRS = initdb pg_ctl pg_dump \
1717
psql scripts pg_config pg_controldata pg_resetxlog pg_basebackup
18+
1819
ifeq ($(PORTNAME), win32)
19-
SUBDIRS+=pgevent
20+
SUBDIRS += pgevent
21+
else
22+
ALWAYS_SUBDIRS += pgevent
2023
endif
2124

2225
$(recurse)
26+
$(recurse_always)

src/pl/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ SUBDIRS = plpgsql
1616

1717
ifeq ($(with_perl), yes)
1818
SUBDIRS += plperl
19+
else
20+
ALWAYS_SUBDIRS += plperl
1921
endif
2022

2123
ifeq ($(with_python), yes)
2224
SUBDIRS += plpython
25+
else
26+
ALWAYS_SUBDIRS += plpython
2327
endif
2428

2529
ifeq ($(with_tcl), yes)
2630
SUBDIRS += tcl
31+
else
32+
ALWAYS_SUBDIRS += tcl
2733
endif
2834

2935
$(recurse)
36+
$(recurse_always)

src/pl/plpython/Makefile

+15-13
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,8 @@ PSQLDIR = $(bindir)
9595

9696
include $(top_srcdir)/src/Makefile.shlib
9797

98-
# Force this dependency to be known even without dependency info built:
99-
plpython.o: spiexceptions.h
100-
101-
spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl
102-
$(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@
103-
10498
all: all-lib
10599

106-
distprep: spiexceptions.h
107-
108100

109101
install: all install-lib install-data
110102

@@ -151,13 +143,13 @@ installcheck: submake prep3
151143
$(pg_regress_installcheck) --inputdir=./python3 --outputdir=./python3 $(REGRESS_OPTS) $(REGRESS)
152144

153145
clean: clean3
154-
else
146+
else # not Python 3
155147
check: submake
156148
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
157149

158150
installcheck: submake
159151
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
160-
endif
152+
endif # not Python 3
161153

162154
.PHONY: submake
163155
submake:
@@ -170,9 +162,6 @@ ifeq ($(PORTNAME), win32)
170162
rm -f python${pytverstr}.def
171163
endif
172164

173-
maintainer-clean: distclean
174-
rm -f spiexceptions.h
175-
176165
else # can't build
177166

178167
all:
@@ -183,3 +172,16 @@ all:
183172
echo ""
184173

185174
endif # can't build
175+
176+
# distprep and maintainer-clean rules should be run even if we can't build.
177+
178+
# Force this dependency to be known even without dependency info built:
179+
plpython.o: spiexceptions.h
180+
181+
spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl
182+
$(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@
183+
184+
distprep: spiexceptions.h
185+
186+
maintainer-clean: distclean
187+
rm -f spiexceptions.h

0 commit comments

Comments
 (0)