diff mbox

Reduce duplication of compilation commands

Message ID Pine.LNX.4.64.1108232201180.18871@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Aug. 23, 2011, 10:06 p.m. UTC
This patch, relative to a tree with my patch
<http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01930.html> applied,
reduces the number of explicit compilation rules in gcc/ and
subdirectory makefiles by using CFLAGS-$@ settings when a target needs
extra compiler options.

Not fixed are rules for building driver files (involving SHLIB_LINK)
or those where the simple relation between .c and .o file names does
not apply (many of which could be fixed by moving the .o files in the
object tree to locations directly corresponding to the source files).
One linking rule that used $(COMPILER) instead of $(LINKER) for no
apparent reason was changed to use $(LINKER) instead of masquerading
as a compilation rule.

This is inspired by some of the cleanups in Tom's automatic dependency
generation patch that had to be reverted in 2008, the idea being that
such cleanups are of value on their own even without automatic
dependency generation and would also facilitate any future attempt at
automatic dependency generation.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit (the first patch this is relative to and this one)?

2011-08-23  Joseph Myers  <joseph@codesourcery.com>

	* Makefile.in (CFLAGS-collect2.o, CFLAGS-c-family/c-opts.o)
	(CFLAGS-c-family/c-pch.o, CFLAGS-prefix.o, CFLAGS-version.o)
	(CFLAGS-lto-compress.o, CFLAGS-toplev.o, CFLAGS-intl.o)
	(CFLAGS-cppbuiltin.o, CFLAGS-cppdefault.o): New.
	(collect2.o, c-family/c-cppbuiltin.o, c-family/c-opts.o)
	(c-family/c-pch.o, prefix.o, version.o, lto-compress.o, toplev.o)
	(intl.o, cppbuiltin.o, cppdefault.o): Remove explicit compilation
	rules.
	(lto-wrapper$(exeext)): Use $(LINKER) not $(COMPILER).

ada/gcc-interface:
2011-08-23  Joseph Myers  <joseph@codesourcery.com>

	* Make-lang.in (CFLAGS-ada/tracebak.o, CFLAGS-ada/targext.o)
	(CFLAGS-ada/cio.o, CFLAGS-ada/init.o, CFLAGS-ada/initialize.o)
	(CFLAGS-ada/raise.o): New.
	(ada/tracebak.o, ada/targext.o, ada/cio.o, ada/init.o)
	(ada/initialize.o, ada/raise.o): Remove explicit compilation rules.

fortran:
2011-08-23  Joseph Myers  <joseph@codesourcery.com>

	* Make-lang.in (fortran/cpp.o): Remove explicit compilation rule.

go:
2011-08-23  Joseph Myers  <joseph@codesourcery.com>

	* Make-lang.in (CFLAGS-go/go-lang.o): New.
	(go/go-lang.o): Remove explicit compilation rule.

java:
2011-08-23  Joseph Myers  <joseph@codesourcery.com>

	* Make-lang.in (CFLAGS-java/jcf-io.o, CFLAGS-java/jcf-path.o):
	New.
	(java/jcf-io.o, java/jcf-path.o): Remove explicit compilation
	rules.

Comments

Paolo Bonzini Aug. 24, 2011, 6:41 a.m. UTC | #1
On 08/24/2011 12:06 AM, Joseph S. Myers wrote:
> This patch, relative to a tree with my patch
> <http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01930.html>  applied,
> reduces the number of explicit compilation rules in gcc/ and
> subdirectory makefiles by using CFLAGS-$@ settings when a target needs
> extra compiler options.
>
> Not fixed are rules for building driver files (involving SHLIB_LINK)
> or those where the simple relation between .c and .o file names does
> not apply (many of which could be fixed by moving the .o files in the
> object tree to locations directly corresponding to the source files).
> One linking rule that used $(COMPILER) instead of $(LINKER) for no
> apparent reason was changed to use $(LINKER) instead of masquerading
> as a compilation rule.
>
> This is inspired by some of the cleanups in Tom's automatic dependency
> generation patch that had to be reverted in 2008, the idea being that
> such cleanups are of value on their own even without automatic
> dependency generation and would also facilitate any future attempt at
> automatic dependency generation.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit (the first patch this is relative to and this one)?

