make-alpha
[Top][All Lists]
Advanced

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

Re: CVS psmith make: Various cleanups reported by people using the alpha


From: Greg McGary
Subject: Re: CVS psmith make: Various cleanups reported by people using the alpha release.
Date: 09 Jul 2002 01:49:44 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"Paul D. Smith" <address@hidden> writes:

> ... the whole idea of defining a
> normal prerequisite of a target to be .PHONY is pretty broken (the
> manual specifically recommends against this) so I'm not too worried
> about it.  I rewrote the tests to avoid the issue.

I recently found it useful to make a real file .PHONY, though I don't
rely on $?.

I have a file generated (abstractly) like so:

        .PHONY: $(gen)/version.c
        $(gen)/version.c:
                date '+char version[] = "version x.y.z %Y/%m/%d %H:%M:%S";' >$@

... then a final link rule like so:

        program-objs += $(obj)/version.o

        $(obj)/program: $(program-objs)

... and a rule to compile $(obj)/version.o from $(gen)/version.c

The phonyness of $(gen)/version.c causes it to be remade every time
the dependency graph considers $(obj)/program -> $(obj)/version.o ->
$(gen)/version.c, as desired.

I suppose I could obey the letter of the law by removing .PHONY from
$(gen)/version.c and instead making $(gen)/version.c depend on
something .PHONY, but I see no point, since the .PHONY real file
works.

This is all FYI, in case you wish to include this technique in the
manual, or help me mend my evil ways.  8^)

Greg



reply via email to

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