On 09/27/2010 06:13 PM, Blue Swirl wrote:
Indeed, see how it's done for config-*.h.
# Uses generic rule in rules.mak
trace.h: trace.h-timestamp
trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak
$(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h< $< >
$@," GEN trace.h)
@cmp $@ trace.h>/dev/null 2>&1 || cp $@ trace.h
(untested).
I just copied the rule from %/config-devices.mak. Is also that rule
then incorrect?
config-devices.mak will cause the Makefile to be reread, but no
recompilations, so it's fine not to use a timestamp file. Headers are
more complicated.
Perhaps there could be a macro for this, not unlike move-if-change
script in various GNU packages?
The problem is not really the move-if-change script, but rather the
timestamping rules. You can use $(eval) for that but it quickly becomes
unmanageable.
Paolo