# math/fftw3 - Variable CFLAGS is recursive.



## break19 (Sep 24, 2011)

Output from *make -V* (while not in the fftw3 directory):

```
# make -V CFLAGS
-O2 -fno-strict-aliasing -pipe -march=opteron
```

However, any make command issued from inside /usr/ports/math/fftw3/ returns:

```
# make -V CFLAGS
Variable CFLAGS is recursive.
```
And therefore, math/fftw3 is unable to be processed.


----------



## kpa (Sep 24, 2011)

Can you post the exact commands you're using to build the port and the important parts of the output when things go wrong.


----------



## break19 (Sep 24, 2011)

sure:

```
cd /usr/ports/math/fftw3
make install clean
```
which outputs

```
Variable CFLAGS is recursive.
```


----------



## kpa (Sep 24, 2011)

Do you have anything related to CFLAGS in /etc/make.conf?


----------



## break19 (Sep 24, 2011)

Yep.. it's in the first post, but I will say it again.

```
# make -V CFLAGS
-O2 -fno-strict-aliasing -pipe -march=opteron
```

And, for the record, that was set in make.conf before I installed fftw3 the -first- time on this system. The latest update to ports appears to have broken something for me.


----------



## break19 (Sep 24, 2011)

if you want the actual lines in my make.conf:


```
CPUTYPE?=opteron
CFLAGS= -O2 -fno-strict-aliasing -pipe
```


----------



## kpa (Sep 24, 2011)

The port has an option OPTIMIZED_CFLAGS that should do the same, set that and try again without the CFLAGS line in /etc/make.conf. In general, avoid setting CFLAGS in /etc/make.conf, especially as a global override. 

`# cd /usr/ports/math/fftw3`
`# make config`
`# make install clean`


----------



## break19 (Sep 24, 2011)

if the port now fails to build because of having -anything- set in CFLAGS, when it compiled fine at one time, with the exact same options, that is indicative of a problem with the port's makefile.

Besides, when I comment out CFLAGS, it still fails to build, with the exact same error.. I must also comment out "CPUTYPE" in order to get it to build.

This needs to be fixed in the port, since it appears to be the only one with this issue. Why should I therefore make a change that affects every other port on my system, as a workaround for one broken one?


----------



## break19 (Sep 24, 2011)

After much fiddling with the Makefile for fftw3, I think I've found the offending lines, by commenting out the following line:


```
#CFLAGS+=       ${CFLAGS_3DNOW}
```

This, however, disables some of the optimizations for 3Dnow..


----------



## break19 (Sep 24, 2011)

Ok.. I think I fixed it now.
I changed the above offending line to be:

```
CFLAGS:=        ${CFLAGS_3DNOW}
```
And now the Makefile is correctly parsed, with all optimizations seeming to be correctly applied, without modifying my /etc/make.conf.


----------



## tbyte (Sep 24, 2011)

Same here. Thanks for the fix I'll test it right away  . Btw contact the porter and let him know about this.

Regards.


----------



## luchesar (Sep 25, 2011)

IMHO the problem is not with conflicting CFLAGS in /etc/make.conf, but has rather been caused by this commit from PR ports/157936, which, indeed, unintentionally introduced a recursion in the Makefile of math/fftw3:

```
CFLAGS_3DNOW=   ${CFLAGS:N-O:N-O*} [I][color="Gray"][...snip...][/color][/I]
[I][color="Gray"][...snip...][/color][/I]
CFLAGS+=        ${CFLAGS_3DNOW}
```
Unsurprisingly, the two slave ports, math/fftw3-float & math/fftw3-long, have also been affected. I've submitted a followup to the PR.


----------

