1 #
   2 # Copyright (c) 1997, 2011, 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 
  26 #
  27 # Makefile for building all of font tools
  28 #
  29 
  30 BUILDDIR = ../..
  31 PACKAGE = sun.font
  32 LIBRARY = fontmanager
  33 PRODUCT = sun
  34 
  35 # Indicate we want the C++ compiler to do the linking.
  36 CPLUSPLUSLIBRARY=true
  37 
  38 # Use higher optimization level
  39 OPTIMIZATION_LEVEL = HIGHER
  40 
  41 include $(BUILDDIR)/common/Defs.gmk
  42 
  43 #
  44 # Created without -z defs on linux
  45 #
  46 ifeq ($(PLATFORM), linux)
  47   LDFLAGS_DEFS_OPTION =
  48 endif
  49 
  50 #
  51 # Files
  52 #
  53 
  54 include FILES_c.gmk
  55 
  56 AUTO_FILES_JAVA_DIRS = sun/font
  57 FILES_java += java/awt/Font.java java/text/Bidi.java 
  58 
  59 FILES_export = \
  60     sun/font/SunLayoutEngine.java \
  61     java/awt/Font.java \
  62     java/text/Bidi.java \
  63     sun/font/FileFont.java \
  64     sun/font/FileFontStrike.java \
  65     sun/font/SunFontManager.java \
  66     sun/font/GlyphList.java \
  67     sun/font/NativeFont.java \
  68     sun/font/StrikeCache.java \
  69     sun/font/NullFontScaler.java \
  70     sun/font/FreetypeFontScaler.java \
  71     sun/java2d/loops/DrawGlyphList.java \
  72     sun/java2d/loops/DrawGlyphListAA.java \
  73     sun/java2d/loops/DrawGlyphListLCD.java \
  74     sun/java2d/loops/GraphicsPrimitive.java
  75 
  76 ifeq ($(PLATFORM), windows)
  77 
  78   LDLIBS += user32.lib gdi32.lib $(OBJDIR)/../../../sun.awt/awt/$(OBJDIRNAME)/awt.lib  
  79 
  80   OTHER_CFLAGS += -DCC_NOEX
  81   OTHER_CXXFLAGS += -DCC_NOEX
  82 
  83 else # PLATFORM unix
  84 
  85   FILES_export += \
  86     sun/font/NativeStrike.java \
  87     sun/font/NativeStrikeDisposer.java \
  88     sun/font/X11TextRenderer.java \
  89     sun/awt/X11GraphicsEnvironment.java 
  90 
  91 endif # PLATFORM
  92 
  93 # Turn off aliasing with GCC for ExtensionSubtables.cpp
  94 ifeq ($(PLATFORM), linux)
  95   CXXFLAGS += $(CXXFLAGS_$(@F))
  96   CXXFLAGS_ExtensionSubtables.o = -fno-strict-aliasing
  97 endif
  98 
  99 #In the non-OpenJDK mode we need to build T2K
 100 ifndef OPENJDK
 101 t2k:
 102         $(ECHO) "lib=" $(ACTUAL_LIBRARY)
 103         $(MAKE) -C t2k
 104 
 105 all build: t2k
 106 t2k: library
 107 clean clobber::
 108         $(MAKE) -C t2k clean
 109 else
 110 
 111 FILES_m=mapfile-vers.openjdk
 112 
 113 #make sure freetype dll will be available at runtime as well as link time
 114 #
 115 #NB: Default freetype build system uses -h linker option and 
 116 #   result .so contains hardcoded library name that is later 
 117 #   used for adding dependencies to other objects 
 118 #   (e.g. libfontmanager.so).
 119 #   
 120 #   It is not obvious how to extract that hardcoded name (libfreetype.so.6)
 121 #   without overcomplicating logic here.
 122 #   To workaround this we hardcode .6 suffix for now.
 123 #
 124 #   Note that .so.6 library will not be found by System.loadLibrary()
 125 #        but fortunately we need to load FreeType library explicitly 
 126 #        on windows only  
 127 #
 128 #TODO: rework this to avoid hardcoding library name in the makefile
 129 #
 130 ifeq ($(PLATFORM), windows)
 131     FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX)
 132     OTHER_LDLIBS += $(FREETYPE_LIB_PATH)/freetype.lib
 133 else 
 134   ifeq ($(USING_SYSTEM_FT_LIB), false)
 135     FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6
 136   endif
 137   OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype
 138 endif 
 139 
 140 library:: $(FREETYPE_LIB)
 141 
 142 $(FREETYPE_LIB):
 143         $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@
 144 endif
 145 
 146 #ifeq ($(PLATFORM), solaris)
 147 #  FILES_reorder += reorder-$(ARCH)
 148 #endif
 149 include $(BUILDDIR)/common/Mapfile-vers.gmk
 150 include $(BUILDDIR)/common/Library.gmk
 151 
 152 .PHONY: t2k build all clean clobber
 153 
 154 #
 155 # Add to the ambient vpath to pick up files in subdirectories
 156 #
 157 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)
 158 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)/layout
 159 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)
 160 
 161 #
 162 # Fontmanager is headless (independent of X/Motif)
 163 #
 164 CFLAGS       += -DHEADLESS
 165 CXXFLAGS     += -DHEADLESS
 166 
 167 ifndef OPENJDK
 168   CPPFLAGS += -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k
 169 else
 170   CPPFLAGS += -I$(FREETYPE_HEADERS_PATH) -I$(FREETYPE_HEADERS_PATH)/freetype2
 171 endif
 172 
 173 ifeq ($(PLATFORM), windows)
 174 vpath %.cpp   $(PLATFORM_SRC)/native/sun/windows
 175 else # PLATFORM
 176 
 177 #
 178 # Libraries to link, and other C flags.
 179 #
 180 
 181 ifeq ($(PLATFORM), macosx)
 182 OTHER_INCLUDES += -I$(X11_PATH)/include
 183 OTHER_LDLIBS  += -lawt $(LIBM) $(LIBCXX)
 184  ifeq ($(OS_VENDOR),Apple)
 185    # XXXDARWIN Match BSD/Linux behavior -- the mawt.dylib symbols will
 186    # be available at runtime.
 187    OTHER_LDLIBS += -undefined dynamic_lookup
 188  endif
 189 else
 190 ifeq ($(PLATFORM), solaris)
 191   # Note that on Solaris, fontmanager is built against the headless library.
 192   LDFLAGS      += -L$(LIBDIR)/$(LIBARCH)/headless
 193   OTHER_LDLIBS += -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX)
 194 else # PLATFORM is linux
 195  OTHER_LDLIBS  += -lawt $(LIBM) $(LIBCXX)
 196   ifeq ("$(CC_VER_MAJOR)", "3")
 197     OTHER_LDLIBS  += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
 198   endif                           
 199 endif
 200 endif
 201 
 202 endif # PLATFORM
 203 
 204 # set up compile flags..
 205 
 206 ifeq ($(PLATFORM), macosx)
 207 CPPFLAGS += -I$(CLASSHDRDIR)
 208 endif
 209 
 210 CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR) \
 211             -I$(SHARE_SRC)/native/$(PKGDIR)/layout \
 212             -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
 213             -I$(PLATFORM_SRC)/native/sun/awt \
 214             -I$(SHARE_SRC)/native/sun/awt/debug \
 215             -I$(SHARE_SRC)/native/sun/java2d/loops \
 216             -I$(SHARE_SRC)/native/sun/java2d/pipe \
 217             -I$(PLATFORM_SRC)/native/sun/java2d \
 218             -I$(SHARE_SRC)/native/sun/java2d \
 219             -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders
 220 
 221 ifeq ($(PLATFORM), windows)
 222 CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows
 223 endif
 224 
 225 # Make the Layout Engine build standalone
 226 CPPFLAGS += -DLE_STANDALONE
 227 
 228