public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Patrick Palka <patrick@parcs.ath.cx>
To: gdb-patches@sourceware.org
Cc: Patrick Palka <patrick@parcs.ath.cx>
Subject: [PATCH] gdb: replace suffix rules with pattern rules
Date: Sun, 12 Jan 2014 21:56:00 -0000	[thread overview]
Message-ID: <1389563743-29311-1-git-send-email-patrick@parcs.ath.cx> (raw)

Suffix rules (e.g. .c.o:) are error-prone and may not interact well with
GNU make's -r/--no-builtin-rules flag.  Replace them with
otherwise-equivalent pattern rules (e.g. %.o: %.c).

Since we no longer rely on suffix rules, we can also remove references
to the magic .SUFFIXES target.

As a result of this change, one can now successfully build gdb/ with
make's -r flag which improves build time by a bit.
---
 gdb/ChangeLog             |  5 +++++
 gdb/Makefile.in           | 12 +++++-------
 gdb/gdbserver/Makefile.in |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d5006ea..e2ab527 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-12  Patrick Palka  <patrick@parcs.ath.cx>
+
+	* Makefile.in: Remove references to .SUFFIXES target.  Replace
+	suffix rules with corresponding pattern rules.
+
 2014-01-10  Patrick Palka  <patrick@parcs.ath.cx>
 
 	* regformats/regdat.sh: Always rewrite the register file.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 824b26b..3627e0e 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -992,7 +992,7 @@ DISTSTUFF = $(YYFILES)
 generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \
 	$(GNULIB_H) $(NAT_GENERATED_FILES) gcore
 
-.c.o:
+%.o: %.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -1621,7 +1621,6 @@ ada-exp.o: ada-exp.c
 # Rules for generating translated message descriptions.  Disabled by
 # autoconf if the tools are not available.
 
-.SUFFIXES: .po .gmo .pox .pot
 .PHONY: all-po install-po uninstall-po clean-po update-po $(PACKAGE).pot
 
 all-po: $(CATALOGS)
@@ -1632,14 +1631,14 @@ update-po: $(CATALOGS:.gmo=.pox)
 
 # N.B. We do not attempt to copy these into $(srcdir).  The snapshot
 # script does that.
-.po.gmo:
+%.gmo: %.po
 	-test -d po || mkdir po
 	$(GMSGFMT) --statistics -o $@ $<
 
 # The new .po has to be gone over by hand, so we deposit it into
 # build/po with a different extension.  If build/po/$(PACKAGE).pot
 # exists, use it (it was just created), else use the one in srcdir.
-.po.pox:
+%.pox: %.po
 	-test -d po || mkdir po
 	$(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \
 			then echo po/$(PACKAGE).pot; \
@@ -1700,8 +1699,7 @@ po/$(PACKAGE).pot: force
 # Strictly speaking c-exp.c should therefore depend on
 # Makefile.in, but that was a pretty big annoyance.
 
-.SUFFIXES: .y .l
-.y.c:
+%.c: %.y
 	rm -f $@ $@.tmp
 	$(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
 		|| (rm -f $@; false)
@@ -1717,7 +1715,7 @@ po/$(PACKAGE).pot: force
 	     -e "s/^\(#line.*\)`basename $<`/\1`echo $<|sed 's/\//\\\\\//g'`/" \
 	  < $@.tmp > $@
 	rm -f $@.tmp
-.l.c:
+%.c: %.l
 	if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
 	    $(FLEX) -o$@ $< && \
 	    rm -f $@.new && \
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index b58184d..0f62ca4 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -234,7 +234,7 @@ FLAGS_TO_PASS = \
 # All generated files which can be included by another file.
 generated_files = config.h $(GNULIB_H)
 
-.c.o:
+%.o: %.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-- 
1.8.5.2

             reply	other threads:[~2014-01-12 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12 21:56 Patrick Palka [this message]
2014-01-13 19:45 ` Tom Tromey
2014-01-14  1:18   ` Patrick Palka
2014-01-14  2:55     ` Tom Tromey

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=1389563743-29311-1-git-send-email-patrick@parcs.ath.cx \
    --to=patrick@parcs.ath.cx \
    --cc=gdb-patches@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).