----- Original Message ----- > From: "Eric Blake" <[email protected]> > To: "GNU Automake mailing list" <[email protected]> > Cc: "Federico Simoncelli" <[email protected]> > Sent: Thursday, January 12, 2012 8:16:14 PM > Subject: RFC: cool hack for simplifying do_subst generation of scripts > > [...] > > diff --git i/Makefile.am w/Makefile.am > index 8fe9c0f..0ef39c1 100644 > --- i/Makefile.am > +++ w/Makefile.am > @@ -67,21 +67,11 @@ uninstall-hook: > done > > > -## We can't use configure to do the substitution here; we must do it > -## by hand. We use a funny notation here to avoid configure > -## substitutions in our text. > +## We want a handful of substitutions to be fully-expanded by make; > +## then use config.status to substitute the remainder where a single > +## expansion is sufficient. We use a funny notation here to avoid > +## configure substitutions in our text. > do_subst = sed \ > - -e 's,[@]APIVERSION[@],$(APIVERSION),g' \ > - -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ > - -e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \ > - -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \ > - -e 's,[@]PATH_SEPARATOR[@],$(PATH_SEPARATOR),g' \ > - -e 's,[@]PERL[@],$(PERL),g' \ > - -e 's,[@]PERL_THREADS[@],$(PERL_THREADS),g' \ > - -e 's,[@]SHELL[@],$(SHELL),g' \ > - -e 's,[@]am_AUTOCONF[@],$(am_AUTOCONF),g' \ > - -e 's,[@]am_AUTOM4TE[@],$(am_AUTOM4TE),g' \ > - -e 's,[@]VERSION[@],$(VERSION),g' \ > -e 's,[@]configure_input[@],Generated from [email protected]; do not edit by > hand.,g' \ > -e 's,[@]datadir[@],$(datadir),g' > > @@ -92,7 +82,7 @@ automake: automake.in > aclocal: aclocal.in > automake aclocal: Makefile > rm -f $@ [email protected] > - $(do_subst) $(srcdir)/[email protected] >[email protected] > + $(do_subst) $(srcdir)/[email protected] | ./config.status --file=- >[email protected] > chmod +x [email protected] > chmod a-w [email protected] > mv -f [email protected] $@
This is not enough when you use it in subdirectories, you should add config.log to CLEANFILES to pass distcheck. Probably it would be best if config.status didn't produce a log when it's used with --file=-; the content is rather useless in that case. -- Federico
