Re: using target-specific variables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux