From: Tom Tromey <tromey@redhat.com>
To: Andrew STUBBS <andrew.stubbs@st.com>
Cc: gdb@sourceware.org
Subject: Re: Automatic dependency tracking
Date: Thu, 26 Jun 2008 17:30:00 -0000 [thread overview]
Message-ID: <m3vdzwp0k9.fsf@fleche.redhat.com> (raw)
In-Reply-To: <486365E5.50601@st.com> (Andrew STUBBS's message of "Thu\, 26 Jun 2008 10\:48\:21 +0100")
>>>>> "Andrew" == Andrew STUBBS <andrew.stubbs@st.com> writes:
>> Daniel Jacobowitz wrote:
>> Option two: we could require GNU make. GCC has done this for years,
>> but binutils does not; it may be premature.
>> Option three: we could manually list dependencies on generated files,
>> and support dependencies on source files only on systems with GNU
>> make. This effectively means GNU make is a requirement if you are
>> hacking on GDB, but not to build GDB from a clean tree.
Andrew> As I understand it, dependencies on generated files must always be
Andrew> hard coded - otherwise the autogeneration build would fail
Andrew> (potentially, with parallel make being worse), so these two options
Andrew> are the same.
Yeah, this is basically true -- you always have to explicitly mention
the generated headers somewhere.
However, with order-only dependencies, you don't actually need to
maintain these by hand, in the sense of figuring out which objects
depend on which generated headers. Instead you just require that the
generated files all be built before anything else.
Andrew> There is no need to require GNU make for build purposes. It would only
Andrew> be required for dependency tracking. The configure script can be made
Andrew> to disable dependency tracking on incompatible make variants.
You can do this dynamically by creating a GNUMakefile in the build
tree :-). Well, if you don't mind the hackiness of that.
Andrew> BTW, which are the GNU make specific features in question?
'-include', and probably order-only dependencies.
'ifeq' makes it a bit friendlier too, and sometimes new-style pattern
rules (depending on details in the Makefile that I don't remember
right now).
I've appended the relevant code from libcpp's Makefile. libcpp does
not use automake but does implement the dependency tracking bits.
Hmm, reading it now, I see it looks like goo :)
libcpp also has this:
# Dependencies on generated headers have to be explicit.
init.o: localedir.h
But with order-only dependencies I would just write:
$(all_objects): | $(generated_headers)
This does the right thing.
Tom
# Dependency rule.
COMPILE.base = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(ALL_CFLAGS) -c
ifeq ($(DEPMODE),depmode=gcc3)
# Note that we put the dependencies into a .Tpo file, then move them
# into place if the compile succeeds. We need this because gcc does
# not atomically write the dependency output file.
COMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Tpo
POSTCOMPILE = @mv $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
else
COMPILE = source='$<' object='$@' libtool=no DEPDIR=$(DEPDIR) $(DEPMODE) \
$(depcomp) $(COMPILE.base)
# depcomp handles atomicity for us, so we don't need a postcompile
# step.
POSTCOMPILE =
endif
# Implicit rules and I18N
.c.o:
$(COMPILE) $<
$(POSTCOMPILE)
# Dependencies
-include $(patsubst %.o, $(DEPDIR)/%.Po, $(libcpp_a_OBJS) $(makedepend_OBJS))
next prev parent reply other threads:[~2008-06-26 17:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200806152203.14626.pedro@codesourcery.com>
[not found] ` <u3anel69s.fsf@gnu.org>
[not found] ` <20080616012617.GA8944@caradoc.them.org>
[not found] ` <g35201$2uf$2@ger.gmane.org>
[not found] ` <m33an413yx.fsf@fleche.redhat.com>
2008-06-25 18:29 ` Daniel Jacobowitz
2008-06-25 19:30 ` Andreas Schwab
2008-06-25 21:35 ` Stan Shebs
2008-06-26 0:08 ` Tom Tromey
2008-06-26 1:47 ` Joel Brobecker
2008-06-26 9:48 ` Andrew STUBBS
2008-06-26 17:30 ` Tom Tromey [this message]
2008-06-27 10:23 ` Andrew STUBBS
2008-06-27 14:03 ` Daniel Jacobowitz
2008-06-27 16:09 ` Andrew STUBBS
2008-06-27 14:30 ` Tom Tromey
2008-06-28 19:20 ` Mark Kettenis
2008-06-28 19:31 ` Tom Tromey
2008-06-29 14:47 ` Daniel Jacobowitz
2008-06-29 15:36 ` Tom Tromey
2008-06-29 16:26 ` Tom Tromey
2008-06-29 14:42 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3vdzwp0k9.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=andrew.stubbs@st.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox