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: [trunk][patch] Install headers and plugin-version.o


> Without a ChangeLog I cannot understand the config.gcc parts.

Sorry, forgot to mention that the ChangeLog was still the same:

2009-04-21  Rafael Avila de Espindola  <espindola@google.com>

       * Makefile.in (plugindir,plugin_includedir): New.
       (install): Depend on install-plugin.
       (installdirs): Create plugindir and plugin_includedir.
       (PLUGIN_HEADERS): New.
       (install-plugin): New.
       * config.gcc: Add vxworks-dummy.h to tm_file for x86 and x86-64.

vxworks-dummy.h is included from i386.h but was not listed anywhere in the
Makefile.

> This:
>
>> + Â Â Â if [ "$$path" != "" ]; then \
>
> can use a leftover $$path from the previous iteration; reset it in the
> preceding "else", or use "continue".

Changed to use continue.

> may fail depending on set -e, it seems easier to use case and $$file
> like this:
>
> case $$path in \
> Â"$(srcdir)"*/config/* | "$(srcdir)*.def ) base=$$file;; \
> Â*) base=`basename $$path` ;; \
> esac; \
> dest=$(plugin_includedir)/$$base; \
> dir=`dirname $$dest`; \
> $(mkinstalldirs) $$dir; \
> $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
>
> or something like that; also notice that I used mkinstalldirs instead of

Updated.

>> mkdir -p $$dir
>
> which is exactly what mkinstalldirs replaces, though portably.

Updated.

> Finally, regarding
>
>> +ifeq ($(enable_plugin),yes)
>> +INSTALL_PLUGIN=install-plugin
>> +else
>> +INSTALL_PLUGIN=
>> +endif
>
> you can just move it down and say
>
> ifeq ($(enable_plugin),yes)
> install: install-plugin
> endif

Updated.

A new patch is attached. Thanks a lot!

> Paolo
>

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 0e13e49..d8531d8 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -286,6 +286,8 @@ CLOOGINC = @CLOOGINC@
 # Libs and linker option needed for plugin support
 PLUGINLIBS = @pluginlibs@
 
+enable_plugin = @enable_plugin@
+
 CPPLIB = ../libcpp/libcpp.a
 CPPINC = -I$(srcdir)/../libcpp/include
 
@@ -481,6 +483,8 @@ 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
 # Used to produce a relative $(gcc_tooldir) in gcc.o
 unlibsubdir = ../../..
 # $(prefix), expressed as a path relative to $(libsubdir).
@@ -3973,6 +3977,10 @@ install: install-common $(INSTALL_HEADERS) \
     install-cpp install-man install-info install-@POSUB@ \
     install-driver
 
+ifeq ($(enable_plugin),yes)
+install: install-plugin
+endif
+
 # Handle cpp installation.
 install-cpp: installdirs cpp$(exeext)
 	-rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
@@ -3994,6 +4002,35 @@ installdirs:
 	$(mkinstalldirs) $(DESTDIR)$(man1dir)
 	$(mkinstalldirs) $(DESTDIR)$(man7dir)
 
+PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+  $(TOPLEV_H) $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_PASS_H) gcc-plugin.h intl.h \
+  $(PLUGIN_VERSION_H)
+
+# Install the headers needed to build a plugin.
+install-plugin: installdirs
+# We keep the directory structure for files in config and .def files. All
+# other files are flattened to a single directory.
+	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+	headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\n' | sort -u`; \
+	for file in $$headers; do \
+	  if [ -f $$file ] ; then \
+	    path=$$file; \
+	  elif [ -f $(srcdir)/$$file ]; then \
+	    path=$(srcdir)/$$file; \
+	  else continue; \
+	  fi; \
+	  case $$path in \
+	  "$(srcdir)"*/config/* | "$(srcdir)"*.def ) \
+	    base=`echo $$path | sed "s|$(srcdir)||"`;; \
+	  *) base=`basename $$path` ;; \
+	  esac; \
+	  dest=$(plugin_includedir)/$$base; \
+	  echo foobar $$file $$path $$dest; \
+	  dir=`dirname $$dest`; \
+	  $(mkinstalldirs) $$dir; \
+	  $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+	done
+
 # Install the compiler executables built during cross compilation.
 install-common: native lang.install-common installdirs
 	for file in $(COMPILERS); do \
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 856a70b..503babe 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -375,12 +375,14 @@ i[34567]86-*-*)
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
+	tm_file="vxworks-dummy.h ${tm_file}"
 	;;
 x86_64-*-*)
 	tm_file="i386/biarch64.h ${tm_file}"
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
+	tm_file="vxworks-dummy.h ${tm_file}"
 	;;
 esac
 

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