autoconf
[Top][All Lists]
Advanced

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

Re: Define a complete rule via autoconf (quoting issue, AC_SUBST)


From: Ralf Wildenhues
Subject: Re: Define a complete rule via autoconf (quoting issue, AC_SUBST)
Date: Tue, 28 Oct 2008 07:50:52 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Daniel,

* Daniel Leidert wrote on Mon, Oct 27, 2008 at 11:04:34PM CET:
> 
> I want to place a rule in several Makefiles. So I thought about putting
> 
> @DESKTOP_DATA_RULE@
> 
> into every Makefile.am and define the rule via configure.ac. However, I
> can't get it to work.

Should be possible with recent Autoconf.  If you also use Automake,
however, you need to get it to not add
  DESKTOP_DATA_RULE = @DESKTOP_DATA_RULE@

into the Makefile.in.  Currently, that is only possible through an
undocumented Automake macro, _AM_SUBST_NOTMAKE([DESKTOP_DATA_RULE]).
The intention is to fix that for the next Automake release.

If you still have problems after this, please show what you tried,
and what's output, and the error.

Besides the workarounds already mentioned, other possibilities include
Automake conditionals.

> $(desktop_DATA): $(desktop_in_files:.desktop.in=.desktop)
>       @list='$<'; for p in $$list; do \

Please note that using $< outside of inference rules requires GNU make.

>            if test -f "$$p" ; then \
>                f=`echo "$$p" | sed 
> 's/.desktop$$//;$(transform);s/$$/.desktop/'`; \
>                if ! test -f "$$f" ; then \

"! CMD" is not portable; in this case you can replace it with portable
  if test ! -f ...

>                    $(LN_S) "$$p" "$$f" ; \
>                    echo "$(LN_S) '$$p' '$$f'" ; \
>                fi ; \

For portability to older BSD make implementations, which use 'sh -ec'
for executing commands, you could add 'else :;' branches to your if
clauses, to avoid unwanted error here.

>            fi ; \
>        done

Hope that helps.

Cheers,
Ralf




reply via email to

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