diff mbox

[PLUGIN] compile and install gengtype, install gtype.state

Message ID 4E3A7741.6010405@st.com
State New
Headers show

Commit Message

Romain GEISSLER Aug. 4, 2011, 10:41 a.m. UTC
On 08/04/2011 12:21 PM, Romain Geissler wrote:
> On Mon, Aug 01, 2011 at 02:27:49PM +0200, Romain Geissler wrote:
>> ping
>
> I went ahead and bootstrapped/regtested/and make install tested your patch
> (note your mailer wrapped it up so that it didn't apply cleanly), but now
> that I think about it, it is wrong to put the gengtype binary into
> $(libsubdir)/plugin/bin/
> IMNSHO it should go into
> $(libexecsubdir)/plugin/
> directory instead, libexec is where binaries go...  So please change
> plugin_bindir.
>
>         Jakub
>

Hi,

Find attached the final patch. I can't apply it by myself.

Romain Geissler.
2011-07-18  Romain Geissler  <romain.geissler@gmail.com>

	* gengtype-state.c: Include "bconfig.h" if
	GENERATOR_FILE is defined, "config.h" otherwise.
	* gengtype.c: Likewise.
	* gengtype-lex.l: Likewise.
	* gengtype-parse.c: Likewise.
	* Makefile.in (gengtype-lex.o-warn): New variable.
	(plugin_resourcesdir): Likewise.
	(plugin_bindir): Likewise.
	(plugin_includedir): Use $(plugin_resourcesdir) as prefix base.
	(MOSTLYCLEANFILES): Add gengtype$(exeext).
	(native): Depend on gengtype$(exeext) is $enable_plugin
	is set to "yes".
	(gtype.state): Depend on s-gtype. Use temporary file.
	(gengtype-lex.o): New rule.
	(gengtype-parse.o): Likewise.
	(gengtype-state.o): Likewise.
	(gengtype$(exeext)): Likewise.
	(install-gengtype): Likewise.
	(gengtype.o): Likewise.
	(build/gengtype.o): Depend on version.h.
	(build/gengtype-state): Depend on double-int.h, version.h,
	$(HASHTAB_H), $(OBSTACK_H), $(XREGEX_H) and build/errors.o.
	(install-plugin): Depend on install-gengtype.

Comments

Jakub Jelinek Aug. 4, 2011, 11:31 a.m. UTC | #1
On Thu, Aug 04, 2011 at 12:41:05PM +0200, Romain GEISSLER wrote:
> Find attached the final patch. I can't apply it by myself.

Thanks, committed.

	Jakub
Richard Biener Aug. 4, 2011, 12:30 p.m. UTC | #2
On Thu, Aug 4, 2011 at 1:31 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Aug 04, 2011 at 12:41:05PM +0200, Romain GEISSLER wrote:
>> Find attached the final patch. I can't apply it by myself.
>
> Thanks, committed.

This breaks bootstrap with a ./contrib/gcc_update updated tree because
gengtype-state.c cannot parse

(!version  "4.7.0 20110804 (experimental) [trunk revision 161655]")

please fix.

>        Jakub
>
Richard Biener Aug. 4, 2011, 12:59 p.m. UTC | #3
On Thu, Aug 4, 2011 at 2:30 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Thu, Aug 4, 2011 at 1:31 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Thu, Aug 04, 2011 at 12:41:05PM +0200, Romain GEISSLER wrote:
>>> Find attached the final patch. I can't apply it by myself.
>>
>> Thanks, committed.
>
> This breaks bootstrap with a ./contrib/gcc_update updated tree because
> gengtype-state.c cannot parse
>
> (!version  "4.7.0 20110804 (experimental) [trunk revision 161655]")
>
> please fix.

False alarm - I was confused by seeing libstdc++ build.  The above is
caused by a local VRP patch of mine.

Richard.

>>        Jakub
>>
>
diff mbox

Patch

Index: gcc/gengtype-state.c
===================================================================
--- gcc/gengtype-state.c	(revision 176740)
+++ gcc/gengtype-state.c	(working copy)
@@ -23,7 +23,11 @@ 
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
 
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 #include "errors.h"	/* For fatal.  */
 #include "double-int.h"
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 176740)
+++ gcc/gengtype.c	(working copy)
@@ -18,7 +18,11 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 #include "errors.h"		/* for fatal */
 #include "getopt.h"
Index: gcc/gengtype-lex.l
===================================================================
--- gcc/gengtype-lex.l	(revision 176740)
+++ gcc/gengtype-lex.l	(working copy)
@@ -22,7 +22,11 @@  along with GCC; see the file COPYING3.
 %option noinput
 
 %{
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 
 #define malloc xmalloc
Index: gcc/gengtype-parse.c
===================================================================
--- gcc/gengtype-parse.c	(revision 176740)
+++ gcc/gengtype-parse.c	(working copy)
@@ -17,7 +17,11 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 #include "gengtype.h"
 
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 176741)
+++ gcc/Makefile.in	(working copy)
@@ -192,6 +192,7 @@  GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D
 # be subject to -Werror:
 # flex output may yield harmless "no previous prototype" warnings
 build/gengtype-lex.o-warn = -Wno-error
+gengtype-lex.o-warn = -Wno-error
 # mips-tfile.c contains -Wcast-qual warnings.
 mips-tfile.o-warn = -Wno-error
 expmed.o-warn = -Wno-error
@@ -566,8 +567,12 @@  libexecdir = @libexecdir@
 libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
 # Directory in which the compiler finds executables
 libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
