Sujet : Re: Improving build system
De : stefan.news (at) *nospam* arcor.de (Stefan Reuther)
Groupes : comp.arch.embeddedDate : 14. May 2025, 17:06:02
Autres entêtes
Message-ID : <1002m2a.2hg.1@stefan.msgid.phost.de>
References : 1
User-Agent : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 Hamster/2.1.0.1538
Am 13.05.2025 um 17:57 schrieb pozz:
How do you choose toolchain in Makefile? I think one trick is using the
prefix. Usually arm-gcc is arm-none-eabi-gcc.exe, with "arm-none-eabi-"
prefix. Is there other approach?
One idea that I found useful to get out of Makefile madness is to
generate the build scripts.
When you have your build scripts in another language that supports
proper conditionals and subroutines, you have much more freedom in
decisions you make. Also, things like out-of-tree builds are much easier
to control; just spit out a list of "build $objdir/$file.o from
$srcdir/$file.c" instead of making a pattern rule and hoping for the best.
This is the idea behind Make replacements such as ninja, which has
basically no decisionmaking logic built in (unlike Make, which has some
that is awkward).
If you overdo the concept of generating Makefiles, you probably end up
with CMake. But normally, such a generator can be a simple, one-file script.
But if the structure and feature-set of all your compilers is the same,
just the names and options are different, you could also do something
like: put all your build rules into 'rules.mk', make a
'atmel-arm-gnu-debug.mk' that sets all the variables and then does
'include rules.mk', and then build with 'make -f <config>.mk'.
I don't know if I could install arm-gcc in msys2 (I'm quite sure I can
install it in WSL), but for legacy projects I need to use the Atmel
Studio toolchain. How to call Atmel Studio arm toolchain installed in
C:\Program Files
(x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin
from msys shell? Should I change the PATH and use arm-none-eabi- prefix?
That would be personal preference.
I have a slight preference of setting PATH and using a prefix, if I'm
reasonably sure that the tools I'm going to use do not exist anywhere
else on my path by accident.
Stefan