[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How to make to variants with one makefile?
From: |
James Hsu |
Subject: |
Re: [avr-gcc-list] How to make to variants with one makefile? |
Date: |
Thu, 21 Oct 2004 06:47:04 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 |
Alex Wenger wrote:
I have a c-file with some conditional #ifdefs and
want that when I type "make all" that it will make
t1.hex and t2.hex one with -DVersion1 and the other
with -DVersion2. How can i do that?
This is just one way of doing it...
HEXFILES = t1.hex t2.hex
all: $(HEXFILES)
$(HEXFILES):
echo $(patsubst t%.hex,-DVersion%,$@)
(The % in the first argument matches the number,
the second arg prepends the "-DVersion" to the matched number,
and the third argument specifies the input as the target)
And running this results in:
$ make all
echo -DVersion1
-DVersion1
echo -DVersion2
-DVersion2
James