-# Directory in which plugin headers are installed
-plugin_includedir = $(libsubdir)/plugin/include
+# Directory in which all plugin resources are installed
+plugin_resourcesdir = $(libsubdir)/plugin
+ # Directory in which plugin headers are installed
+plugin_includedir = $(plugin_resourcesdir)/include
+# Directory in which plugin specific executables are installed
+plugin_bindir = $(libexecsubdir)/plugin
 # Used to produce a relative $(gcc_tooldir) in gcc.o
 unlibsubdir = ../../..
 # $(prefix), expressed as a path relative to $(libsubdir).
@@ -1531,8 +1536,8 @@  MOSTLYCLEANFILES = insn-flags.h insn-con
  $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
  $(SPECS) collect2$(exeext) lto-wrapper$(exeext) \
  gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
- *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a libcommon-target.a \
- libcommon.a libgcc.mk
+ gengtype$(exeext) *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a \
+ libcommon-target.a libcommon.a libgcc.mk
 
 # Defined in libgcc2.c, included only in the static library.
 LIB2FUNCS_ST = _eprintf __gcc_bcmp
@@ -1792,6 +1797,10 @@  rest.encap: lang.rest.encap
 native: config.status auto-host.h build-@POSUB@ $(LANGUAGES) \
 	$(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(COLLECT2) lto-wrapper$(exeext)
 
+ifeq ($(enable_plugin),yes)
+native: gengtype$(exeext)
+endif
+
 # Define the names for selecting languages in LANGUAGES.
 c: cc1$(exeext)
 
@@ -3838,7 +3847,7 @@  ALL_GTFILES_H := $(sort $(GTFILES_H) $(G
 # write it out to a file (taking care not to do that in a way that
 # overflows a command line!) and then have gengtype read the file in.
 
-$(ALL_GTFILES_H) gtype-desc.c gtype-desc.h : s-gtype ; @true
+$(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gtype.state: s-gtype ; @true
 
 ### Common flags to gengtype [e.g. -v or -B backupdir]
 GENGTYPE_FLAGS= 
@@ -3853,9 +3862,10 @@  s-gtype: build/gengtype$(build_exeext) $
 	 gtyp-input.list
 # First, parse all files and save a state file.
 	$(RUN_GEN) build/gengtype$(build_exeext) $(GENGTYPE_FLAGS) \
-                    -S $(srcdir) -I gtyp-input.list -w gtype.state
+                    -S $(srcdir) -I gtyp-input.list -w tmp-gtype.state
 # Second, read the state file and generate all files.  This ensure that
 # gtype.state is correctly read:
+	$(SHELL) $(srcdir)/../move-if-change tmp-gtype.state gtype.state
 	$(RUN_GEN) build/gengtype$(build_exeext) $(GENGTYPE_FLAGS) \
                     -r gtype.state
 	$(STAMP) s-gtype
@@ -3952,14 +3962,23 @@  build/genextract.o : genextract.c $(RTL_
 build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H)	\
   $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
-build/gengtype-lex.o : gengtype-lex.c gengtype.h $(BCONFIG_H) $(SYSTEM_H)
-build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H)	\
+gengtype-lex.o build/gengtype-lex.o : gengtype-lex.c gengtype.h $(SYSTEM_H)
+gengtype-lex.o: $(CONFIG_H)
+build/gengtype-lex.o: $(BCONFIG_H)
+gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
   $(SYSTEM_H)
-build/gengtype-state.o: gengtype-state.c gengtype.h $(BCONFIG_H)	\
-  $(SYSTEM_H) errors.h
-build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) gengtype.h 	\
-  rtl.def insn-notes.def errors.h double-int.h $(HASHTAB_H)             \
+gengtype-parse.o: $(CONFIG_H)
+build/gengtype-parse.o: $(BCONFIG_H)
+gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
+  gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
+  $(XREGEX_H)
+gengtype-state.o: $(CONFIG_H)
+build/gengtype-state.o: $(BCONFIG_H)
+gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
+  rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
   $(OBSTACK_H) $(XREGEX_H)
+gengtype.o: $(CONFIG_H)
+build/gengtype.o: $(BCONFIG_H)
 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
   errors.h $(READ_MD_H)
 build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h		\
@@ -4003,7 +4022,11 @@  build/genautomata$(build_exeext) : BUILD
 
 # These programs are not linked with the MD reader.
 build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \
-              build/gengtype-state.o build/version.o
+              build/gengtype-state.o build/version.o build/errors.o
+
+gengtype$(exeext) : gengtype.o gengtype-lex.o gengtype-parse.o \
+              gengtype-state.o version.o errors.o $(LIBDEPS)
+	+$(LINKER) $(ALL_LINKERFLAGS) -o $@ $(filter-out ($LIBDEPS), $^) $(LIBS)
 
 # Rule for the generator programs:
 $(genprog:%=build/gen%$(build_exeext)): build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
@@ -4600,8 +4623,15 @@  s-header-vars: Makefile
 	$(SHELL) $(srcdir)/../move-if-change tmp-header-vars b-header-vars
 	$(STAMP) s-header-vars
 
+# Install gengtype
+install-gengtype: installdirs gengtype$(exeext) gtype.state
+	$(mkinstalldirs) $(DESTDIR)$(plugin_resourcesdir)
+	$(INSTALL_DATA) gtype.state $(DESTDIR)$(plugin_resourcesdir)/gtype.state
+	$(mkinstalldirs) $(DESTDIR)$(plugin_bindir)
+	$(INSTALL_PROGRAM) gengtype$(exeext) $(DESTDIR)$(plugin_bindir)/gengtype$(exeext)
+
 # Install the headers needed to build a plugin.
-install-plugin: installdirs lang.install-plugin s-header-vars
+install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
 # We keep the directory structure for files in config or c-family and .def
 # files. All other files are flattened to a single directory.
 	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)