#
# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

#
# Makefile for building t2k rasteriser.
#

BUILDDIR = ../../..
PACKAGE = sun.font
LIBRARY = t2k
PRODUCT = sun

# Indicate we want the C++ compiler to do the linking.
CPLUSPLUSLIBRARY=true

# Part of the sun.font package, but doesn't rebuild classes (except
# for a few ones with native methods) so shouldn't clobber them.
DONT_CLOBBER_CLASSES=true

include $(BUILDDIR)/common/Defs.gmk

#
# Use higher optimization level
#
_OPT = $(CC_HIGHER_OPT)

#
# Files
#
include FILES_c.gmk

FILES_export = \
        sun/font/FileFont.java \
        sun/font/FileFontStrike.java \
        sun/font/FontManager.java \
        sun/font/TrueTypeFont.java \
        sun/font/Type1Font.java

ifeq ($(PLATFORM), windows)

  # Files built here do not compile with warning level 3 if warnings are fatal
  COMPILER_WARNINGS_FATAL=false

  LDLIBS += user32.lib 

  ifeq ($(BCHECKER), 1)
    CC = C:/BChecker/nmcl.exe
  endif

  OTHER_CFLAGS += -DCC_NOEX
  OTHER_CXXFLAGS += -DCC_NOEX

endif # PLATFORM

#  Setting this variable is sufficient to trigger copying a pre-built
# library using rules in Library.gmk instead of building.
ifdef OPENJDK
  USE_CLOSED_LIB=true
  FILES_export = 
endif

include $(BUILDDIR)/common/Mapfile-vers.gmk
include $(BUILDDIR)/common/Library.gmk

ifdef OPENJDK
ifeq ($(PLATFORM),windows)
# Need to copy the import file to link against.
build: $(OBJDIR)/t2k.lib
endif
endif

#
# Add to the ambient vpath to pick up files in subdirectories
#
vpath %.c   $(SHARE_SRC)/share/native/$(PKGDIR)
vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)
vpath %.c   $(CLOSED_SRC)/share/native/$(PKGDIR)/t2k
vpath %.c   $(CLOSED_SRC)/share/native/$(PKGDIR)/t2k/ttHints

vpath %.cpp   $(SHARE_SRC)/native/$(PKGDIR)

# Libraries to link, and other C flags.
#
# setup the list of libraries to link in...
OTHER_LDLIBS  +=  $(LIBM) $(LIBCXX)
ifeq ($(PLATFORM), linux)
  ifeq ("$(CC_VER_MAJOR)", "3")
    OTHER_LDLIBS  += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
  endif                           
endif

# set up compile flags..

CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR) \
            -I$(CLOSED_SRC)/share/native/$(PKGDIR)/t2k \
            -I$(SHARE_SRC)/share/native/$(PKGDIR) \
            -I$(PLATFORM_SRC)/native/$(PKGDIR) \
            -I$(SHARE_SRC)/native/sun/java2d/loops \
            -I$(SHARE_SRC)/native/sun/java2d/pipe \
            -I$(PLATFORM_SRC)/native/sun/java2d \
            -I$(SHARE_SRC)/native/sun/java2d \
            -I$(TEMPDIR)/../fontmanager/CClassHeaders
