1 #
   2 # Copyright (c) 2000, 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 # to create directory:
  28 #
  29 INIT += $(LIB_LOCATION) 
  30 
  31 #
  32 # Files
  33 #
  34 # mawt.gmk is just used in building X/Motif native code, so
  35 # this list of java files is no longer included.
  36 #include FILES_java_unix.gmk
  37 include $(BUILDDIR)/sun/awt/FILES_c_unix.gmk
  38 
  39 include $(BUILDDIR)/sun/awt/FILES_export_unix.gmk
  40 
  41 # Check which C files should be built.  Headless uses only
  42 # non-motif files.  Also, a version-specific motif file is
  43 # compiled based on the motif version.
  44 FILES_c = $(FILES_NO_MOTIF_c)
  45 
  46 ifeq ($(PLATFORM), solaris)
  47   ifneq ($(ARCH), amd64)
  48     FILES_reorder += reorder-$(ARCH)
  49   endif
  50 endif
  51 
  52 #
  53 # Rules
  54 #
  55 
  56 # Class files should be built & clobbered in make/sun/awt
  57 # If removing this line, also reinclude sun_awt.jmk
  58 DONT_CLOBBER_CLASSES = true
  59 
  60 
  61 ifndef HEADLESS
  62 ifeq ($(VARIANT), OPT)
  63 FILES_m = ../awt/mapfile-mawt-vers
  64 endif
  65 endif
  66 
  67 # Since this library will be living in a subdirectory below the other libraries
  68 #   we need to add an extra runpath so that libraries in the upper directory
  69 #   are found at runtime.
  70 LD_RUNPATH_EXTRAS = ..
  71 
  72 include $(BUILDDIR)/common/Mapfile-vers.gmk
  73 include $(BUILDDIR)/common/Library.gmk
  74 
  75 $(LIB_LOCATION):
  76         $(MKDIR) -p $@
  77 
  78 clean:: 
  79 
  80 #
  81 # Add to the ambient vpath to pick up files in subdirectories
  82 #
  83 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/alphacomposite
  84 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/image
  85 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/image/gif
  86 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/image/cvutils
  87 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/shell
  88 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/medialib
  89 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/../java2d/opengl
  90 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)/../java2d/opengl
  91 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)/../java2d/x11
  92 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/debug
  93 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/../font
  94 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/../java2d
  95 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/../java2d/loops
  96 vpath %.c   $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
  97 vpath %.cpp $(SHARE_SRC)/native/$(PKGDIR)/image
  98 vpath %.c   $(PLATFORM_SRC)/native/$(PKGDIR)/robot_child
  99 
 100 #
 101 # Libraries to link in.
 102 #
 103 
 104 
 105 ifeq ($(DEBUG_BINARIES), true)
 106   CFLAGS += -g
 107 endif
 108 ifeq ($(HEADLESS),true)
 109 CFLAGS += -DHEADLESS=$(HEADLESS)
 110 CPPFLAGS += -DHEADLESS=$(HEADLESS)
 111 OTHER_LDLIBS =
 112 else
 113 LIBXTST = -lXtst
 114 ifeq ($(PLATFORM), linux)
 115    ifeq ($(ARCH_DATA_MODEL), 64)
 116    # XXX what about the rest of them?
 117         LIBXT = -lXt
 118     else
 119     # Allows for builds on Debian GNU Linux, X11 is in a different place 
 120        LIBXT = $(firstword $(wildcard $(OPENWIN_LIB)/libXt.a) \
 121                         $(wildcard /usr/lib/libXt.a))
 122        LIBSM = $(firstword $(wildcard $(OPENWIN_LIB)/libSM.a) \
 123                         $(wildcard /usr/lib/libSM.a))
 124        LIBICE = $(firstword $(wildcard $(OPENWIN_LIB)/libICE.a) \
 125                          $(wildcard /usr/lib/libICE.a))
 126        LIBXTST = $(firstword $(wildcard $(OPENWIN_LIB)/libXtst.a) \
 127                          $(wildcard /usr/lib/libXtst.a))
 128    endif
 129 endif
 130 
 131 # Use -lXmu for EditRes support
 132 LIBXMU_DBG      = -lXmu
 133 LIBXMU_OPT      =
 134 LIBXMU          = $(LIBXMU_$(VARIANT))
 135 
 136 ifeq ($(PLATFORM), solaris)
 137 OTHER_LDLIBS = -lXt -lXext $(LIBXTST) $(LIBXMU) -lX11 -lXi
 138 endif
 139 
 140 ifneq (,$(findstring $(PLATFORM), linux macosx))
 141 OTHER_CFLAGS += -DMLIB_NO_LIBSUNMATH
 142 # XXX what is this define below? Isn't it motif-related?
 143 OTHER_CFLAGS += -DXMSTRINGDEFINES=1
 144 OTHER_LDLIBS =  $(LIBXMU) $(LIBXTST) -lXext $(LIBXT) $(LIBSM) $(LIBICE) -lX11 -lXi
 145 endif
 146 
 147 endif
 148 # !HEADLESS
 149 
 150 OTHER_LDLIBS += $(JVMLIB) $(LIBCXX) \
 151                 -lawt $(LIBM) $(LIBDL)
 152 
 153 #
 154 # Sun CC with -Xa misdefines __STDC__ to 0 (zero).
 155 # The following will force checking of X11 prototypes.
 156 # 
 157 ifneq ($(CC_VERSION),gcc)
 158 CPPFLAGS += -DFUNCPROTO=15
 159 endif
 160 
 161 #
 162 # Other extra flags needed for compiling.
 163 #
 164 CPPFLAGS += -I$(CUPS_HEADERS_PATH)
 165 
 166 ifndef HEADLESS
 167 CPPFLAGS += -I$(OPENWIN_HOME)/include 
 168 LDFLAGS  += -L$(OPENWIN_LIB)
 169 
 170 endif # !HEADLESS
 171 
 172 CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/debug \
 173             -I$(SHARE_SRC)/native/$(PKGDIR)/../font \
 174             -I$(PLATFORM_SRC)/native/$(PKGDIR)/../font \
 175             -I$(SHARE_SRC)/native/$(PKGDIR)/image \
 176             -I$(SHARE_SRC)/native/$(PKGDIR)/image/cvutils \
 177             -I$(SHARE_SRC)/native/$(PKGDIR)/shell \
 178             -I$(SHARE_SRC)/native/$(PKGDIR)/alphacomposite \
 179             -I$(SHARE_SRC)/native/$(PKGDIR)/medialib \
 180             -I$(PLATFORM_SRC)/native/$(PKGDIR)/medialib \
 181             -I$(SHARE_SRC)/native/$(PKGDIR)/../java2d \
 182             -I$(PLATFORM_SRC)/native/$(PKGDIR)/../java2d \
 183             -I$(SHARE_SRC)/native/$(PKGDIR)/../java2d/loops \
 184             -I$(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe \
 185             -I$(SHARE_SRC)/native/$(PKGDIR)/../java2d/opengl \
 186             -I$(PLATFORM_SRC)/native/$(PKGDIR)/../java2d/opengl \
 187             -I$(PLATFORM_SRC)/native/$(PKGDIR)/../java2d/x11 \
 188         -I$(SHARE_SRC)/native/$(PKGDIR)/../dc/doe \
 189         -I$(SHARE_SRC)/native/$(PKGDIR)/../dc/path \
 190             -I$(PLATFORM_SRC)/native/$(PKGDIR)/../jdga \
 191         -I$(PLATFORM_SRC)/native/$(PKGDIR) \
 192         $(EVENT_MODEL)
 193 
 194 ifeq ($(PLATFORM), macosx)
 195 CPPFLAGS += -I$(CUPS_HEADERS_PATH)
 196 
 197 ifndef HEADLESS
 198 CPPFLAGS += -I$(MOTIF_DIR)/include \
 199             -I$(OPENWIN_HOME)/include 
 200 LDFLAGS  += -L$(MOTIF_LIB) -L$(OPENWIN_LIB)
 201 
 202 endif # !HEADLESS
 203 endif # PLATFORM
 204 
 205 ifeq ($(PLATFORM), linux)
 206   # Checking for the X11/extensions headers at the additional location
 207   CPPFLAGS += -I$(firstword $(wildcard $(OPENWIN_HOME)/include/X11/extensions) \
 208                         $(wildcard /usr/include/X11/extensions))
 209 endif
 210 
 211 ifeq ($(PLATFORM), macosx)
 212   CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \
 213               -I$(OPENWIN_HOME)/include 
 214 endif
 215 
 216 ifeq ($(PLATFORM), solaris)
 217   CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
 218 endif
 219 
 220 ifeq ($(PLATFORM), macosx)
 221   CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 222 endif
 223 
 224 LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \
 225            $(AWT_RUNPATH)
 226 
 227 CLASSES.export += java.io.InputStream \
 228                   java.lang.ThreadGroup
 229