Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Stefan Reuther Newsgroups: comp.arch.embedded Subject: Re: Improving build system Date: Wed, 14 May 2025 18:06:02 +0200 Lines: 44 Message-ID: <1002m2a.2hg.1@stefan.msgid.phost.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net 4APq4lUhoWeoFSU4P3jzjw2NnfW1+5Z7645YNBM9RXkTrEF5Xj Cancel-Lock: sha1:r6vHO7okACbXePmGdWohLXDTuuc= sha256:f8d762rrSAKq/dSigfCBopI9z1yU1IJIwBxU//xZkqE= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 Hamster/2.1.0.1538 In-Reply-To: Xref: csiph.com comp.arch.embedded:32420 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 .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