1 #
   2 # Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 
  25 # Builds and runs test program for freetype sanity check.
  26 
  27 BUILDDIR = ../..
  28 include $(BUILDDIR)/common/Defs.gmk
  29 
  30 # Default name
  31 PROGRAM = freetype_versioncheck
  32 FT_OBJ = $(BUILDTOOLBINDIR)/$(PROGRAM).$(OBJECT_SUFFIX)
  33 FT_TEST = $(BUILDTOOLBINDIR)/$(PROGRAM)$(EXE_SUFFIX)
  34 
  35 # Used on openjdk only
  36 ifeq ($(OPENJDK),true)
  37 
  38 # Start with CFLAGS (which gets us the required -xarch setting on solaris)
  39 ifeq ($(PLATFORM), windows)
  40   FT_OPTIONS  = /nologo /c
  41   FREETYPE_DLL = $(FREETYPE_LIB_PATH)/freetype.dll
  42   FT_LD_OPTIONS  = $(FREETYPE_LIB_PATH)/freetype.lib
  43 ifdef MT
  44   FT_LD_OPTIONS += /manifest
  45 endif
  46 else
  47   FT_OPTIONS  = $(CFLAGS)
  48   FT_LD_OPTIONS = -L$(FREETYPE_LIB_PATH)
  49   # Add runtime lib search path to ensure test will be runnable
  50   ifeq ($(PLATFORM), solaris)
  51     FT_LD_OPTIONS += -R $(FREETYPE_LIB_PATH) -lfreetype
  52   else #linux
  53       FT_LD_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype
  54   endif
  55 endif
  56 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)
  57 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)/freetype2
  58 FT_OPTIONS += -DREQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION)
  59 FT_LD_OPTIONS += $(LFLAGS_$(COMPILER_VERSION))
  60 
  61 # Create test program
  62 all: $(FT_TEST)
  63         $(FT_TEST)
  64 
  65 # On windows we need to copy dll to test dir to ensure it will be found
  66 #   at runtime
  67 $(FT_TEST): freetypecheck.c
  68         $(prep-target)
  69 ifeq ($(PLATFORM), windows)
  70         $(CC) $(FT_OPTIONS) $(CC_OBJECT_OUTPUT_FLAG)$(FT_OBJ) $<
  71         $(LINK) $(FT_LD_OPTIONS) /OUT:$(FT_TEST) $(FT_OBJ)
  72         $(CP) $(FREETYPE_DLL) $(@D)/
  73 ifdef MT
  74         $(CP) $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(@D)/
  75         $(MT) /manifest $(FT_TEST).manifest /outputresource:$(FT_TEST);#1
  76 endif
  77 else
  78         @$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS)
  79 endif
  80 
  81 else
  82 
  83 # Inform user this is openjdk only
  84 all:
  85         @$(ECHO) "The freetype files are only used with OpenJDK"
  86 
  87 endif
  88 
  89 clean::
  90         $(RM) $(FT_TEST)
  91