Re: $sysconfdir substitution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 June 2016 at 08:05, Peter Johansson <trojkan@xxxxxxxxx> wrote:
> Hi Kip,
>
> I have the following rule in my Makefile.am to generate a C header file.
>
> configmake.h: Makefile
>     $(AM_V_GEN)echo '#define BINDIR "$(bindir)"' > $@
>
> You could have a similar rule to generate a file suitable to source into
> your script.

This works because the variable "bindir" is completely expanded in the
Makefile rules.

The Texinfo project has similar code to substitute for variables in a
AC_CONFIG_FILE-like way in an output file:

do_subst = sed \
  -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
  -e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
  -e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
  -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
  -e 's,[@]prefix[@],$(prefix),g' \
  -e 's,[@]datarootdir[@],$(datarootdir),g' \
  -e 's,[@]datadir[@],$(datadir),g' \
  -e 's,[@]pkglibdir[@],$(pkglibdir),g' \
  -e 's,[@]PACKAGE[@],$(PACKAGE),g' \
  -e 's,[@]USE_EXTERNAL_LIBINTL[@],$(USE_EXTERNAL_LIBINTL),g' \
  -e 's,[@]USE_EXTERNAL_EASTASIANWIDTH[@],$(USE_EXTERNAL_EASTASIANWIDTH),g' \
  -e 's,[@]USE_EXTERNAL_UNIDECODE[@],$(USE_EXTERNAL_UNIDECODE),g' \
  -e 's,[@]TEXINFO_DTD_VERSION[@],$(TEXINFO_DTD_VERSION),g' \
  -e 's,[@]enable_xs[@],$(enable_xs),g' \
  -e '1 s,/usr/bin/env perl,$(PERL),g'

texi2any: texi2any.pl $(top_builddir)/config.status
        $(do_subst) $(srcdir)/texi2any.pl >$@
        chmod a+x $@

The gist of this is that it's using sed to generate one file from
another, substituting in the values of some Makefile variables. I
don't know if it's possible or advisable to use this in combination
with AC_CONFIG_FILES, but using it instead of AC_CONFIG_FILES would
certainly work.

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux