Patchwork [v2,01/18] clean up SHLIB so subshells are not needed

login
register
mail settings
Submitter Tom Tromey
Date July 29, 2013, 4:24 p.m.
Message ID <1375115069-31143-2-git-send-email-tromey@redhat.com>
Download mbox | patch
Permalink /patch/262878/
State New
Headers show

Comments

Tom Tromey - July 29, 2013, 4:24 p.m.
This changes the handling of SHLIB so that it is inlined into
DRIVER_DEFINES.  This is ok because SHLIB is defined in a Makefile
fragment that is included by the generated Makefile.

The rationale for this is that it simplifies some .o targets, so that
we can share more code.

	* Makefile.in (DRIVER_DEFINES): Use $(and), not shell code,
	to add -DENABLE_SHARED_LIBGCC.
	(gcc.o): Don't use subshell.

	* Make-lang.in (c/gccspec.o): Don't use subshell.

	* Make-lang.in (g++spec.o): Don't use subshell.

	* Make-lang.in (gfortranspec.o): Don't use subshell.

	* Make-lang.in (gospec.o): Don't use subshell.

	* Make-lang.in (jvspec.o): Don't use subshell.
---
 gcc/Makefile.in          | 5 ++---
 gcc/c/Make-lang.in       | 3 +--
 gcc/cp/Make-lang.in      | 3 +--
 gcc/fortran/Make-lang.in | 3 +--
 gcc/go/Make-lang.in      | 3 +--
 gcc/java/Make-lang.in    | 3 +--
 6 files changed, 7 insertions(+), 13 deletions(-)

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index fb0cb4b..ce5b159 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2056,16 +2056,15 @@  DRIVER_DEFINES = \
   -DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
   @TARGET_SYSTEM_ROOT_DEFINE@ \
   $(VALGRIND_DRIVER_DEFINES) \
-  `test "X$${SHLIB}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
+  $(and $(SHLIB),$(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC) \
   -DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\""
 
 gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
     Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
     configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) $(PARAMS_H)
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
-  -c $(srcdir)/gcc.c $(OUTPUT_OPTION))
+  -c $(srcdir)/gcc.c $(OUTPUT_OPTION)
 
 specs.h : s-specs ; @true
 s-specs : Makefile
diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
index 1161742..86deb1d 100644
--- a/gcc/c/Make-lang.in
+++ b/gcc/c/Make-lang.in
@@ -46,10 +46,9 @@  c: cc1$(exeext)
 # is to cc1 as e.g. g++ is to cc1plus, or gfortran is to f951).
 c/gccspec.o: c/gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(OPTS_H)
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
   $(DRIVER_DEFINES) \
-  -c $(srcdir)/c/gccspec.c $(OUTPUT_OPTION))
+  -c $(srcdir)/c/gccspec.c $(OUTPUT_OPTION)
 
 # The C compiler itself.
 
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 2cb919a..da8e87b 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -53,9 +53,8 @@  c++: cc1plus$(exeext)
 
 g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(CONFIG_H) $(OPTS_H)
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
-		$(INCLUDES) $(srcdir)/cp/g++spec.c)
+		$(INCLUDES) $(srcdir)/cp/g++spec.c
 
 # Create the compiler driver for g++.
 GXX_OBJS = $(GCC_OBJS) g++spec.o
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index ee70423..035a1d5 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -78,9 +78,8 @@  fortran: f951$(exeext)
 
 gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
 	$(CONFIG_H) coretypes.h intl.h $(OPTS_H)
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
-		$(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
+		$(INCLUDES) $(srcdir)/fortran/gfortranspec.c
 
 # Create the compiler driver gfortran.
 GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index 3cb18d6..015ed7a 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -32,9 +32,8 @@  go: go1$(exeext)
 
 gospec.o: $(srcdir)/go/gospec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
     $(CONFIG_H) opts.h
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
-		$(INCLUDES) $(srcdir)/go/gospec.c)
+		$(INCLUDES) $(srcdir)/go/gospec.c
 
 GCCGO_OBJS = $(GCC_OBJS) gospec.o
 gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 8a6210f..078f6d4 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -57,9 +57,8 @@  JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
 
 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
   $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
-	(SHLIB='$(SHLIB)'; \
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
-		$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
+		$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION)
 
 # Create the compiler driver for $(XGCJ).
 $(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \