--- a/jdk/make/common/Defs.gmk Thu Mar 24 11:20:48 2011 -0700
+++ b/jdk/make/common/Defs.gmk Sat Mar 26 00:10:12 2011 -0700
@@ -116,6 +116,36 @@
include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
#
+# Cross-compilation Settings
+#
+ifdef CROSS_COMPILE_ARCH
+ # Can't run the tools we just built
+ USE_ONLY_BOOTDIR_TOOLS = true
+
+ # When cross-compiling CC generates code for the target, but
+ # some parts of the build generate C code that has to be compiled
+ # and executed on the build host - HOST_CC is the 'local' compiler.
+ # For linux the default is /usr/bin/gcc; other platforms need to
+ # set it explicitly
+ ifeq ($(PLATFORM), linux)
+ ifndef HOST_CC
+ HOST_CC = $(USRBIN_PATH)gcc
+ endif
+ endif
+else
+ # Must set HOST_CC if not already set
+ ifndef HOST_CC
+ HOST_CC = $(CC)
+ endif
+endif
+
+# Reset the VM name for client-only builds
+ifdef BUILD_CLIENT_ONLY
+ VM_NAME = client
+endif
+
+
+#
# Freetype logic is applicable to OpenJDK only
#
ifdef OPENJDK
@@ -334,8 +364,7 @@
INCLUDES = -I. -I$(CLASSHDRDIR) \
$(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES)
-OTHER_CPPFLAGS = $(INCLUDES)
-
+OTHER_CPPFLAGS += $(INCLUDES)
#
# vpaths. These are the default locations searched for source files.
@@ -466,9 +495,11 @@
#
# Tool flags
#
+# EXTRA_CFLAGS are used to define cross-compilation options
+#
ASFLAGS = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS)
-CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS)
-CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS)
+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%)
LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)