bug#25350: Automake does not override CC.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#25350: Automake does not override CC.

william estrada-2
Hello,
I have a Makefile.am that creates a Makefile that does 3 compiles, one for
each target CPU.
 # src/event/Makefile.am
AM_LDLAGS  = --Pedantic -Wall -Std=C99 -O2
bin_PROGRAMS =
include x64.am
include arm.am
include i686.am
---------------------------------------
# src/event/x64.am
bin_PROGRAMS      += event_x64
event_x64_SOURCES  =  event.c
event_x64_CFLAGS   = -m64
---------------------------------------
# src/event/i686.am
bin_PROGRAMS       += event_i686
event_i686_SOURCES  =  event.c
event_i686_CFLAGS   = -m32
---------------------------------------
# src/event/arm.am
bin_PROGRAMS      += event_arm
event_arm_SOURCES  =  event.c
event_arm_CFLAGS   = -DARM
event_arm_CC       =  arm-linux-gnu-gcc
AM_CC              =  arm-linux-gnu-gcc

My problem is my gcc on my Fedora 23 does not support the '-marm', so I
need to change the CC flag.
Using event_arm_CC or AM_CC does not work.

How to change the compiler?

--
William Estrada
Mt Umunhum, CA, USA, Earth
HTTP:// Mt-Umunhum-Wireless.net
Skype: MrUmunhum




Reply | Threaded
Open this post in threaded view
|

bug#25350: Automake does not override CC.

Mathieu Lirzin
tags 25350 notabug
close 25350
thanks

Hello William,

"william estrada" <[hidden email]> writes:

> I have a Makefile.am that creates a Makefile that does 3 compiles, one for
> each target CPU.
>  # src/event/Makefile.am
> AM_LDLAGS  = --Pedantic -Wall -Std=C99 -O2
> bin_PROGRAMS =
> include x64.am
> include arm.am
> include i686.am
> ---------------------------------------
> # src/event/x64.am
> bin_PROGRAMS      += event_x64
> event_x64_SOURCES  =  event.c
> event_x64_CFLAGS   = -m64
> ---------------------------------------
> # src/event/i686.am
> bin_PROGRAMS       += event_i686
> event_i686_SOURCES  =  event.c
> event_i686_CFLAGS   = -m32
> ---------------------------------------
> # src/event/arm.am
> bin_PROGRAMS      += event_arm
> event_arm_SOURCES  =  event.c
> event_arm_CFLAGS   = -DARM
> event_arm_CC       =  arm-linux-gnu-gcc
> AM_CC              =  arm-linux-gnu-gcc
>
> My problem is my gcc on my Fedora 23 does not support the '-marm', so I
> need to change the CC flag.
> Using event_arm_CC or AM_CC does not work.
>
> How to change the compiler?

I don't any experience with cross compilation, but AIUI what you try
to achieve doesn't fit in the Autotools model.

What you have to do is to provide a generic build instruction:

--8<---------------cut here---------------start------------->8---
bin_PROGRAMS = event
event_SOURCES = event.c
--8<---------------cut here---------------end--------------->8---

Then when running './configure' you have to define the "--build",
"--host", and "--target" options according to the architecture you want
compile [1][2].  If you want to automate this process for multiple
architectures, you have to create a script running './configure ... &&
make' multiples times

I am closing this bug.  If you have questions regarding cross
compilation with Automake feel free to ask them on <[hidden email]>.

Thanks.

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

[1] https://www.gnu.org/software/automake/manual/automake.html#Cross_002dCompilation
[2] https://www.gnu.org/software/autoconf/manual/autoconf.html#Specifying-Names