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

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

RE: [avr-gcc-list] unknown Make %. behavior


From: Dean Ferreyra
Subject: RE: [avr-gcc-list] unknown Make %. behavior
Date: Mon, 13 Jan 2003 09:29:32 -0800

If the files already exist before you run make, the .o files will _not_ be
deleted.  Maybe this is what you're experiencing?  You can try deleting all
the intermediate files yourself first and then running make to see what
happens.

Dean

-----Original Message-----
From: E. Weddington [mailto:address@hidden
Sent: Monday, January 13, 2003 9:23 AM
To: Dean Ferreyra; Sander Pool; address@hidden
Subject: RE: [avr-gcc-list] unknown Make %. behavior


Sorry to toppost, but I got in on this late....

That's odd. On my machine the .o files *don't* get removed, even with
a makefile construction like the one below. Now I'm not sure why they
*don't* get removed on my machine.

Thanks for pointing this out. I'll see what I can do to correct this
for the next release. My intent was to *not* delete the object files.

Eric


On 13 Jan 2003 at 1:01, Dean Ferreyra wrote:

> I think this:
>
> $(TARGET).elf: $(OBJ)
>  $(COMPILE) $(LDFLAGS) $(OBJ) $(LIBFLAGS) --output $@
>
> is probably the better way to write that particular rule.
>
> As for the deletions, that's how gnu make works.  All the rules in
> that makefile are implicit rules, except this line:
>
> all: $(TARGET).elf
>
> When gnu uses chains of implicit rules to generate a file, the files
> created along the way are considered intermediate files and are
> deleted once the final target is created.  This part:
>
> %.elf: $(OBJ)
>  $(COMPILE) $(LDFLAGS) $(OBJ) $(LIBFLAGS) --output $@
>
> is an implicit pattern rule, too, thanks to the % wildcard.  If the .o
> files don't already exist, and they're not mentioned anywhere else in
> a normal rule, then the .o files will be considered intermediate files
> and will be deleted.
>
> On the other hand, this:
>
> $(TARGET).elf: $(OBJ)
>  $(COMPILE) $(LDFLAGS) $(OBJ) $(LIBFLAGS) --output $@
>
> is a normal rule so now the .o files are not considered intermediate
> files and will remain.
>
> Dean
>
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Sander Pool Sent:
> Sunday, January 12, 2003 8:25 PM To: Avr-Gcc-List Subject:
> [avr-gcc-list] unknown Make %. behavior
>
>
>
> Hi,
>
> it's been quite a few years since I wrote makefiles as part of my job
> and this was on Solaris with Sun make. Far less capable than gmake. So
> I'm a little stumped right now. I use WinAVR on Win2k which comes with
> Gnu-make 3.78.1. The sample makefile that Eric provided with the
> package contains these lines:
>
> .SECONDARY : $(TARGET).elf
> %.elf: $(OBJ)
>  $(COMPILE) $(LDFLAGS) $(OBJ) $(LIBFLAGS) --output $@
>
> The OBJ variable contains the .0 files that make up the project. The
> odd thing is that after the compile/link is done the .o's get removed!
> There is no rule in the makefile to do that. If I change the lines
> above to this:
>
> .SECONDARY : $(TARGET).elf
> $(TARGET).elf: $(OBJ)
>  $(COMPILE) $(LDFLAGS) $(OBJ) $(LIBFLAGS) --output $@
>
> It leaves the .o files alone, as it should.
>
> Does anyone know what's going on? I have attached the whole Makefile
> in case you want to look at it.
>
> Thanks,
>
>  Sander
>
>
> avr-gcc-list at http://avr1.org




avr-gcc-list at http://avr1.org



reply via email to

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