Ok, nice cleanup.

Paolo
Paolo Bonzini Aug. 24, 2011, 6:44 a.m. UTC | #2
On 08/24/2011 12:06 AM, Joseph S. Myers wrote:
> This patch, relative to a tree with my patch
> <http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01930.html>  applied,
> reduces the number of explicit compilation rules in gcc/ and
> subdirectory makefiles by using CFLAGS-$@ settings when a target needs
> extra compiler options.

That patch is okay too, by the way; DJ's comment about non-g++ flags 
does not apply IMO to CFLAGS-$@ which is used exclusively with -D and -I.

Paolo
diff mbox

Patch

diff -rupN --exclude=.svn gcc-mainline-0/gcc/Makefile.in gcc-mainline/gcc/Makefile.in
--- gcc-mainline-0/gcc/Makefile.in	2011-08-23 12:10:52.818130203 -0700
+++ gcc-mainline/gcc/Makefile.in	2011-08-23 12:38:13.238166660 -0700
@@ -2052,12 +2052,11 @@  collect2$(exeext): $(COLLECT2_OBJS) $(LI
 		$(COLLECT2_OBJS) $(LIBS) $(COLLECT2_LIBS)
 	mv -f T$@ $@
 
+CFLAGS-collect2.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" \
+	@TARGET_SYSTEM_ROOT_DEFINE@
 collect2.o : collect2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h \
 	$(OBSTACK_H) $(DEMANGLE_H) collect2.h collect2-aix.h version.h \
 	$(DIAGNOSTIC_H)
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS)  \
-	-DTARGET_MACHINE=\"$(target_noncanonical)\" \
-	-c $(srcdir)/collect2.c $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
 
 collect2-aix.o : collect2-aix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
     collect2-aix.h
@@ -2066,7 +2065,7 @@  tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB
     $(OBSTACK_H) collect2.h intl.h $(DIAGNOSTIC_CORE_H)
 
 lto-wrapper$(exeext): lto-wrapper.o $(LIBDEPS)
