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 53 ifeq ($(PLATFORM), macosx) 54 FT_LD_OPTIONS += -lfreetype -lz 55 else # linux 56 FT_LD_OPTIONS += -Wl,-rpath -Wl,$(FREETYPE_LIB_PATH) -lfreetype 57 endif 58 endif 59 endif 60 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH) 61 FT_OPTIONS += -I$(FREETYPE_HEADERS_PATH)/freetype2 62 FT_OPTIONS += -DREQUIRED_FREETYPE_VERSION=$(REQUIRED_FREETYPE_VERSION) 63 FT_LD_OPTIONS += $(LFLAGS_$(COMPILER_VERSION)) 64 65 # Create test program 66 all: $(FT_TEST) 67 $(FT_TEST) 68 69 # On windows we need to copy dll to test dir to ensure it will be found 70 # at runtime 71 $(FT_TEST): freetypecheck.c 72 $(prep-target) 73 ifeq ($(PLATFORM), windows) 74 $(CC) $(FT_OPTIONS) $(CC_OBJECT_OUTPUT_FLAG)$(FT_OBJ) $< 75 $(LINK) $(FT_LD_OPTIONS) /OUT:$(FT_TEST) $(FT_OBJ) 76 $(CP) $(FREETYPE_DLL) $(@D)/ 77 ifdef MT 78 $(CP) $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(@D)/ 79 $(MT) /manifest $(FT_TEST).manifest /outputresource:$(FT_TEST);#1 80 endif 81 else 82 @$(CC) $(FT_OPTIONS) $(CC_PROGRAM_OUTPUT_FLAG)$@ $< $(FT_LD_OPTIONS) 83 endif 84 85 else 86 87 # Inform user this is openjdk only 88 all: 89 @$(ECHO) "The freetype files are only used with OpenJDK" 90 91 endif 92 93 clean:: 94 $(RM) $(FT_TEST) 95