From: Stefano Lattarini Date: Fri, 31 Aug 2012 23:46:48 +0000 (+0200) Subject: build: simplify and make more portable to non-GNU make X-Git-Tag: v8.20~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59da6f1e6fb5701fe2a78ebe4a7841d0d1b3ef7a;p=thirdparty%2Fcoreutils.git build: simplify and make more portable to non-GNU make The AC_SUBST'd variable '$(NO_INSTALL_PROGS_DEFAULT)' is only used in makefile expressions expanding the list of manual pages that are not built by default (but might need to be when a distribution tarball is created). Such expressions exploited a feature of make variable expansion -- namely, $(VAR:%=dir/%.x) -- that, while seemingly quite portable in practice, is not POSIX-conforming, and could break on lesser vendor make implementations. So kill two birds with one stone, by getting rid of the $(NO_INSTALL_PROGS_DEFAULT) intermediate variable and improving makefile portability in the process. While at it, we also clean up some other minor naming inconsistency and useless indirection. * configure.ac (NO_INSTALL_PROGS_DEFAULT): Don't define or AC_SUBST anymore; instead ... (EXTRA_MANS): ... define and AC_SUBST these. * man/local.mk (extra_man_1): Rename ... (EXTRA_MANS): ... like this, explicitly making clear it's AC_SUBST'd. (extra_man_x): It's used only once, no need to define it; just inline its only expansion where needed. (EXTRA_DIST): Adjust. (ALL_MANS): New, union of $(EXTRA_MANS) and $(dist_man1_MANS). * cfg.mk (check-x-vs-1, sc_option_desc_uppercase): Rely on $(ALL_MANS) rather than on $(NO_INSTALL_PROGS_DEFAULT) and $(dist_man1_MANS). --- diff --git a/cfg.mk b/cfg.mk index 780e6a8974..2323fa3f2e 100644 --- a/cfg.mk +++ b/cfg.mk @@ -198,11 +198,9 @@ sc_long_lines: # One could grep source directly as follows: # grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$') # but that would miss descriptions not on the same line as the -option. -sc_option_desc_uppercase: +sc_option_desc_uppercase: $(ALL_MANS) @grep '^\\fB\\-' -A1 man/*.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' \ && { echo 1>&2 '$@: found initial capitals in --help'; exit 1; } || : -sc_option_desc_uppercase: $(dist_man1_MANS) \ - $(patsubst %,man/%.1,$(NO_INSTALL_PROGS_DEFAULT)) # Ensure all man/*.[1x] files are present. sc_man_file_correlation: check-x-vs-1 check-programs-vs-x @@ -217,8 +215,7 @@ check-x-vs-1: t=$@-t; \ (cd $(srcdir)/man && ls -1 *.x) \ | sed 's/\.x$$//' | $(ASSORT) > $$t; \ - (echo $(patsubst man/%,%,$(dist_man1_MANS)) \ - $(NO_INSTALL_PROGS_DEFAULT) \ + (echo $(patsubst man/%,%,$(ALL_MANS)) \ | tr -s ' ' '\n' | sed 's/\.1$$//') \ | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \ rm $$t diff --git a/configure.ac b/configure.ac index bfc5219a45..43df401b7d 100644 --- a/configure.ac +++ b/configure.ac @@ -439,7 +439,9 @@ MAN=` echo "man/$p.1" done` -NO_INSTALL_PROGS_DEFAULT=$no_install_progs_default +# Not installed by "make install", but must be built when creating +# a distribution tarball. +EXTRA_MANS=`for p in $no_install_progs_default; do echo man/$p.1; done` # The programs built and installed by "make && make install". # Since this is AC_SUBST'd, Automake won't be able to perform rewrite @@ -452,13 +454,13 @@ pkglibexec_PROGRAMS=` # Normalize whitespace. MAN=`echo $MAN` -NO_INSTALL_PROGS_DEFAULT=`echo $NO_INSTALL_PROGS_DEFAULT` +EXTRA_MANS=`echo $EXTRA_MANS` bin_PROGRAMS=`echo $bin_PROGRAMS` pkglibexec_PROGS=`echo $pkglibexec_PROGRAMS` -AC_SUBST([NO_INSTALL_PROGS_DEFAULT]) AC_SUBST([bin_PROGRAMS]) AM_SUBST_NOTMAKE([bin_PROGRAMS]) AC_SUBST([pkglibexec_PROGRAMS]) AM_SUBST_NOTMAKE([pkglibexec_PROGRAMS]) +AC_SUBST([EXTRA_MANS]) AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes]) diff --git a/man/local.mk b/man/local.mk index 80519afcee..f487442911 100644 --- a/man/local.mk +++ b/man/local.mk @@ -23,20 +23,18 @@ man_aux = $(dist_man1_MANS:.1=.x) EXTRA_DIST += $(man_aux) man/help2man MAINTAINERCLEANFILES += $(dist_man1_MANS) -# The "$(VAR:%=dir/%.x)" idiom is not portable according to POSIX, but in -# practice it works with several make implementation (GNU, BSD, CCS make -# from Solaris 10, Sun distributed make). -extra_man_x = $(NO_INSTALL_PROGS_DEFAULT:%=man/%.x) -extra_man_1 = $(NO_INSTALL_PROGS_DEFAULT:%=man/%.1) +EXTRA_MANS = @EXTRA_MANS@ -EXTRA_DIST += $(extra_man_1) $(extra_man_x) +EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x) + +ALL_MANS = $(dist_man1_MANS) $(EXTRA_MANS) # This is required because we have subtle inter-directory dependencies: # in order to generate all man pages, even those for which we don't # install a binary, require that all programs be built at distribution # time. We can't use 'dist-hook' for this, since it would run too late: # the manpages must be generated before the distdir is created and filled. -$(extra_man_1): $(all_programs) +$(EXTRA_MANS): $(all_programs) # Depend on this to get version number changes. mandep = .version