--- a/jdk/make/common/Defs.gmk Wed Jul 05 18:20:34 2017 +0200
+++ b/jdk/make/common/Defs.gmk Tue Sep 11 13:40:59 2012 -0700
@@ -542,6 +542,21 @@
CXXFLAGS_$(VARIANT)/BYFILE = $(CXXFLAGS_$(VARIANT)/$(@F)) \
$(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F)))
+# Command line define to provide basename of file being compiled to source.
+# The C macro THIS_FILE can replace the use of __FILE__ in the source
+# files for the current filename being compiled.
+# The value of the __FILE__ macro is unpredictable and can be anything
+# from a relative path to a full path, THIS_FILE will be more consistent..
+# The THIS_FILE macro will always be just the basename of the file being
+# compiled.
+# Different string literals in the the object files makes it difficult to
+# compare shared libraries from different builds.
+#
+# NOTE: If the THIS_FILE macro is actually expanded while in an included
+# source file, it will not return the name of the included file.
+#
+CPP_THIS_FILE = -DTHIS_FILE='"$(<F)"'
+
#
# Tool flags
#
@@ -551,7 +566,7 @@
CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS) $(EXTRA_CFLAGS)
CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS) $(EXTRA_CFLAGS)
CPPFLAGS = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
- $(DEFINES) $(OPTIONS:%=-D%)
+ $(DEFINES) $(OPTIONS:%=-D%) $(CPP_THIS_FILE)
LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)
LDLIBS = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON)
LINTFLAGS = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \