make/linux/makefiles/rules.make

Print this page

        

@@ -1,7 +1,7 @@
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 only, as
 # published by the Free Software Foundation.

@@ -144,29 +144,31 @@
 # Include $(NONPIC_OBJ_FILES) definition
 ifndef LP64
 include $(GAMMADIR)/make/pic.make
 endif
 
+DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%.o=%.d) -MT '$@ $(@:%.o=%.i)'
+
 # The non-PIC object files are only generated for 32 bit platforms.
 ifdef LP64
 %.o: %.cpp
         @echo Compiling $<
         $(QUIETLY) $(REMOVE_TARGET)
-        $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+        $(QUIETLY) $(COMPILE.CC) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
 else
 %.o: %.cpp
         @echo Compiling $<
         $(QUIETLY) $(REMOVE_TARGET)
         $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
-           $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \
-           $(COMPILE.CC) -o $@ $< $(COMPILE_DONE))
+           $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \
+           $(COMPILE.CC) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE))
 endif
 
 %.o: %.s
         @echo Assembling $<
         $(QUIETLY) $(REMOVE_TARGET)
-        $(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE)
+        $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
 
 %.s: %.cpp
         @echo Generating assembly for $<
         $(QUIETLY) $(GENASM.CC) -o $@ $<
         $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE)