[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: escape hash mark
From: |
Stefano Lattarini |
Subject: |
Re: escape hash mark |
Date: |
Fri, 19 Aug 2011 20:30:40 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Friday 19 August 2011, Daniel Neuberger wrote:
> Is there any way to reliable escape the hash mark in automake? It seems
> that using += causes multiple expansions and breaks it.
>
> This works:
>
> SOMEVAR = "\# some comment"
>
> This doesn't
>
> SOMEVAR = "\# some comment"
> SOMEVAR += "other stuff"
>
Yes, automake strips what seems like a trailing comment when concatenating
variables, to allow usages like:
EXTRA_DIST = autogen.sh # Bootstrap the package from git checkout.
EXTRA_DIST += HACKING # Coding standards and hints for contributors.
> So my current workaround is:
>
> HASHMARK = $(shell echo "\#")
> SOMEVAR = "$(HASHMARK)some comment"
> SOMEVAR += "other stuff"
>
Does the following works?
HASHMARK = \#
SOMEVAR = "$(HASHMARK)some comment"
SOMEVAR += "other stuff"
Anyway, consider that there is no portable way to place a literal `#' in
a make variable; for example:
$ cat > Makefile <<'END'
foo = \# comment
all:; @echo '$(foo)'
END
$ make # GNU and BSD make implementations work.
# comment
$ make # Solaris make does not.
mksh: Fatal error in reader: Loop detected when expanding macro value `\#
comment
all:; @echo '$(foo)''
Current working directory /tmp
$ cat > Makefile <<'END' # Try in another way.
bar = "#" comment
all:; @echo x'$(bar)'x
END
$ make # Solaris make.
x"x
HTH,
Stefano
- escape hash mark, Daniel Neuberger, 2011/08/19
- Re: escape hash mark,
Stefano Lattarini <=