Operating System - HP-UX
1752777 Members
6171 Online
108789 Solutions
New Discussion юеВ

Make: infinitely recursive macro

 
Speedware
Frequent Advisor

Make: infinitely recursive macro

Hello,

I am trying to do the following in a makefile
I want to know if the following is valid because it work on hpux 11.00 but not on hpux 11.11 or 11.22. I am getting the following error:
Make: infinitely recursive macro?. Stop.

PATH=/home/speedware:${PATH}
all: test
test:


Because I want to add directory to the Environment variable PATH in my makefile
How would I do that ? (if its possibable )
6 REPLIES 6
Manish Srivastava
Trusted Contributor

Re: Make: infinitely recursive macro

Hi,

This is not allowed. This fails as PATH is not defined before substitution.

manish
Steve Steel
Honored Contributor

Re: Make: infinitely recursive macro

Hi


Indeed

PATH is defined as itself. Thus making this an "infinitely recursive
macro", which cannot be expanded, so the make operation fails.


PATH=/home/speedware:$PATH is probably what you mean

Steve Steel


If you want truly to understand something, try to change it. (Kurt Lewin)
Speedware
Frequent Advisor

Re: Make: infinitely recursive macro

But what I find weird is that it use to work on hpux 11.00 ???

Does anyone know if something was fix at one point in make ?

Also
PATH=/home/speedware:$PATH does not work since Make report $P as the variable and ATH as incorrect variable.
Ermin Borovac
Honored Contributor

Re: Make: infinitely recursive macro

Not sure if this used to work on 11.00, but if you use GNU make and define your variable with ':=' it should work the way you wanted it to.

PATH := /home/speedware:${PATH}

Speedware
Frequent Advisor

Re: Make: infinitely recursive macro

Thanks for the tips.

That work in GNU make. The only problem is the fact that we are linking our product at installation time. I need a standard way of doing this so its going to work on all platform without depending on extra software.
A. Clay Stephenson
Acclaimed Contributor

Re: Make: infinitely recursive macro

Your PATH macro is definitely infinitely recursive and you are relying on quirks of particular makes to work. A much more portable method would be something like this placed in all your makefiles.

PATH=`/usr/local/speedpath.sh`


The speedpath.sh command would do something like this:

#!/usr/bin/sh
PATH=/home/speedpath:${PATH}
echo ${PATH}
exit 0
If it ain't broke, I can fix that.