help-make
[Top][All Lists]
Advanced

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

Re: outputting which dependencies triggered a target action


From: Greg Chicares
Subject: Re: outputting which dependencies triggered a target action
Date: Fri, 19 Aug 2005 22:16:44 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2005-8-19 18:38 UTC, Noel Yap wrote:
> Is there an option less verbose than --debug that outputs which
> dependencies triggered a target action?

I've been doing something that I guess is similar to Shawn's idea,
but doesn't require order dependencies.

My goal was automatically to maintain a file that knows when the
system was actually built. Printing which dependencies mattered
turned out to be an easy side effect to add.

This part of 'GNUmakefile' is boilerplate from one of Paul's
white papers:

MAKETARGET = \
  $(MAKE) \
    -C $@ \
    -f $(src_dir)/workhorse.make \
    --no-print-directory \
  $(MAKECMDGOALS)

.PHONY: $(build_directory)
$(build_directory): build.hpp
        address@hidden -d $@ ] || $(MKDIR) --parents $@
        address@hidden(MAKETARGET)

% :: $(build_directory) ;

...except for the 'build.hpp' dependency, whose rule is

prerequisite_files := $(wildcard *.c *.h)

build.hpp: $(filter-out $@,$(prerequisite_files))
        @$(ECHO) These files are more recent than '$@': $?
        # command to echo current date into 'build.hpp'

I haven't tested this extremely condensed version of the actual
makefile I used in production, but I figure this is enough for
you to judge whether the technique can be adapted to meet your
needs. It's just a derivative of this idea from the manual:

| print all the `.c' files that have changed since the
| last time you printed them:
|
| print: *.c
|         lpr -p $?
|         touch print




reply via email to

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