[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: .PHONY and .SECONDARY interaction in make 3.81: bug/feature?
From: |
Alexey Neyman |
Subject: |
Re: .PHONY and .SECONDARY interaction in make 3.81: bug/feature? |
Date: |
Tue, 15 Mar 2005 19:15:06 +0300 |
User-agent: |
KMail/1.6.2 |
A little more info:
revision 1.69 made .SECONDARY target not only set the 'all_secondary'
variable to 1, but also sets ->intermediate flag on all files.
Therefore, the check_dep() function in remake.c doesn't notice that
version.c needs to be rebuilt unconditionally.
The following patch solves the problem. No regressions introduced on
i686-pc-linux-gnu (Fedora Core 2).
*** remake.c.orig 2005-03-15 19:07:49.213951064 +0300
--- remake.c 2005-03-15 19:01:25.309097872 +0300
*************** check_dep (struct file *file, unsigned i
*** 908,914 ****
++depth;
start_updating (file);
! if (!file->intermediate)
/* If this is a non-intermediate file, update it and record
whether it is newer than THIS_MTIME. */
{
--- 908,914 ----
++depth;
start_updating (file);
! if (!file->intermediate || file->phony)
/* If this is a non-intermediate file, update it and record
whether it is newer than THIS_MTIME. */
{
Regards,
Alexey.
On Tuesday 15 March 2005 18:50, Alexey Neyman wrote:
> I tried make 3.81beta2, and its behavior differed from make 3.80 for
> some of my Makefiles I used. I tracked the problem to the following
> testcase:
>
> ======= Makefile ========
> OBJS = main.o version.o
> all: main
> clean:
> rm -f main $(OBJS) version.c
>
> date_stamp := $(shell LANG=C date)
>
> .SECONDARY:
> .PHONY: version.c
> version.c:
> @echo "Creating address@hidden"
> @echo "const char *version=\"$(date_stamp)\";" > $@
>
> %.o: %.c
> gcc -c -o $@ $<
>
> main: $(OBJS)
> gcc -o $@ $^
> =========================
>
> The 1st "make all" does what's expected with both make 3.80 and make
> 3.81: rebuilds the 'main' binary. However, if "make all" is issued
> again, make 3.80 rebuilds version.c and all files that depend on it
> (version.o, main). Make 3.81beta2, however, considers it up-to-date
> and doesn't rebuild anything.
>
> I didn't find anything in the description of the .SECONDARY that
> states such behavior.
>
> This behavior was introduced by the revision 1.69 of the 'file.c'
> file. The description says that it fixes bug #2515, but that bug
ends
> with a sentence "I'll look at this more carefully." by Paul Smith.
> I am not sure which .SECONDARY behavior is right.
>
> PS. I know that .SECONDARY is pointless in this makefile, this
> testcase was snipped from a much larger project.
>
> Regards,
> Alexey.
>
> --
> We seek not to invade, but to pervade. There is a difference.
> -- Arilou, SC2
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>
--
Do not ask favors of people you routinely ambush and murder.
-- Spathi captain Fwiffo, SC2