make-alpha
[Top][All Lists]
Advanced

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

Going forward.


From: Ramón García
Subject: Going forward.
Date: Tue, 7 Aug 2007 22:23:34 +0200

Since we are somewhat close to the delivery date, I think that we
should start closing things.

I think that the last patch delivered to the mailing list is ready for
applying to the make source code. Otherwise, let me know what should
be changed.

The last code delivered is close to being functionally complete.
Perhaps there should be more testing cases for some of the features.
There are also some things that are not pretty, but I cannot solve
myself without your help. The changes that I would make might have
unexpected effects.

One of the features that I am not completely happy with is
dependencies on values of variables. At present, the user can get this
effect using a combination of .OUT_OF_DATE, delegation of checksum
function to a child and patterns. Here is a sample:

-----------------------------------------------------------------------------------
content-hash=${shell  md5sum $@ | awk '{print $$1}'}

all: a

%.variable: content-hash=${$*}
%.variable: .OUT_OF_DATE=""
%.variable:
         @echo foo

a:.OUT_OF_DATE=${changed-value address@hidden<,${$<::content-hash}}

a: b c d CFLAGS.variable
        cat b c d > a
-------------------------------------------------------------------------------------

The default content-hash function evaluates the md5 sum of the current
target. This function is redefined for targets of the form
<name>.variable, so that the content "hash" is just the value of
${<name>}. In this way, the user can specify that a target depends on
the value of a variable by listing name.variable in its dependencies.

The final user interface is not bad, but part of the mechanism is not
pretty. The target %.variable must have a command associated with it,
otherwise it is not taken into account (in particular, $* is not
defined for it). Defining a pattern without a command is intended to
clear an existing pattern. The execution of the command is prevented
by a value of .OUT_OF_DATE false.

I would prefer if the above makefile could be written as:

-----------------------------------------------------------------------------------
content-hash=${shell  md5sum $@ | awk '{print $$1}'}

all: a

.PHONY: %variable

%.variable: content-hash=${$*}

a:.OUT_OF_DATE=${changed-value address@hidden<,${$<::content-hash}}

a: b c d CFLAGS.variable
        cat b c d > a
-------------------------------------------------------------------------------------

.PHONY: %pattern does not work (is this intended?). Even if this were
changed, phony targets cause their dependents to be remade
unconditionally. In other words. .PHONY: target can be seen as an
alias of target: .OUT_OF_DATE="true". I find this behaviour
surprising, but, on the other hand, changing it in a straightforward
way is not posible because it would break backward compatibility.

Other behaviour which might be dubious is the change in remake.c to
handle .OUT_OF_DATE. There is a lot of code that assumes dependency on
timestamps. It is not possible to change it by a simple interface, as
it would desirable. I modified the code based on the assumption that
the code in update_file_1 dealing with stamps servers two purposes:
optimization (avoiding checking the same timestamp more than once) and
workaround issues with timestamps (such as a file server having
different time than the client). Both these purposes are not posible
or neccessary with .OUT_OF_DATE, and therefore are disabled if custom
out of date handling is enabled for a target. But I am not sure if the
approach followed is the best one, and I suggest you to review it.

Best regards,

Ramon




reply via email to

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