avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: [avr-gcc-list] How to make to variants with one makefile?


From: James Hsu
Subject: Re: OT: [avr-gcc-list] How to make to variants with one makefile?
Date: Mon, 22 Nov 2004 14:15:45 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Anton Erasmus wrote:

I have a single set of source that supports a number of different versions of
a PCB with some differences in capabilities. I also use either an ATmega8 on one
PCB or an ATMega16 or ATMega32 on the other PCBs. Currently I have to define
the MCU as well as one other define in the makefile.

Yikes, thats a fun approach. Then again, the stuff I'm working on is even sloppier...

You really should look at the GNU Make info page. I'm pretty much learning this stuff as I go along and since Make isn't going to go anywhere anytime soon, I figure it's a pretty good investment of time. Anyhow,
try something like this:


PCBOPT = opt1 opt2
MMCU = atmega8 atmega16 atmega32

TARGETS := $(foreach pcbopt, $(PCBOPT), $(foreach mmcu, $(MMCU), $(pcbopt)_$(mmcu)))

tmp:    $(TARGETS)

$(TARGETS):
   @echo address@hidden

which spits out:

address@hidden:~$ make
opt1_atmega8.rom
opt1_atmega16.rom
opt1_atmega32.rom
opt2_atmega8.rom
opt2_atmega16.rom
opt2_atmega32.rom

James




reply via email to

[Prev in Thread] Current Thread [Next in Thread]