]> granicus.if.org Git - postgresql/commitdiff
Fix the build and install rules for man pages with SQL section != 7
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 2 Apr 2010 14:02:49 +0000 (14:02 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 2 Apr 2010 14:02:49 +0000 (14:02 +0000)
The previous coding failed in various scenarios possibly including vpath
builds and doing make install without preceding make all.

doc/src/sgml/Makefile

index 1777ceb2aec00c2fe71a348278b3b1fb709878ea..c5133b7d9bb59637195c136ff4db20e1a2d5e798 100644 (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