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 #In the non-OpenJDK mode we need to build T2K
  94 ifndef OPENJDK
  95 t2k:
  96         $(ECHO) "lib=" $(ACTUAL_LIBRARY)
  97         $(MAKE) -C t2k
  98 
  99 all build: t2k
 100 t2k: library
 101 clean clobber::
 102         $(MAKE) -C t2k clean
 103 else
 104 
 105 FILES_m=mapfile-vers.openjdk
 106 
 107 #make sure freetype dll will be available at runtime as well as link time
 108 #
 109 #NB: Default freetype build system uses -h linker option and 
 110 #   result .so contains hardcoded library name that is later 
 111 #   used for adding dependencies to other objects 
 112 #   (e.g. libfontmanager.so).
 113 #   
 114 #   It is not obvious how to extract that hardcoded name (libfreetype.so.6)
 115 #   without overcomplicating logic here.
 116 #   To workaround this we hardcode .6 suffix for now.
 117 #
 118 #   Note that .so.6 library will not be found by System.loadLibrary()
 119 #        but fortunately we need to load FreeType library explicitly 
 120 #        on windows only  
 121 #
 122 #TODO: rework this to avoid hardcoding library name in the makefile
 123 #
 124 ifeq ($(PLATFORM), windows)
 125     FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX)
 126     OTHER_LDLIBS += $(FREETYPE_LIB_PATH)/freetype.lib
 127 else 
 128   ifeq ($(USING_SYSTEM_FT_LIB), false)
 129     FREETYPE_LIB = $(LIB_LOCATION)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX).6
 130   endif
 131   OTHER_LDLIBS += -L$(FREETYPE_LIB_PATH) -lfreetype
 132 endif 
 133 
 134 library:: $(FREETYPE_LIB)
 135 
 136 $(FREETYPE_LIB):
 137         $(CP) $(FREETYPE_LIB_PATH)/$(LIB_PREFIX)freetype.$(LIBRARY_SUFFIX) $@
 138 endif
 139 
 140 #ifeq ($(PLATFORM), solaris)
 141 #  FILES_reorder += reorder-$(ARCH)
 142 #endif
 143 include $(BUILDDIR)/common/Mapfile-vers.gmk
 144 include $(BUILDDIR)/common/Library.gmk
 145 
 146 .PHONY: t2k build all clean clobber
 147 
 148 #
 149 # Add to the ambient vpath to pick up files in subdirectories
 150 #
 151 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)
 152 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)/layout
 153 vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)
 154 
 155 #
 156 # Fontmanager is headless (independent of X/Motif)
 157 #
 158 CFLAGS       += -DHEADLESS
 159 CXXFLAGS     += -DHEADLESS
 160 
 161 ifndef OPENJDK
 162   CPPFLAGS += -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k
 163 else
 164   CPPFLAGS += -I$(FREETYPE_HEADERS_PATH) -I$(FREETYPE_HEADERS_PATH)/freetype2
 165 endif
 166 
 167 ifeq ($(PLATFORM), windows)
 168 vpath %.cpp   $(PLATFORM_SRC)/native/sun/windows
 169 else # PLATFORM
 170 
 171 #
 172 # Libraries to link, and other C flags.
 173 #
 174 
 175 ifeq ($(PLATFORM), macosx)
 176 OTHER_INCLUDES += -I$(X11_PATH)/include
 177 OTHER_LDLIBS  += -lawt $(LIBM) $(LIBCXX)
 178  ifeq ($(OS_VENDOR),Apple)
 179    # XXXDARWIN Match BSD/Linux behavior -- the mawt.dylib symbols will
 180    # be available at runtime.
 181    OTHER_LDLIBS += -undefined dynamic_lookup
 182  endif
 183 else
 184 ifeq ($(PLATFORM), solaris)
 185   # Note that on Solaris, fontmanager is built against the headless library.
 186   LDFLAGS      += -L$(LIBDIR)/$(LIBARCH)/headless
 187   OTHER_LDLIBS += -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX)
 188 else # PLATFORM is linux
 189  OTHER_LDLIBS  += -lawt $(LIBM) $(LIBCXX)
 190   ifeq ("$(CC_VER_MAJOR)", "3")
 191     OTHER_LDLIBS  += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
 192   endif                           
 193 endif
 194 endif
 195 
 196 endif # PLATFORM
 197 
 198 # set up compile flags..
 199 
 200 ifeq ($(PLATFORM), macosx)
 201 CPPFLAGS += -I$(CLASSHDRDIR)
 202 endif
 203 
 204 CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR) \
 205             -I$(SHARE_SRC)/native/$(PKGDIR)/layout \
 206             -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
 207             -I$(PLATFORM_SRC)/native/sun/awt \
 208             -I$(SHARE_SRC)/native/sun/awt/debug \
 209             -I$(SHARE_SRC)/native/sun/java2d/loops \
 210             -I$(SHARE_SRC)/native/sun/java2d/pipe \
 211             -I$(PLATFORM_SRC)/native/sun/java2d \
 212             -I$(SHARE_SRC)/native/sun/java2d \
 213             -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders
 214 
 215 ifeq ($(PLATFORM), windows)
 216 CPPFLAGS += -I$(PLATFORM_SRC)/native/sun/windows
 217 endif
 218 
 219 # Make the Layout Engine build standalone
 220 CPPFLAGS += -DLE_STANDALONE
 221 
 222