I wrote:
> I noticed while wrapping 9.1beta2 that plpython tries to build a file
> spiexceptions.h to be included in the tarballs, but no such file is
> actually appearing therein. The reason is that src/pl/Makefile doesn't
> recurse into the plpython subdirectory unless with_python is set.
> Which it isn't, because the tarball build script doesn't configure
> --with-python (or with any other options for that matter). If it did,
> it would fail, since there's no python installation on
> developer.postgresql.org.
> I left this go for the moment, since the only implication is that you
> have to have perl available to build plpython from the tarball. But we
> oughta fix it before final. Any opinions on what's the least ugly way
> to get control to recurse to src/pl/plpython for "make distprep"
> regardless of with_python?
> (More generally, I would like to see cleanup targets such as make
> distclean and make maintainer-clean recurse to all subdirectories
> regardless of configure options, but that might be too much to ask for
> right now.)
Attached is a proposed patch to fix this. I found that the general
case was not too hard to solve, so this patch causes the make system
to recurse everywhere for distprep, clean, distclean, maintainer-clean
cases. Anybody have a cleaner way to do it, or want to bikeshed on
the macro names?
regards, tom lane
diff --git a/contrib/Makefile b/contrib/Makefile
index 6967767..0c238aa 100644
*** a/contrib/Makefile
--- b/contrib/Makefile
*************** SUBDIRS = \
*** 52,69 ****
--- 52,77 ----
ifeq ($(with_openssl),yes)
SUBDIRS += sslinfo
+ else
+ ALWAYS_SUBDIRS += sslinfo
endif
ifeq ($(with_ossp_uuid),yes)
SUBDIRS += uuid-ossp
+ else
+ ALWAYS_SUBDIRS += uuid-ossp
endif
ifeq ($(with_libxml),yes)
SUBDIRS += xml2
+ else
+ ALWAYS_SUBDIRS += xml2
endif
ifeq ($(with_selinux),yes)
SUBDIRS += sepgsql
+ else
+ ALWAYS_SUBDIRS += sepgsql
endif
# Missing:
*************** endif
*** 71,73 ****
--- 79,82 ----
$(recurse)
+ $(recurse_always)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index ba08223..3bf658d 100644
*** a/src/Makefile.global.in
--- b/src/Makefile.global.in
***************
*** 19,24 ****
--- 19,26 ----
# Meta configuration
standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check
installcheckmaintainer-check
+ # these targets should recurse even into subdirectories not being built:
+ standard_always_targets = distprep clean distclean maintainer-clean
.PHONY: $(standard_targets) install-strip html man installcheck-parallel
*************** endef
*** 603,608 ****
--- 605,620 ----
# $3: target to run in subdir (defaults to current element of $1)
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))))))
+ # If a makefile's list of SUBDIRS varies depending on configuration, then
+ # any subdirectories excluded from SUBDIRS should instead be added to
+ # ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
+ # This ensures that distprep, distclean, etc will apply to all subdirectories.
+ # In the normal case all arguments will be defaulted.
+ # $1: targets to make recursive (defaults to standard_always_targets)
+ # $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
+ # $3: target to run in subdir (defaults to current element of $1)
+ 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))))))
+
##########################################################################
#
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 3809412..c333a48 100644
*** a/src/bin/Makefile
--- b/src/bin/Makefile
*************** include $(top_builddir)/src/Makefile.glo
*** 15,22 ****
SUBDIRS = initdb pg_ctl pg_dump \
psql scripts pg_config pg_controldata pg_resetxlog pg_basebackup
ifeq ($(PORTNAME), win32)
! SUBDIRS+=pgevent
endif
$(recurse)
--- 15,26 ----
SUBDIRS = initdb pg_ctl pg_dump \
psql scripts pg_config pg_controldata pg_resetxlog pg_basebackup
+
ifeq ($(PORTNAME), win32)
! SUBDIRS += pgevent
! else
! ALWAYS_SUBDIRS += pgevent
endif
$(recurse)
+ $(recurse_always)
diff --git a/src/pl/Makefile b/src/pl/Makefile
index ef630fe..c4a0d1c 100644
*** a/src/pl/Makefile
--- b/src/pl/Makefile
*************** SUBDIRS = plpgsql
*** 16,29 ****
--- 16,36 ----
ifeq ($(with_perl), yes)
SUBDIRS += plperl
+ else
+ ALWAYS_SUBDIRS += plperl
endif
ifeq ($(with_python), yes)
SUBDIRS += plpython
+ else
+ ALWAYS_SUBDIRS += plpython
endif
ifeq ($(with_tcl), yes)
SUBDIRS += tcl
+ else
+ ALWAYS_SUBDIRS += tcl
endif
$(recurse)
+ $(recurse_always)
diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile
index 2c05755..56e06d7 100644
*** a/src/pl/plpython/Makefile
--- b/src/pl/plpython/Makefile
*************** PSQLDIR = $(bindir)
*** 95,110 ****
include $(top_srcdir)/src/Makefile.shlib
- # Force this dependency to be known even without dependency info built:
- plpython.o: spiexceptions.h
-
- spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl
- $(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@
-
all: all-lib
- distprep: spiexceptions.h
-
install: all install-lib install-data
--- 95,102 ----
*************** installcheck: submake prep3
*** 151,163 ****
$(pg_regress_installcheck) --inputdir=./python3 --outputdir=./python3 $(REGRESS_OPTS) $(REGRESS)
clean: clean3
! else
check: submake
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
installcheck: submake
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
! endif
.PHONY: submake
submake:
--- 143,155 ----
$(pg_regress_installcheck) --inputdir=./python3 --outputdir=./python3 $(REGRESS_OPTS) $(REGRESS)
clean: clean3
! else # not Python 3
check: submake
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
installcheck: submake
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
! endif # not Python 3
.PHONY: submake
submake:
*************** ifeq ($(PORTNAME), win32)
*** 170,178 ****
rm -f python${pytverstr}.def
endif
- maintainer-clean: distclean
- rm -f spiexceptions.h
-
else # can't build
all:
--- 162,167 ----
*************** all:
*** 183,185 ****
--- 172,187 ----
echo ""
endif # can't build
+
+ # distprep and maintainer-clean rules should be run even if we can't build.
+
+ # Force this dependency to be known even without dependency info built:
+ plpython.o: spiexceptions.h
+
+ spiexceptions.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-spiexceptions.pl
+ $(PERL) $(srcdir)/generate-spiexceptions.pl $< > $@
+
+ distprep: spiexceptions.h
+
+ maintainer-clean: distclean
+ rm -f spiexceptions.h