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