[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using target-specific variables?
From: |
Ralf Wildenhues |
Subject: |
Re: using target-specific variables? |
Date: |
Thu, 12 May 2005 12:26:58 +0200 |
User-agent: |
Mutt/1.4.1i |
Hi Harald,
* Harald Dunkel wrote on Thu, May 12, 2005 at 10:45:40AM CEST:
>
> How can I use target-specific variables in Makefiles
> generated by Automake?
In general, that is not possible.
For specific variables, like CFLAGS, CPPFLAGS, you may do this by using
target_CFLAGS = ...
> My Makefile.am says something like
>
> lib_LIBRARIES = libmylib.a libmylib_gcc3.a
>
> libmylib_a_SOURCES = foo.c bar.c
> libmylib_gcc3_a_SOURCES = $(libmylib_a_SOURCES)
so in this case that would be
libmylib_a_CFLAGS
but for the compiler (CC, CXX, ..) this is not implemented.
Rationale: if you change the compiler, you most likely need to have a
separate configuration (configure, configure.ac) for it. That may be
achieved by using a subpackage (see Automake docs on this subject).
There is a workaround, however: you can override the value of CC in a
Makefile.am. I use this, for example, to invoke a compiler wrapper
(mpicc) in one subdir, and use the compiler itself in all others.
The subpackage solution is much safer, however.
> libmylib_gcc3.a: CC=gcc3
This will not work. It states that libmylib_gcc3.a depends on a file
called "CC=gcc3", I believe, from recalling portable `make' syntax.
Regards,
Ralf