[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
under the explained algorithm of re-reading timestamps, how to deal with
From: |
Mark Galeck (CW) |
Subject: |
under the explained algorithm of re-reading timestamps, how to deal with this common situation? |
Date: |
Tue, 3 Apr 2012 06:24:14 -0700 |
Hello,
I think I understand finally how make works, thanks to Paul's excellent
explanation (being better than the manual's :) )
So then this does not work, even with the empty recipe, it won't work, because
make figures out that "foobar.h" could not possibly get updated. I touch
foobar.y, but foobar does not get updated.
This is a problem, because this represents a common scheme, I think. How do
you deal with this situation Paul (so that it "works").
foobar is a goal that depends on dynamically generated prerequisites such as
subdir/foobar.h. At first build after clean, the prerequisites and the rules
to depend on them do not exist, so we need something else to "bootstrap" on,
that's where target "resources" is needed. resources, creates the foobar.h
dynamically in a subdirectory. The rule for foobar then, creates an additional
dynamically generated dependency (like explained in the manual) on
subdir/foobar.h - this dependency is used in the next build. I simplified that
step for this example, so that rule is there to begin with, but I am just
explaining the "origin" of what I am trying to do - Paul always asks for that.
So here is the smallest example, with the origin explained as above:
In Makefile:
.PHONY: resources
resources:
$(MAKE) -C subdir foobar.h
subdir/foobar.h: ; # does not matter
foobar: subdir/foobar.h | resources
touch $@
In subdir/Makefile:
foobar.h: foobar.y
touch $@
So, what is the "canonical" way to handle this common situation?
Mark
- under the explained algorithm of re-reading timestamps, how to deal with this common situation?,
Mark Galeck (CW) <=