6672405: OPENJDK build: jdk7/jdk/make/tools/freetypecheck leaves dirt behind
authorohair
Mon, 31 Mar 2008 17:17:18 -0700
changeset 305 9b905a071b0e
parent 304 defb1d0d07df
child 306 d0cc9302b27e
6672405: OPENJDK build: jdk7/jdk/make/tools/freetypecheck leaves dirt behind Summary: OpenJDK freetype sanity check cleanup. Reviewed-by: tbell
jdk/make/common/Defs.gmk
jdk/make/common/shared/Sanity.gmk
jdk/make/tools/Makefile
jdk/make/tools/freetypecheck/Makefile
--- a/jdk/make/common/Defs.gmk	Thu Mar 27 12:28:53 2008 -0700
+++ b/jdk/make/common/Defs.gmk	Mon Mar 31 17:17:18 2008 -0700
@@ -303,6 +303,8 @@
 # for build tool jar files
 BUILDTOOLJARDIR     = $(OUTPUTDIR)/btjars
 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
+# for generated tool class files
+BUILDTOOLBINDIR     = $(OUTPUTDIR)/btbins
 # for generated java source files
 GENSRCDIR           = $(OUTPUTDIR)/gensrc
 # for generated C source files (not javah)
--- a/jdk/make/common/shared/Sanity.gmk	Thu Mar 27 12:28:53 2008 -0700
+++ b/jdk/make/common/shared/Sanity.gmk	Mon Mar 31 17:17:18 2008 -0700
@@ -788,21 +788,17 @@
 
 ifdef OPENJDK
 
-#name of test program that prints out "Failed" if freetype is not good enough
-FREETYPE_VERSION_CHECK_NAME = freetype_versioncheck
-FREETYPE_VERSION_CHECK = $(TEMPDIR)/$(FREETYPE_VERSION_CHECK_NAME)$(EXE_SUFFIX)
+# The freetypecheck Makefile prints out "Failed" if not good enough
+$(TEMPDIR)/freetypeinfo: FRC
+	@$(prep-target)
+	@(($(CD) $(BUILDDIR)/tools/freetypecheck && $(MAKE)) || \
+	    $(ECHO) "Failed to build freetypecheck." ) > $@
 
-sane-freetype:
-	@-($(CD) $(BUILDDIR)/tools/freetypecheck && \
-	$(MAKE) REQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION) \
-	        FT_TEST=$(FREETYPE_VERSION_CHECK_NAME) \
-	        FT_HEADERS=$(FREETYPE_HEADERS_PATH) \
-	        FT_LIB=$(FREETYPE_LIB_PATH) \
-	        XARCH=$(XARCH))
-	@if [ ! -r $(FREETYPE_VERSION_CHECK) -o \
-	  "`$(FREETYPE_VERSION_CHECK) | $(GREP) Fail`" != "" ]; then \
+sane-freetype: $(TEMPDIR)/freetypeinfo
+	@if [ "`$(CAT) $< | $(GREP) Fail`" != "" ]; then \
 	  $(ECHO) "ERROR: FreeType version " $(REQUIRED_FREETYPE_VERSION) \
-	          "or higher is required. \n" >> $(ERROR_FILE) ; \
+	          " or higher is required. \n" \
+		  "`$(CAT) $<`  \n" >> $(ERROR_FILE) ; \
 	fi
 
 else
--- a/jdk/make/tools/Makefile	Thu Mar 27 12:28:53 2008 -0700
+++ b/jdk/make/tools/Makefile	Mon Mar 31 17:17:18 2008 -0700
@@ -40,6 +40,7 @@
   dir_diff                  \
   dtdbuilder                \
   fontchecker               \
+  freetypecheck             \
   generate_break_iterator   \
   GenerateCharacter         \
   generatecurrencydata      \
@@ -58,4 +59,5 @@
 clean clobber::
 	$(RM) -r $(BUILDTOOLCLASSDIR)
 	$(RM) -r $(BUILDTOOLJARDIR)
