Question

I'm trying to append some text to a variable in a Makefile for HP-UX's version of make.

If i use the "normal" appender, like this:

CFLAGS+=some text

$(CFLAGS) comes out empty.

If i reference the variable, like this:

CFLAGS=$(CFLAGS) some text

make complains about "infinitely recursive macro."

Using a temporary variable like this:

CFLAGStmp=$(CFLAGS)
CFLAGS=$(CFLAGStmp) some text

also complains about an "infinitely recursive macro."

How can i append something to a variable in HP-UX make's Makefile?

Was it helpful?

Solution

Unfortunately it seems that the only solution to this problem is to use GNU make (gmake).

Example:

$ cat >Makefile
FOO=bar
FOO+=baz

all:
    @echo $(FOO)
^D
$ make
bar baz
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top