This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: (build) Patch to fix cp/cfns.gperf building issues


> We have a --enable-maintainer-mode configure option.

Thanks - I had missed that option.  It's an excellent suggestion - here is
a new patch that uses it. :-)

Ok to commit ?

Thanks

PS: Regarding how I detect --enable-maintainer-mode in this new patch, cp/Make-lang.in
is used at it is, without going through configure, so I can't use @MAINT@ in it.  I
can't use MAINT either, because it's always empty.  I added a FIXME as the intention
in the code was probably different.

I could actually fix MAINT to end up being exactly '#' when --disable-maintainer-mode
is used, but why would we want that ?  It would be a literal value, which you can't
use to comment out bits of code in the same way as you can with @MAINT@.  Of course,
people may still try, and waste time trying to figure out why it doesn't work.

It just doesn't make sense; you can't comment out make code by putting a variable
with a value of '#' in front of something.  If you ask me, I'd just remove the MAINT
variable altogether - it's a bad idea and would/will confuse people.

I added a new readable variable instead, ENABLE_MAINTAINER_RULES, which is 'true' or
empty, so you can do

ifeq ($(ENABLE_MAINTAINER_RULES), true)
  ... maintainer rules ...
endif

which is readable, expressive, simple and robust.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 172860)
+++ ChangeLog   (working copy)
@@ -1,3 +1,7 @@
+2011-04-22  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * Makefile.in (ENABLE_MAINTAINER_RULES): New.
+
 2011-04-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/48716
Index: cp/Make-lang.in
===================================================================
--- cp/Make-lang.in     (revision 172860)
+++ cp/Make-lang.in     (working copy)
@@ -104,10 +104,15 @@ cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $
        +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
              $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
 
-# Special build rules.
+ifeq ($(ENABLE_MAINTAINER_RULES), true)
+# Special build rule.  This is a maintainer rule, that is only
+# available when GCC is configured with --enable-maintainer-mode.  In
+# other cases, it is not available to avoid triggering rebuilds if a
+# user has the source checked out with unusual timestamps.
 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
        gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
-               $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
+               $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+endif
 
 #^L
 # Build hooks:
Index: cp/ChangeLog
===================================================================
--- cp/ChangeLog        (revision 172860)
+++ cp/ChangeLog        (working copy)
@@ -1,3 +1,10 @@
+2011-04-23  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * Make-lang.in ($(srcdir)/cp/cfns.h): Enable the rule only in
+       maintainer mode.  Use the --output-file option of gperf instead of
+       > to prevent creating an empty cp/cfns.h when gperf is not
+       available.
+
 2011-04-20  Jason Merrill  <jason@redhat.com>
 
        * semantics.c (finish_compound_literal): Don't put an array
Index: Makefile.in
===================================================================
--- Makefile.in (revision 172860)
+++ Makefile.in (working copy)
@@ -165,8 +165,19 @@ C_STRICT_WARN = @c_strict_warn@
 NOCOMMON_FLAG = @nocommon_flag@
 
 # This is set by --disable-maintainer-mode (default) to "#"
+# FIXME: 'MAINT' will always be set to an empty string, no matter if
+# --disable-maintainer-mode is used or not.  This is because the
+# following will expand to "MAINT := " in maintainer mode, and to
+# "MAINT := #" in non-maintainer mode, but because '#' starts a comment,
+# they mean exactly the same thing for make.
 MAINT := @MAINT@
 
+# The following provides the variable ENABLE_MAINTAINER_RULES that can
+# be used in language Make-lang.in makefile fragments to enable
+# maintainer rules.  So, ENABLE_MAINTAINER_RULES is 'true' in
+# maintainer mode, and '' otherwise.
+@MAINT@ ENABLE_MAINTAINER_RULES = true
+
 # These are set by --enable-checking=valgrind.
 RUN_GEN = @valgrind_command@
 VALGRIND_DRIVER_DEFINES = @valgrind_path_defines@



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