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


> I don't think libexec is right for this since these are not executables; I
> think libsubdir instead of libexecsubdir is right.

Fixed.

> I think these files should not be installed for a plugins-disabled build,
> only for a plugins-enabled one.

Fixed. Tested by doing a build with --disable-plugin and a "make install".

> --
> Joseph S. Myers
> joseph@codesourcery.com
>

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

       * Makefile.in (enable_plugin,INSTALL_PLUGIN,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.

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 f4f6764..a0cfc5f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -286,6 +286,14 @@ CLOOGINC = @CLOOGINC@
 # Libs and linker option needed for plugin support
 PLUGINLIBS = @pluginlibs@
 
+enable_plugin = @enable_plugin@
+
+ifeq ($(enable_plugin),yes)
+INSTALL_PLUGIN=install-plugin
+else
+INSTALL_PLUGIN=
+endif
+
 CPPLIB = ../libcpp/libcpp.a
 CPPINC = -I$(srcdir)/../libcpp/include
 
@@ -481,6 +489,10 @@ 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 objects are installed
+plugindir = $(libsubdir)/plugin
+# Directory in which plugin headers are installed
+plugin_includedir = $(plugindir)/include
 # Used to produce a relative $(gcc_tooldir) in gcc.o
 unlibsubdir = ../../..
 # $(prefix), expressed as a path relative to $(libsubdir).
@@ -3970,7 +3982,7 @@ maintainer-clean:
 # broken is small.
 install: install-common $(INSTALL_HEADERS) \
     install-cpp install-man install-info install-@POSUB@ \
-    install-driver
+    install-driver $(INSTALL_PLUGIN)
 
 # Handle cpp installation.
 install-cpp: installdirs cpp$(exeext)
@@ -3986,6 +3998,8 @@ install-cpp: installdirs cpp$(exeext)
 installdirs:
 	$(mkinstalldirs) $(DESTDIR)$(libsubdir)
 	$(mkinstalldirs) $(DESTDIR)$(libexecsubdir)
+	$(mkinstalldirs) $(DESTDIR)$(plugindir)
+	$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	$(mkinstalldirs) $(DESTDIR)$(includedir)
 	$(mkinstalldirs) $(DESTDIR)$(infodir)
@@ -3993,6 +4007,47 @@ 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
+
+# Install plugin-version.o and the headers needed to build a plugin.
+install-plugin: installdirs plugin-version.o
+# We keep the directory structure for files in config and .def files. All
+# other files are flattened to a single directory.
+	$(INSTALL_DATA) plugin-version.o $(DESTDIR)$(plugindir)/plugin-version.o
+	headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\n' | sort -u`; \
+	for file in $$headers; do \
+	  if [ -f $$file ] ; then \
+	    path=`readlink -f $$file`; \
+	  elif [ -f $(srcdir)/$$file ]; then \
+	    path=`readlink -f $(srcdir)/$$file`; \
+	  else true; \
+	  fi; \
+	  if [ "$$path" != "" ]; then \
+	    srcpath=`readlink -f $(srcdir)`; \
+	    buildpath=`readlink -f .`; \
+	    config=$$srcpath/config; \
+	    echo $$path | grep "^$$config" > /dev/null; \
+	    isconfig=$$?; \
+	    echo $$path | grep "\.def$$" > /dev/null; \
+	    isdef=$$?; \
+	    if [ $$isdef = 0 ] || [ $$isconfig = 0 ]; then \
+	      echo $$path | grep "^$$srcpath" > /dev/null; \
+	      if [ $$? = 0 ]; then \
+	        base=`echo $$path | sed "s|$$srcpath||"`; \
+	      else \
+	        base=`echo $$path | sed "s|$$buildpath||"`; \
+	      fi; \
+	      dest=$(plugin_includedir)/$$base; \
+	    else \
+	      dest=$(plugin_includedir)/`basename $$path`; \
+	    fi; \
+	    dir=`dirname $$dest`; \
+	    mkdir -p $$dir; \
+	    $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+	  fi; \
+	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 a2c7032..0bd46be 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]