Fix the build and install rules for man pages with SQL section != 7

The previous coding failed in various scenarios possibly including vpath
builds and doing make install without preceding make all.
This commit is contained in:
Peter Eisentraut 2010-04-02 14:02:49 +00:00
parent 31f00d163b
commit a5c317cf78
1 changed files with 10 additions and 20 deletions

View File

@ -2,7 +2,7 @@
#
# PostgreSQL documentation makefile
#
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.139 2010/03/30 00:10:46 petere Exp $
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.140 2010/04/02 14:02:49 petere Exp $
#
#----------------------------------------------------------------------------
@ -313,31 +313,21 @@ fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
-e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
-e '1s/^\.so man7/.so man$(sqlmansectnum)/g;1s/^\(\.so.*\)\.7$$/\1.$(sqlmansect)/g'
nonsql_manpage_files := $(wildcard $(srcdir)/man1/*.1 $(srcdir)/man3/*.3)
sql_manpage_files := $(wildcard $(srcdir)/man7/*.7)
man: fixed-man-stamp
fixed_nonsql_manpage_files = $(patsubst $(srcdir)/%,fixedman/%,$(nonsql_manpage_files))
fixed_sql_manpage_files = $(patsubst $(srcdir)/man7/%.7,fixedman/man$(sqlmansectnum)/%.$(sqlmansect),$(sql_manpage_files))
fixed-man-stamp: man-stamp
@$(MKDIR_P) $(addprefix fixedman/,man1 man3 man$(sqlmansectnum))
for file in $(call vpathsearch,man1)/*.1; do $(fix_sqlmansectnum) $$file >fixedman/man1/`basename $$file` || exit; done
for file in $(call vpathsearch,man3)/*.3; do $(fix_sqlmansectnum) $$file >fixedman/man3/`basename $$file` || exit; done
for file in $(call vpathsearch,man7)/*.7; do $(fix_sqlmansectnum) $$file >fixedman/man$(sqlmansectnum)/`basename $$file | sed s/\.7$$/.$(sqlmansect)/` || exit; done
fixed_manpage_files = $(fixed_nonsql_manpage_files) $(fixed_sql_manpage_files)
man: $(fixed_manpage_files)
$(fixed_nonsql_manpage_files): fixedman/%: %
@$(MKDIR_P) $(dir $@)
$(fix_sqlmansectnum) $< >$@
$(fixed_sql_manpage_files): fixedman/man$(sqlmansectnum)/%.$(sqlmansect): man7/%.7
@$(MKDIR_P) $(dir $@)
$(fix_sqlmansectnum) $< >$@
install-man: man
cp -R $(sort $(dir $(fixed_manpage_files))) '$(DESTDIR)$(mandir)'
install-man:
cp -R $(foreach dir,man1 man3 man$(sqlmansectnum),fixedman/$(dir)) '$(DESTDIR)$(mandir)'
clean: clean-man
.PHONY: clean-man
clean-man:
rm -rf fixedman/
rm -rf fixedman/ fixed-man-stamp
endif # sqlmansectnum != 7