[U-Boot-Users] Makefile problems

Hello,
as the command constants in cmd_confdefs.h are long longs, the programs in tools that include a board configuration file dont't compile with GCC 2.x. But on a number of workstations the 'gcc' command is still 2.95.x, while the 3.x version is named gcc3, gcc-3 or similar. One way to solve this is to add a line to tools/Makefile like HOSTCC=gcc-3 But now I need a different makefile on different machines. To avoid this, I tried things like $ HOSTCC=gcc-3 make or even $ HOSTCC=gcc-3 make -e but none of these worked. The most elegant version would be to give the HOSTCC at configuration time, i.e. $ HOSTCC=gcc-3 make xyz_config But I have no idea whether this is possible and if so how to implement it.
Any ideas?
Detlef

Detlef Vollmann wrote:
Hello,
as the command constants in cmd_confdefs.h are long longs, the programs in tools that include a board configuration file dont't compile with GCC 2.x. But on a number of workstations the 'gcc' command is still 2.95.x, while the 3.x version is named gcc3, gcc-3 or similar. One way to solve this is to add a line to tools/Makefile like HOSTCC=gcc-3 But now I need a different makefile on different machines. To avoid this, I tried things like $ HOSTCC=gcc-3 make or even $ HOSTCC=gcc-3 make -e but none of these worked. The most elegant version would be to give the HOSTCC at configuration time, i.e. $ HOSTCC=gcc-3 make xyz_config But I have no idea whether this is possible and if so how to implement it.
Any ideas?
Detlef
I'm not sure why "HOSTCC=gcc-3 make -e" isn't working. This should override the declaration in config.mk.
However, you can always try the alternative (better) syntax: make HOSTCC=gcc-3
make -e should be avoided because it causes *all* of your environment variables to override declarations in the Makefile. Using the format above you can explicity override individual variables.
-- Simon Poole www.appliancestudio.com

Simon Poole wrote:
I'm not sure why "HOSTCC=gcc-3 make -e" isn't working. This should override the declaration in config.mk.
However, you can always try the alternative (better) syntax: make HOSTCC=gcc-3
The problem with this is, that I have to remeber that every time I issue the command (and my customers as well). If the first version would work, I could put the variable in the shell startup file.
make -e should be avoided because it causes *all* of your environment variables to override declarations in the Makefile.
I believe that is what I want. The problem with it is that it works recursively: the definitions in the main makefile overide the ones from the sub-makefile. And that causes the sources in the tools directory to be compiled with the CC from the main makefile, which is the cross compiler :-(
Using the format above you can explicity override individual variables.
On each single invocation. And that is what I want to avoid.
Detlef

In message 4288E1F0.52B7590@vollmann.ch you wrote:
make HOSTCC=gcc-3
The problem with this is, that I have to remeber that every time I issue the command (and my customers as well).
You better know exactly what you are doing, so having to remember the correct command is a Good Thing (TM).
If the first version would work, I could put the variable in the shell startup file.
... and run into trouble with other builds failing in "interesting" ways later. No, thanks.
make -e should be avoided because it causes *all* of your environment variables to override declarations in the Makefile.
I believe that is what I want.
You think you want it, but you don't. Really. You DO NOT.
Using the format above you can explicity override individual variables.
On each single invocation. And that is what I want to avoid.
But each single invocation produces results. Maybe different results if you want. Or if you think you want ;-)
"UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." - Doug Gwyn
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
In message 4288E1F0.52B7590@vollmann.ch you wrote:
make HOSTCC=gcc-3
The problem with this is, that I have to remeber that every time I issue the command (and my customers as well).
You better know exactly what you are doing, so having to remember the correct command is a Good Thing (TM).
Hmm, so if my host's C compiler happens to be named gcc, I don't have to remember, but if it happens to be named differently (ncc, como, gcc-3, acc, ...) I need to remember? Strange policy...
If the first version would work, I could put the variable in the shell startup file.
... and run into trouble with other builds failing in "interesting" ways later. No, thanks.
Well, that's the way all the packages using 'configure' work. They pick up whatever is defined in your environment at configure time.
And as I wrote, my most preferred solution would be something like 'HOSTCC=gcc-3 make xyz_config'. To achieve this, a simple line like '[ $HOSTCC ] && echo "HOSTCC = $HOSTCC" >> config.mk' in mkconfig would probably suffice. But maybe there's another (better) way.
Detlef

In message 42897D34.1D5EDE7@vollmann.ch you wrote:
You better know exactly what you are doing, so having to remember the correct command is a Good Thing (TM).
Hmm, so if my host's C compiler happens to be named gcc, I don't have to remember, but if it happens to be named differently (ncc, como, gcc-3, acc, ...) I need to remember? Strange policy...
What is strange about this? You will have to do the same whith about any Makefile I know.
Well, that's the way all the packages using 'configure' work. They pick up whatever is defined in your environment at configure time.
We don't use configure, though.
And as I wrote, my most preferred solution would be something like 'HOSTCC=gcc-3 make xyz_config'. To achieve this, a simple line like '[ $HOSTCC ] && echo "HOSTCC = $HOSTCC" >> config.mk' in mkconfig would probably suffice. But maybe there's another (better) way.
What makes it difficult for you to use
make HOSTCC=gcc-3 xyz_config instead of HOSTCC=gcc-3 make xyz_config ??
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
And as I wrote, my most preferred solution would be something like 'HOSTCC=gcc-3 make xyz_config'. To achieve this, a simple line like '[ $HOSTCC ] && echo "HOSTCC = $HOSTCC" >> config.mk' in mkconfig would probably suffice. But maybe there's another (better) way.
What makes it difficult for you to use
make HOSTCC=gcc-3 xyz_config instead of HOSTCC=gcc-3 make xyz_config ??
Best regards,
Wolfgang Denk
or
MAKEARGS= [ -n "$HOSTCC" ] && MAKEARGS="HOSTCC=$HOSTCC" make $MAKEARGS xyz_config
-- Simon Poole www.appliancestudio.com
participants (3)
-
Detlef Vollmann
-
Simon Poole
-
Wolfgang Denk