This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Install drivers from gcc/Makefile.in
- From: "Rafael EspÃndola" <rafael dot espindola at gmail dot com>
- To: "Andrew Pinski" <pinskia at physics dot uc dot edu>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Jul 2006 22:13:08 -0300
- Subject: Re: [PATCH] Install drivers from gcc/Makefile.in
- References: <564d96fb0607131741g8a3c742se8f65e0a84e9d747@mail.gmail.com> <FB999A7D-972D-4ED6-BB4D-96326564CEDF@physics.uc.edu>
:ADDPATCH build:
Can you add documentation to the internals manual about this change?
Sure. It's attached.
Thanks,
Andrew Pinski
Best Regards,
Rafael
2006-07-14 Rafael Ãvila de EspÃndola <rafael.espindola@gmail.com>
* gcc/java/Make-lang.in (DRIVERS): New
(java.install-common): Don't Install the driver
* gcc/cp/Make-lang.in (DRIVERS): New
(c++.install-common): Don't install the driver
* gcc/fortran/Make-lang.in (DRIVERS): New
(fortran.install-common): Don't install the driver
* gcc/treelang/Make-lang.in (DRIVERS): New
(treelang.install.common.done): Don't install the driver
* gcc/Makefile.in (DRIVERS): New
(LANG_INSTALL_COMMONS): New
(install-drivers): New
* gcc/doc/sourcebuild.texi (Make-lang.in): Update
Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi (revision 115296)
+++ gcc/doc/sourcebuild.texi (working copy)
@@ -569,7 +569,7 @@ build those targets (which may if necess
specified in @code{outputs} in @file{config-lang.in}, although this is
deprecated). It also adds any testsuite targets that can use the
standard rule in @file{gcc/Makefile.in} to the variable
-@code{lang_checks}.
+@code{lang_checks} and compiler drivers to the variable @code{DRIVERS}.
@table @code
@itemx all.cross
@@ -599,7 +599,7 @@ optional and the tools involved may be i
@item install-common
Install everything that is part of the front end, apart from the
compiler executables listed in @code{compilers} in
-@file{config-lang.in}.
+@file{config-lang.in} and compiler drivers listed in @code{DRIVERS}.
@item install-info
Install info documentation for the front end, if it is present in the
source directory. This target should have dependencies on info files
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in (revision 115296)
+++ gcc/java/Make-lang.in (working copy)
@@ -40,6 +40,8 @@
# - the compiler proper (eg: jc1)
# - define the names for selecting the language in LANGUAGES.
+DRIVERS += gcj
+
# Actual names to use when installing a native compiler.
JAVA_INSTALL_NAME := $(shell echo gcj|sed '$(program_transform_name)')
JAVA_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcj|sed '$(program_transform_name)')
@@ -199,19 +201,7 @@ check-java :
# portable makefiles for both cross builds (where gcjh *must*
# be explicitly prefixed) and native builds.
java.install-common: installdirs
- -if [ -f $(GCJ)$(exeext) ]; then \
- rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
- if [ -f $(GCJ)-cross$(exeext) ]; then \
- true; \
- else \
- rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
- fi ; \
- fi ; \
- for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
+ for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
if [ -f $$tool$(exeext) ]; then \
rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
Index: gcc/cp/Make-lang.in
===================================================================
--- gcc/cp/Make-lang.in (revision 115296)
+++ gcc/cp/Make-lang.in (working copy)
@@ -37,6 +37,8 @@
# - the compiler proper (eg: cc1plus)
# - define the names for selecting the language in LANGUAGES.
+DRIVERS += g++
+
# Actual names to use when installing a native compiler.
CXX_INSTALL_NAME := $(shell echo c++|sed '$(program_transform_name)')
GXX_INSTALL_NAME := $(shell echo g++|sed '$(program_transform_name)')
@@ -146,25 +148,17 @@ lang_checks += check-g++
# Install the driver program as $(target)-g++
# and also as either g++ (if native) or $(tooldir)/bin/g++.
c++.install-common: installdirs
- -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -$(INSTALL_PROGRAM) g++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
- -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
-( cd $(DESTDIR)$(bindir) && \
$(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
-if [ -f cc1plus$(exeext) ] ; then \
if [ -f g++-cross$(exeext) ] ; then \
if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
- $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
( cd $(DESTDIR)$(gcc_tooldir)/bin && \
$(LN) g++$(exeext) c++$(exeext) ); \
else true; fi; \
else \
- rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
- ( cd $(DESTDIR)$(bindir) && \
- $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
Index: gcc/fortran/Make-lang.in
===================================================================
--- gcc/fortran/Make-lang.in (revision 115296)
+++ gcc/fortran/Make-lang.in (working copy)
@@ -40,6 +40,8 @@
# - define the names for selecting the language in LANGUAGES.
# $(srcdir) must be set to the gcc/ source directory (*not* gcc/fortran/).
+DRIVERS += gfortran
+
# Actual name to use when installing a native compiler.
GFORTRAN_INSTALL_NAME := $(shell echo gfortran|sed '$(program_transform_name)')
GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed '$(program_transform_name)')
@@ -184,20 +186,6 @@ install-finclude-dir: installdirs
# Install the driver program as $(target)-gfortran
# and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
fortran.install-common: install-finclude-dir installdirs
- -if [ -f f951$(exeext) ] ; then \
- rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- if [ -f gfortran-cross$(exeext) ] ; then \
- if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
- $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
- else true; fi; \
- else \
- rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
- $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
- fi ; \
- fi
fortran.install-info: $(DESTDIR)$(infodir)/gfortran.info
Index: gcc/treelang/Make-lang.in
===================================================================
--- gcc/treelang/Make-lang.in (revision 115296)
+++ gcc/treelang/Make-lang.in (working copy)
@@ -38,6 +38,8 @@
# - define the names for selecting the language in LANGUAGES.
#
+DRIVERS += gtreelang
+
## note program-prefix and program-suffix options are not supported
## just program_transform_name which is a sed script to transform the
## names
@@ -190,16 +192,6 @@ $(build_htmldir)/treelang/index.html: $(
treelang.install treelang.install.common treelang.install-common: treelang.install.common.done
treelang.install.common.done: installdirs treelang.done
- for name in $(TREE_EXES); \
- do \
- if [ -f $$name ] ; then \
- name2="`echo \`basename $$name\` | sed -e '$(program_transform_name)' `"; \
- rm -f $(DESTDIR)$(bindir)/$$name2$(exeext); \
- echo $(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
- $(INSTALL_PROGRAM) $$name$(exeext) $(DESTDIR)$(bindir)/$$name2$(exeext); \
- chmod a+x $(DESTDIR)$(bindir)/$$name2$(exeext); \
- fi ; \
- done
$(STAMP) treelang.install.common.done
# We might not be able to build the info files
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 115296)
+++ gcc/Makefile.in (working copy)
@@ -1116,11 +1116,37 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi
# language hooks, generated by configure
@language_hooks@
+DRIVERS :=
+
# per-language makefile fragments
ifneq ($(LANG_MAKEFRAGS),)
include $(LANG_MAKEFRAGS)
endif
+LANG_INSTALL_COMMONS := $(patsubst %,%.install-common,$(CONFIG_LANGUAGES))
+
+$(LANG_INSTALL_COMMONS): install-drivers
+
+install-drivers: installdirs
+ -for driver in $(DRIVERS); do \
+ driver_install_name="`echo $$driver | sed '$(program_transform_name)'`"; \
+ driver_target_install_name=$(target_noncanonical)-$$driver_install_name; \
+ driver_install_path=$(DESTDIR)$(bindir)/$$driver_install_name$(exeext); \
+ driver_target_install_path=$(DESTDIR)$(bindir)/$$driver_target_install_name$(exeext); \
+ rm -f $$driver_install_path; \
+ $(INSTALL_PROGRAM) $$driver$(exeext) $$driver_install_path; \
+ chmod a+x $$driver_install_path; \
+ if [ -f $$driver-cross$(exeext) ] ; then \
+ if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
+ rm -f $(DESTDIR)$(gcc_tooldir)/bin/$$driver$(exeext); \
+ $(INSTALL_PROGRAM) $$driver-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/$$driver$(exeext); \
+ else true; fi; \
+ else \
+ rm -f $$driver_target_install_path; \
+ $(LN) $$driver_install_path $$driver_target_install_path; \
+ fi \
+ done
+
# target and host overrides must follow the per-language makefile fragments
# so they can override or augment language-specific variables