[Top][All Lists]

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

Re: [avr-gcc-list] Make question (how to)

From: Rich Neswold
Subject: Re: [avr-gcc-list] Make question (how to)
Date: Thu, 5 May 2005 16:13:45 -0500
User-agent: Mutt/1.5.6i

Wasn't it  2-May-2005, at 07:50AM, when Larry Barello said:
> target1:
>       MCU=mega128
>       SRC="this.c that.c ..."
>       ASRC="this.S that.S ..."
> target2:
>       MCU=mega16
>       ... etc.
> But this doesn't work.  The SRC and ASRC are not substituted for the default
> ones defined earlier in the makefile (MCU and other symbols are).

I don't run WinAvr, so I don't know which vendor's 'make' you're running.
The following discussion assumes GNU make (or BSD make, for that matter).
If you're using NMAKE.EXE, ignore the rest of this message.

For each line following a target, 'make' spawns a shell and runs it as a
command. Your rules cause several shells to be spawned. Each sets a
variable and then exits. I'm surprised that the MCU variable is working for

> How do I do this?  What is the magic incantation to substitute a list?

In your Makefile:

ifeq (${MCU}, mega128)
  SRC="this.c that.c ..."
  ASRC="this.S that.S ..."
ifeq (${MCU}, mega16)
  SRC="this.c that.c ..."
  ASRC="this.S that.S ..."

Then you can invoke a target like this:

        $ make MCU=mega128

                                          Rich Neswold
                                          AIM : rnezzy
                                          ICQ : 174908475

Attachment: pgpWbjNf7y9gk.pgp
Description: PGP signature

reply via email to

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