Discussion:
Automake puts unwanted flags in compilation command
Daniel Campoverde Carrión [Alx741]
2015-12-29 21:42:30 UTC
Permalink
Hello everyone,

I'm trying to use autotools for the first time for a simple microntroller
PIC_DEVICE=18f4550
CC=sdcc
LD=sdcc
FLAGS= --use-non-free -mpic16 -p$(PIC_DEVICE)
AM_CFLAGS = $(FLAGS)
AM_LDFLAGS=
override CFLAGS=
COMPILE=$(CC) $(FLAGS) -c -o
noinst_PROGRAMS = firmware.hex
firmware_hex_SOURCES = firmware.c
* Notice i've tried (with no success) AM_CFLAGS, AM_LDFLAGS, override CFLAGS

I need to compile the code using SDCC compiler with the flags i specified there,
but when i try `make` i got error because of additional flags being added that
make[3]: Entering directory '/home/alx/lab/home_brain/src/firmware'
sdcc --use-non-free -mpic16 -p18f4550 -c -o -MT firmware.o -MD -MP -MF .deps/firmware.Tpo -c -o firmware.o firmware.c
at 1: warning 119: don't know what to do with file '.deps/firmware.Tpo'. file extension unsupported
mv -f .deps/firmware.Tpo .deps/firmware.Po
mv: cannot stat ‘.deps/firmware.Tpo’: No such file or directory
Makefile:308: recipe for target 'firmware.o' failed
make[3]: *** [firmware.o] Error 1
So far using the whole build system is getting my way and i'm getting pretty
discouraged from using it, which is sad. Is there a way to build my firmware
properly without ugly hacks? Should i use plain Makefiles?

Thanks in advance.
--
Daniel Campoverde Carrión [alx741]
GPG key id: 12622B78 (keys.gnupg.net)
http://silly-bytes.blogspot.com/
Gavin Smith
2015-12-29 22:45:22 UTC
Permalink
On 29 December 2015 at 21:42, Daniel Campoverde Carrión [Alx741]
Post by Daniel Campoverde Carrión [Alx741]
Hello everyone,
I'm trying to use autotools for the first time for a simple microntroller
PIC_DEVICE=18f4550
CC=sdcc
LD=sdcc
FLAGS= --use-non-free -mpic16 -p$(PIC_DEVICE)
AM_CFLAGS = $(FLAGS)
AM_LDFLAGS=
override CFLAGS=
COMPILE=$(CC) $(FLAGS) -c -o
noinst_PROGRAMS = firmware.hex
firmware_hex_SOURCES = firmware.c
* Notice i've tried (with no success) AM_CFLAGS, AM_LDFLAGS, override CFLAGS
I don't think override CFLAGS means anything.

Maybe try taking all of this out of Makefile.am and giving this
information on the configure command-line:

./configure CC=sdcc LD=sdcc CFLAGS='--use-non-free -mpic16 -p18f4550'

