Jeffrey Walton <noloa...@gmail.com> writes:

> This is related to Nick and Mathieu's comments about per-object flags
> and use of CXXFLAGS.
>
> When I change the pattern to:
>
>   CPU_FLAG = -msse2
>   libcpu_a_SOURCES = cpu.cpp
>   libcpu_a_CXXFLAGS += $(CPU_FLAG)
>
> I encounter:
>
>   Makefile.am:64: error: libcpu_a_CXXFLAGS must be set with '=' before
> using '+='
>
> I think there are two or three issues with what I am trying to do, and
> the issue with "+=" is only the most prominent symptom.
>
> I think this document may be controlling:
> https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html#Flag-Variables-Ordering.
> The paragraph that starts with "What we recommend is that you define
> extra flags in separate variables...." is especially interesting to
> me. It is interesting because `CPU_FLAG` will eventually need to be
> computed based on the platform. (Eventually we need: i386 gets -msse2;
> x86_64 gets nothing; ARMv7 gets NEON; and PowerPC gets Power4 and
> Altivec; others get nothing).
>
> Please forgive my ignorance, but how do I fix this issue such that it
> won't break when I start computing the value of CPU_FLAG in Autoconf?

Maybe I am overlooking something but using '=' shouldn't cause any issue
event if CPU_FLAG is computed from Autoconf.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

Reply via email to