[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: |
Anton Erasmus |
Subject: |
Re: [avr-gcc-list] How to make to variants with one makefile? |
Date: |
Sat, 20 Nov 2004 22:42:36 +0200 |
On 21 Oct 2004 at 6:47, James Hsu wrote:
> 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
>
Hi,
I finaly got around to test this suggestion. I changed the makefile to
HEXFILES = t1.hex t2.hex
all: $(HEXFILES)
$(HEXFILES):
echo $(patsubst t%.hex,-DVersion%,$@) $@
This gives
echo -DVersion1 t1.hex
-DVersion1 t1.hex
echo -DVersion2 t2.hex
-DVersion2 t2.hex
I am looking for a makefile construct that would give the following:
echo -DVersion1 t1.hex
-DVersion1 t1.hex
echo -DVersion1 t2.hex
-DVersion1 t2.hex
echo -DVersion2 t1.hex
-DVersion2 t1.hex
echo -DVersion2 t2.hex
-DVersion2 t2.hex
Does anybody have a suggestion of how to get make to do the above with a
single make command ?
Regards
Anton Erasmus
--
A J Erasmus
- Re: [avr-gcc-list] How to make to variants with one makefile?,
Anton Erasmus <=