Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: OT - managing multi-target projects (linux/NGW)

2011-11-24 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, Mark Nowell <mark@...> wrote:
> Is there a way to drive make/gcc which allows the object files
> and binaries for different targets to be kept alongside each other?
We build for dozens of targets using the same code base, putting object files, libraries and executables in separate directories and/or with distinguishing names.  For example, when building for the mega644P the object files end up as objDir/mega644P/xxx.o and the libraries end up as libDir/libxxx_mega644P.a.  The makefile is set up to create the directories it needs if they don't already exist.  This makes it easy to effectively to a "make clean" for all targets by simply deleting the libDir and objDir directories.

I've created an outline of a makefile that uses these concepts that may give you some ideas.  I may have made some mistakes when I put this together but you should be able to understand the general idea.  You may need to consult the gnu make documentation for a fuller understanding.

http://www.zbasic.net/download/makefile.txt

For some of our projects we use recursive invocation of make (specifying values for certain macro names to control the operation) or we use separate makefiles (a.mak, b.mak, etc.) or a combination of both.  Which to use depends on the circumstances and goals.

Don Kinzer
ZBasic Microcontrollers

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.