This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gdb: replace suffix rules with pattern rules


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]