automake
[Top][All Lists]
Advanced

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

Re: replacement of variable placeholders in files


From: Jason Curl
Subject: Re: replacement of variable placeholders in files
Date: Wed, 22 Aug 2007 12:23:38 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Dizzy wrote:
Hi

I have an input file named project.conf.in in which I have some variable placeholders of the form ${VARIABLE}. I am trying to use sed to replace them with some actual contents so I have added a make rule in Makefile.am such as:

project.conf:project.conf.in $(top_builddir)/config.status
$(SED) -e 'address@hidden/@'"${localstatedir}/@g" $(top_srcdir)/conf/project.conf.in > $@
Instead of having the Makefile do this for you, why not during 'configure' time with the AC_CONFIG_FILES? And then define the variable substitutions as part of the configure script? Even define a macro if you want to logically separate everything.

e.g.

AC_CONFIG_FILES([project.conf
    Makefile
    subdir/Makefile])
Notice that I first have a string with single quotes so I tell bash to not deal with ${LOCALSTATEDIR} then I have a string with double quotes so bash can replace the ${localstatedir} variable contents and no space between which seems to work well if I run that command in shell.

However I think that configure replaces the ${LOCALSTATEDIR} from the generated Makefile.in with "" (because there is no such variable so it puts an empty string) and ignores my single quotes.

Any idea how to implement such a make rule that should replace variable placeholders with contents of actual variables?

Thanks!






reply via email to

[Prev in Thread] Current Thread [Next in Thread]