]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/Makefile.in
(clh 9)
[thirdparty/gcc.git] / gcc / Makefile.in
index 8f99a6cfa0b378c12877154a53765e3e5f1d83b4..c1480a4704f9de4a7503bfcc7fb033beba09b094 100644 (file)
@@ -308,6 +308,11 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
 # UNSORTED
 # --------
 
+# Dependency tracking stuff.
+CCDEPMODE = @CCDEPMODE@
+DEPDIR = @DEPDIR@
+depcomp = $(SHELL) $(srcdir)/../depcomp
+
 # Some compilers can't handle cc -c blah.c -o foo/blah.o.
 # In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
 OUTPUT_OPTION = @OUTPUT_OPTION@
@@ -1071,8 +1076,23 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
           $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
           $(CLOOGINC) $(ISLINC)
 
+COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
+ifeq ($(CCDEPMODE),depmode=gcc3)
+# Note a subtlety here: we use $(@D) for the directory part, to make
+# things like the go/%.o rule work properly; but we use $(*F) for the
+# file part, as we just want the file part of the stem, not the entire
+# file name.
+COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo
+POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po
+else
+COMPILE = source='$<' object='$@' libtool=no \
+    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) $(COMPILE.base)
+POSTCOMPILE =
+endif
+
 .cc.o .c.o:
-       $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
+       $(COMPILE) $<
+       $(POSTCOMPILE)
 
 #\f
 # Support for additional languages (other than C).
@@ -5387,7 +5407,17 @@ po/gcc.pot: force
        AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
                $(XGETTEXT) gcc $(srcdir)
 
+#\f
+
+# Dependency information.
+
 # In order for parallel make to really start compiling the expensive
 # objects from $(OBJS) as early as possible, build all their
 # prerequisites strictly before all objects.
 $(ALL_HOST_OBJS) : | $(generated_files)
+
+# Include the auto-generated dependencies for all host objects.
+DEPFILES = \
+  $(foreach obj,$(ALL_HOST_OBJS),\
+    $(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj))))
+-include $(DEPFILES)