and so on.
Post by Daniel Campoverde Carrión [Alx741]
I need to compile the code using SDCC compiler with the flags i specified there,
but when i try `make` i got error because of additional flags being added that
Right, I reckon the configure script isn't seeing what you put in
Makefile.am, finds another C compiler and is using flags appropriate
for that compiler. Putting CC=sdcc on the command line will let it
know. (I believe the error message you're getting is to do with the
"dependency style" of the C compiler that was found.)
Daniel Campoverde Carrión [Alx741]
2015-12-30 00:40:44 UTC
Permalink
Post by Gavin Smith
Post by Daniel Campoverde Carrión [Alx741]
PIC_DEVICE=18f4550
CC=sdcc
LD=sdcc
FLAGS= --use-non-free -mpic16 -p$(PIC_DEVICE)
AM_CFLAGS = $(FLAGS)
AM_LDFLAGS=
override CFLAGS=
COMPILE=$(CC) $(FLAGS) -c -o
noinst_PROGRAMS = firmware.hex
firmware_hex_SOURCES = firmware.c
* Notice i've tried (with no success) AM_CFLAGS, AM_LDFLAGS, override CFLAGS
I don't think override CFLAGS means anything.
Maybe try taking all of this out of Makefile.am and giving this
./configure CC=sdcc LD=sdcc CFLAGS='--use-non-free -mpic16 -p18f4550'
and so on.
Thank you for the fast response, wouldn't that use SDCC for the whole project?
The problem is the project consist of C (pc) software and a firmware, so the
bigger part is build with GCC and just the firmware with SDCC.
Post by Gavin Smith
Post by Daniel Campoverde Carrión [Alx741]
I need to compile the code using SDCC compiler with the flags i specified there,
but when i try `make` i got error because of additional flags being added that
Right, I reckon the configure script isn't seeing what you put in
Makefile.am, finds another C compiler and is using flags appropriate
for that compiler. Putting CC=sdcc on the command line will let it
know. (I believe the error message you're getting is to do with the
"dependency style" of the C compiler that was found.)
Oh i see... but how can i compile the code that do need GCC? my code structure
is basically like this:

src/
|
+---app/
|
+---firmware/


`app` is C software (compiled with GCC) but `firmware` is for the
microcontroller (compiled with SDCC).

I want a Makefile.am per directory so `app` and `firmware` are compiled when
*make* is triggered from the project root, everything (including the nested
Makefile.am files) works so far, except for this problem.

So is there a way i should specify this when invoking configure?

Thanks!
--
Daniel Campoverde Carrión [alx741]
GPG key id: 12622B78 (keys.gnupg.net)
http://silly-bytes.blogspot.com/
Basin Ilya
2015-12-30 08:36:18 UTC
Permalink
You can split your project to have 2 configure scripts.

http://www.gnu.org/software/automake/manual/html_node/Subpackages.html
http://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Subdirectories.html

You can either change the default compiler in configure.ac of your
subpackage or you can create a proxy configure that alters the arguments
passed from parent configure.
Post by Daniel Campoverde Carrión [Alx741]
Post by Gavin Smith
Post by Daniel Campoverde Carrión [Alx741]
PIC_DEVICE=18f4550
CC=sdcc
LD=sdcc
FLAGS= --use-non-free -mpic16 -p$(PIC_DEVICE)
AM_CFLAGS = $(FLAGS)
AM_LDFLAGS=
override CFLAGS=
COMPILE=$(CC) $(FLAGS) -c -o
noinst_PROGRAMS = firmware.hex
firmware_hex_SOURCES = firmware.c
* Notice i've tried (with no success) AM_CFLAGS, AM_LDFLAGS, override CFLAGS
I don't think override CFLAGS means anything.
Maybe try taking all of this out of Makefile.am and giving this
./configure CC=sdcc LD=sdcc CFLAGS='--use-non-free -mpic16 -p18f4550'
and so on.
Thank you for the fast response, wouldn't that use SDCC for the whole project?
The problem is the project consist of C (pc) software and a firmware, so the
bigger part is build with GCC and just the firmware with SDCC.
Post by Gavin Smith
Post by Daniel Campoverde Carrión [Alx741]
I need to compile the code using SDCC compiler with the flags i specified there,
but when i try `make` i got error because of additional flags being added that
Right, I reckon the configure script isn't seeing what you put in
Makefile.am, finds another C compiler and is using flags appropriate
for that compiler. Putting CC=sdcc on the command line will let it
know. (I believe the error message you're getting is to do with the
"dependency style" of the C compiler that was found.)
Oh i see... but how can i compile the code that do need GCC? my code structure
src/
|
+---app/
|
+---firmware/
`app` is C software (compiled with GCC) but `firmware` is for the
microcontroller (compiled with SDCC).
I want a Makefile.am per directory so `app` and `firmware` are compiled when
*make* is triggered from the project root, everything (including the nested
Makefile.am files) works so far, except for this problem.
So is there a way i should specify this when invoking configure?
Thanks!
Loading...