+	$(RM) -r $(BUILDTOOLBINDIR)
 
--- a/jdk/make/tools/freetypecheck/Makefile	Thu Mar 27 12:28:53 2008 -0700
+++ b/jdk/make/tools/freetypecheck/Makefile	Mon Mar 31 17:17:18 2008 -0700
@@ -22,55 +22,58 @@
 # CA 95054 USA or visit www.sun.com if you need additional information or
 # have any questions.
 
-# Builds test program for freetype sanity check.
-#
-# Makefile should be called with following input parameters
-#   FT_TEST    - full name of test program
-#   FT_HEADERS - path to freetype headers
-#   FT_LIB     - location of directory with library
-#   XARCH      - xarch option if required
+# Builds and runs test program for freetype sanity check.
 
 BUILDDIR = ../..
 include $(BUILDDIR)/common/Defs.gmk
 
-#test program is expected in the TEMPDIR
-FT_TEST_PATH = $(TEMPDIR)/$(FT_TEST)
+# Default name
+FT_TEST = $(BUILDTOOLBINDIR)/freetype_versioncheck$(EXE_SUFFIX)
 
-all: $(FT_TEST_PATH)
+# Used on openjdk only
+ifeq ($(OPENJDK),true)
 
 # Start with CFLAGS (which gets us the required -xarch setting on solaris)
 ifeq ($(PLATFORM), windows)
-  FT_OPTIONS  =
+  FT_OPTIONS  = /nologo $(CC_OBJECT_OUTPUT_FLAG)$(TEMPDIR)
+  FREETYPE_DLL = $(FREETYPE_LIB_PATH)/freetype.dll
+  FT_LD_OPTIONS  = $(FREETYPE_LIB_PATH)/freetype.lib
 else
   FT_OPTIONS  = $(CFLAGS)
-endif
-
-FT_OPTIONS += -I$(FT_HEADERS) -I$(FT_HEADERS)/freetype2
-FT_OPTIONS += $(XARCH)
-
-#add runtime library search path
-ifeq ($(PLATFORM), windows)
-  FREETYPE_LIB=$(FT_LIB)/freetype.lib
-  FREETYPE_DLL=$(FT_LIB)/freetype.dll
-  DFLAG=/D
-else
-  FT_OPTIONS += -L$(FT_LIB)
-  DFLAG = -D
-
-  #add runtime lib search path to ensure test will be runnable
+  FT_LD_OPTIONS = -L$(FREETYPE_LIB_PATH)
+  # Add runtime lib search path to ensure test will be runnable
   ifeq ($(PLATFORM), solaris)
-    FT_OPTIONS += -R $(FT_LIB) -lfreetype
+    FT_LD_OPTIONS += -R $(FREETYPE_LIB_PATH) -lfreetype
   else #linux
-      FT_OPTIONS += -Wl,-rpath -Wl,$(FT_LIB) -lfreetype
+      FT_LD_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype
   endif
 endif
-
-FT_OPTIONS += $(DFLAG)REQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION)
+FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)
+FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)/freetype2
+FT_OPTIONS += -DREQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION)
+FT_LD_OPTIONS += $(LFLAGS_$(COMPILER_VERSION))
 
-# On windows we need to copy dll to test dir
-#  ti ensure it will be found in runtime
-$(FT_TEST_PATH): freetypecheck.c
-	@$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FREETYPE_LIB) $(LFLAGS_$(COMPILER_VERSION))
+# Create test program
+all: $(FT_TEST)
+	@$(FT_TEST)
+
+# On windows we need to copy dll to test dir to ensure it will be found
+#   at runtime
+$(FT_TEST): freetypecheck.c
+	@$(prep-target)
+	@$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS)
 ifeq ($(PLATFORM), windows)
 	@$(CP) $(FREETYPE_DLL) `dirname $@`
 endif
+
+else
+
+# Inform user this is openjdk only
+all:
+	@$(ECHO) "The freetype files are only used with OpenJDK"
+
+endif
+
+clean::
+	$(RM) $(FT_TEST)
+