-	+$(COMPILER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o $(LIBS)
+	+$(LINKER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o $(LIBS)
 	mv -f T$@ $@
 
 lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h \
@@ -2088,8 +2087,6 @@  c-family/c-cppbuiltin.o : c-family/c-cpp
 	coretypes.h $(TM_H) $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) \
 	$(FLAGS_H) output.h $(TREE_H) $(TARGET_H) $(COMMON_TARGET_H) \
 	$(TM_P_H) debug.h $(CPP_ID_DATA_H) cppbuiltin.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-		$< $(OUTPUT_OPTION)
 
 c-family/c-dump.o : c-family/c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(TM_H) $(TREE_H) $(TREE_DUMP_H)
@@ -2113,20 +2110,18 @@  c-family/c-lex.o : c-family/c-lex.c $(CO
 c-family/c-omp.o : c-family/c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(TREE_H) $(C_COMMON_H) $(GIMPLE_H) langhooks.h
 
+CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@
 c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
         $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
         $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) $(C_TARGET_H) \
         $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-		$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
 
+CFLAGS-c-family/c-pch.o += -DHOST_MACHINE=\"$(host)\" \
+	-DTARGET_MACHINE=\"$(target)\"
 c-family/c-pch.o : c-family/c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(CPPLIB_H) $(TREE_H) $(C_COMMON_H) output.h $(C_PRAGMA_H) \
 	$(GGC_H) debug.h langhooks.h $(FLAGS_H) hosthooks.h version.h \
 	$(TARGET_H) $(OPTS_H) $(TIMEVAR_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
-	  $< $(OUTPUT_OPTION)
 
 c-family/c-ppoutput.o : c-family/c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) \
@@ -2169,11 +2164,9 @@  incpath.o: incpath.c incpath.h $(CONFIG_
 		intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
 		$(MACHMODE_H)
 
+CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
 prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
 	$(COMMON_TARGET_H) Makefile $(BASEVER)
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	-DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s) \
-	  -c $(srcdir)/prefix.c $(OUTPUT_OPTION)
 
 # Language-independent files.
 
@@ -2251,12 +2244,11 @@  options-save.o: options-save.c $(CONFIG_
 
 dumpvers: dumpvers.c
 
-version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
+CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
 	-DREVISION=$(REVISION_s) \
 	-DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
-	-DBUGURL=$(BUGURL_s) -c $(srcdir)/version.c $(OUTPUT_OPTION)
+	-DBUGURL=$(BUGURL_s)
+version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 
 gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	$(HASHTAB_H) $(SPLAY_TREE_H) $(OBSTACK_H) $(BITMAP_H) \
@@ -2292,10 +2284,10 @@  double-int.o: double-int.c $(CONFIG_H) $
 	toplev.h $(TREE_H)
 
 # lto-compress.o needs $(ZLIBINC) added to the include flags.
+CFLAGS-lto-compress.o += $(ZLIBINC)
 lto-compress.o: lto-compress.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 	$(TREE_H) langhooks.h $(LTO_STREAMER_H) $(LTO_SECTION_H) \
 	lto-compress.h $(DIAGNOSTIC_CORE_H) $(DIAGNOSTIC_CORE_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(ZLIBINC) $< $(OUTPUT_OPTION)
 data-streamer-in.o: data-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
     $(DATA_STREAMER_H) $(DIAGNOSTIC_H)
 data-streamer-out.o: data-streamer-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
@@ -2836,6 +2828,7 @@  s-bversion: BASE-VER
 
 input.o : input.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(INPUT_H)
 
+CFLAGS-toplev.o += -DTARGET_NAME=\"$(target_noncanonical)\"
 toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
    $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
@@ -2847,9 +2840,6 @@  toplev.o : toplev.c $(CONFIG_H) $(SYSTEM
    $(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
    tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
    tree-pretty-print.h opts-diagnostic.h $(COMMON_TARGET_H)
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  -DTARGET_NAME=\"$(target_noncanonical)\" \
-	  -c $(srcdir)/toplev.c $(OUTPUT_OPTION)
 
 hwint.o : hwint.c $(CONFIG_H) $(SYSTEM_H) $(DIAGNOSTIC_CORE_H)
 
@@ -4054,10 +4044,8 @@  gengtype-lex.c : gengtype-lex.l
 
 #
 # Remake internationalization support.
+CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
 intl.o: intl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h Makefile
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  -DLOCALEDIR=\"$(localedir)\" \
-	  -c $(srcdir)/intl.c $(OUTPUT_OPTION)
 
 #
 # Remake cpp.
@@ -4075,17 +4063,13 @@  PREPROCESSOR_DEFINES = \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
   @TARGET_SYSTEM_ROOT_DEFINE@
 
+CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
 cppbuiltin.o: cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	cppbuiltin.h Makefile
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s) \
-	  -c $(srcdir)/cppbuiltin.c $(OUTPUT_OPTION)
 
+CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
 cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	cppdefault.h Makefile
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  $(PREPROCESSOR_DEFINES) \
-	  -c $(srcdir)/cppdefault.c $(OUTPUT_OPTION)
 
 # Note for the stamp targets, we run the program `true' instead of
 # having an empty command (nothing following the semicolon).
diff -rupN --exclude=.svn gcc-mainline-0/gcc/ada/gcc-interface/Make-lang.in gcc-mainline/gcc/ada/gcc-interface/Make-lang.in
--- gcc-mainline-0/gcc/ada/gcc-interface/Make-lang.in	2011-08-16 11:56:12.617799713 -0700
+++ gcc-mainline/gcc/ada/gcc-interface/Make-lang.in	2011-08-23 13:05:43.128164622 -0700
@@ -1213,9 +1213,8 @@  ada/a-tags.o  : ada/a-tags.adb ada/a-tag
 	$(CC) -c $(ALL_ADAFLAGS) $(FORCE_DEBUG_ADAFLAGS) $(ADA_INCLUDES) \
 	  $< $(OUTPUT_OPTION)
 
+CFLAGS-ada/tracebak.o += $(ADA_CFLAGS) -fno-omit-frame-pointer
 ada/tracebak.o : ada/tracebak.c $(CONFIG_H) $(SYSTEM_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) \
-	      $(INCLUDES) -fno-omit-frame-pointer $< $(OUTPUT_OPTION)
 
 # dependencies for windows specific tool (mdll)
 
@@ -1236,25 +1235,20 @@  ada/exit.o     : ada/exit.c $(CONFIG_H) 
 ada/final.o    : ada/final.c $(CONFIG_H) $(SYSTEM_H) ada/raise.h
 ada/link.o     : ada/link.c
 
+CFLAGS-ada/targext.o += $(ADA_CFLAGS)
 ada/targext.o : ada/targext.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
+CFLAGS-ada/cio.o += $(ADA_CFLAGS)
 ada/cio.o : ada/cio.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
+CFLAGS-ada/init.o += $(ADA_CFLAGS)
 ada/init.o : ada/init.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
+CFLAGS-ada/initialize.o += $(ADA_CFLAGS)
 ada/initialize.o : ada/initialize.c
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
+CFLAGS-ada/raise.o += $(ADA_CFLAGS)
 ada/raise.o : ada/raise.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		 $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 ada/cuintp.o : ada/gcc-interface/cuintp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) ada/gcc-interface/ada.h ada/types.h ada/uintp.h \
diff -rupN --exclude=.svn gcc-mainline-0/gcc/fortran/Make-lang.in gcc-mainline/gcc/fortran/Make-lang.in
--- gcc-mainline-0/gcc/fortran/Make-lang.in	2011-08-16 11:56:21.137460791 -0700
+++ gcc-mainline/gcc/fortran/Make-lang.in	2011-08-23 12:40:21.178179594 -0700
@@ -367,5 +367,3 @@  fortran/resolve.o: fortran/dependency.h 
 fortran/data.o: fortran/data.h
 fortran/options.o: $(PARAMS_H) $(TARGET_H) fortran/cpp.h
 fortran/cpp.o: fortran/cpp.c incpath.h incpath.o cppbuiltin.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-		$< $(OUTPUT_OPTION)
diff -rupN --exclude=.svn gcc-mainline-0/gcc/go/Make-lang.in gcc-mainline/gcc/go/Make-lang.in
--- gcc-mainline-0/gcc/go/Make-lang.in	2011-08-16 11:55:55.587822307 -0700
+++ gcc-mainline/gcc/go/Make-lang.in	2011-08-23 12:41:01.178180005 -0700
@@ -229,15 +229,13 @@  go/go-backend.o: go/go-backend.c $(CONFI
 	$(TM_H) $(RTL_H) $(TREE_H) $(TM_P_H) output.h $(TARGET_H) \
 	$(COMMON_TARGET_H)
 
+CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \
+	-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\"
 go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
 		$(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
 		$(FLAGS_H) convert.h $(DIAGNOSTIC_H) langhooks.h \
 		$(LANGHOOKS_DEF_H) $(EXCEPT_H) $(TARGET_H) $(GO_C_H) \
 		gt-go-go-lang.h gtype-go.h $(COMMON_TARGET_H)
-	$(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
-	  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
-	  -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
-	  -c $< $(OUTPUT_OPTION)
 
 GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend
 
diff -rupN --exclude=.svn gcc-mainline-0/gcc/java/Make-lang.in gcc-mainline/gcc/java/Make-lang.in
--- gcc-mainline-0/gcc/java/Make-lang.in	2011-08-16 11:54:08.278116531 -0700
+++ gcc-mainline/gcc/java/Make-lang.in	2011-08-23 12:48:48.167555049 -0700
@@ -324,18 +324,16 @@  java/java-gimplify.o: java/java-gimplify
   coretypes.h $(JAVA_TREE_H) $(GIMPLE_H)
 
 # jcf-io.o needs $(ZLIBINC) added to cflags.
+CFLAGS-java/jcf-io.o += $(ZLIBINC)
 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(JAVA_TREE_H) java/zipfile.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-		$(ZLIBINC) $(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)
 
 # jcf-path.o needs a -D.
+CFLAGS-java/jcf-path.o += \
+	-DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
+	-DDEFAULT_TARGET_VERSION=\"$(version)\"
 java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   java/jcf.h
-	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	  -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
-	  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
-	  $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)
 
 TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi		\
 	 $(gcc_docdir)/include/gpl_v3.texi $(gcc_docdir)/include/gcc-common.texi   \