1 #
   2 # Copyright (c) 2002, 2010, 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 BUILDDIR = ../..
  27 MODULE  = awt
  28 PACKAGE = sun.awt.X11
  29 LIBRARY = mawt
  30 LIBRARY_OUTPUT = xawt
  31 LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/xawt
  32 PRODUCT = sun
  33 
  34 include $(BUILDDIR)/common/Defs.gmk
  35 
  36 GEN_DIR=$(GENSRCDIR)/sun/awt/X11
  37 
  38 CLASSES_INIT += $(TEMPDIR)/.gen.wrappers $(TEMPDIR)/.gen_icons touch.wrappers
  39 
  40 .PHONY: generated.clean
  41 
  42 #
  43 # Files
  44 #
  45 include FILES_c_unix.gmk
  46 include FILES_export_unix.gmk
  47 AUTO_FILES_JAVA_DIRS = sun/awt/X11
  48 AUTO_JAVA_PRUNE = WrapperGenerator.java
  49 
  50 LDFLAGS += -L$(OPENWIN_LIB)
  51 
  52 # For Xrender extension.
  53 ifeq ($(PLATFORM), solaris)
  54 LDFLAGS += -L/usr/openwin/sfw/lib$(ISA_DIR) -R/usr/openwin/sfw/lib$(ISA_DIR)
  55 endif
  56 
  57 ifeq ($(PLATFORM), linux)
  58 LDFLAGS += -lpthread
  59 dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
  60 endif
  61 
  62 # Since this library will be living in a subdirectory below the other libraries
  63 #   we need to add an extra runpath so that libraries in the upper directory
  64 #   are found at runtime.
  65 LD_RUNPATH_EXTRAS = ..
  66 
  67 #
  68 # Rules.
  69 #
  70 include $(BUILDDIR)/common/Mapfile-vers.gmk
  71 include $(BUILDDIR)/common/Library.gmk
  72 
  73 #
  74 # Add to the ambient vpath to pick up files in subdirectories
  75 #
  76 vpath %.c   $(SHARE_SRC)/native/sunawt/alphacomposite
  77 vpath %.c   $(PLATFORM_SRC)/native/sun/xawt
  78 vpath %.c   $(PLATFORM_SRC)/native/sun/awt
  79 vpath %.c   $(SHARE_SRC)/native/sun/awt/debug
  80 vpath %.c   $(SHARE_SRC)/native/sun/awt/image
  81 vpath %.c   $(SHARE_SRC)/native/sun/awt/image/gif
  82 vpath %.c   $(SHARE_SRC)/native/sun/awt/image/cvutils
  83 vpath %.c   $(SHARE_SRC)/native/sun/awt/shell
  84 vpath %.c   $(SHARE_SRC)/native/sun/java2d
  85 vpath %.c   $(SHARE_SRC)/native/sun/java2d/loops
  86 vpath %.c   $(SHARE_SRC)/native/sun/java2d/pipe
  87 vpath %.c   $(SHARE_SRC)/native/sun/awt/medialib
  88 vpath %.c   $(SHARE_SRC)/native/sun/awt/utility
  89 vpath %.cpp $(SHARE_SRC)/native/sun/image
  90 vpath %.c   $(SHARE_SRC)/native/sun/font
  91 vpath %.c   $(PLATFORM_SRC)/native/sun/awt/robot_child
  92 vpath %.c   $(SHARE_SRC)/native/sun/java2d/opengl
  93 vpath %.c   $(PLATFORM_SRC)/native/sun/java2d/opengl
  94 vpath %.c   $(PLATFORM_SRC)/native/sun/java2d/x11
  95 
  96 OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender -ldl \
  97                    $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi
  98 
  99 ifeq  ($(PLATFORM), solaris)
 100 CPPFLAGS += -DFUNCPROTO=15
 101 dummy := $(shell $(MKDIR) -p $(LIB_LOCATION))
 102 endif
 103 
 104 CPPFLAGS += -I$(CUPS_HEADERS_PATH)
 105 
 106 CPPFLAGS += -DXAWT -DXAWT_HACK \
 107         -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders \
 108         -I$(PLATFORM_SRC)/native/sun/awt \
 109         -I$(PLATFORM_SRC)/native/sun/xawt \
 110         -I$(PLATFORM_SRC)/native/sun/jdga \
 111         -I$(SHARE_SRC)/native/sun/awt/debug \
 112         -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
 113         -I$(SHARE_SRC)/native/sun/java2d \
 114         -I$(SHARE_SRC)/native/sun/java2d/loops \
 115         -I$(SHARE_SRC)/native/sun/awt/image/cvutils \
 116         -I$(SHARE_SRC)/native/sun/awt/image \
 117         -I$(SHARE_SRC)/native/sun/font \
 118         -I$(PLATFORM_SRC)/native/sun/java2d \
 119         -I$(SHARE_SRC)/native/sun/java2d/pipe \
 120         -I$(SHARE_SRC)/native/sun/java2d/opengl \
 121         -I$(PLATFORM_SRC)/native/sun/java2d/opengl \
 122         -I$(PLATFORM_SRC)/native/sun/java2d/x11 \
 123         -I$(SHARE_SRC)/native/sun/dc/path \
 124         -I$(SHARE_SRC)/native/sun/dc/doe \
 125         -I$(SHARE_SRC)/native/sun/awt/alphacomposite \
 126         -I$(SHARE_SRC)/native/sun/awt/medialib \
 127         -I$(PLATFORM_SRC)/native/sun/awt/medialib \
 128         -I$(PLATFORM_SRC)/native/sun/font \
 129         -I$(SHARE_SRC)/native/sun/awt \
 130         -I$(PLATFORM_SRC)/native/sun/awt
 131 
 132 ifeq ($(PLATFORM), linux)
 133 # Allows for builds on Debian GNU Linux, X11 is in a different place 
 134   CPPFLAGS += -I/usr/X11R6/include/X11/extensions \
 135               -I/usr/include/X11/extensions \
 136               -I$(OPENWIN_HOME)/include 
 137 endif
 138 
 139 ifeq ($(PLATFORM), solaris)
 140   CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions
 141 endif
 142 
 143 ifeq ($(MILESTONE), internal)
 144   CPPFLAGS += -DINTERNAL_BUILD
 145 endif
 146 
 147 #
 148 # Generation of wrappers
 149 #
 150 SIZER_DIR=$(GEN_DIR)/generator
 151 SIZER = $(SIZER_DIR)/sizer
 152 SIZER_32_C = $(SIZER).32.c
 153 SIZER_64_C = $(SIZER).64.c
 154 CFLAGS_32=$(CFLAGS)
 155 CFLAGS_64=$(CFLAGS)
 156 
 157 ifeq ($(PLATFORM), solaris)
 158 
 159 isalist:=$(shell $(ISAINFO))
 160 
 161 ifneq (,$(findstring sparcv9, $(isalist)))
 162 # On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
 163 # On sparcv9 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option.
 164 CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS))
 165 SIZERS = $(SIZER).32 $(SIZER).64
 166 SIZERS_C = $(SIZER_32_C) $(SIZER_64_C)
 167 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64
 168 CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64)
 169 else
 170 ifneq (,$(findstring amd64, $(isalist)))
 171 # On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
 172 # On amd64 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option.
 173 CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS))
 174 SIZERS = $(SIZER).32 $(SIZER).64
 175 SIZERS_C = $(SIZER_32_C) $(SIZER_64_C)
 176 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64
 177 CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64)
 178 else # !sparcv9 : includes (32-bit) sparc, i586
 179 SIZERS = $(SIZER).32
 180 SIZERS_C = $(SIZER_32_C)
 181 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32
 182 endif # amd64
 183 endif # sparcv9
 184 
 185 else # !solaris
 186 
 187 ifeq ($(ARCH_DATA_MODEL), 32)
 188 SIZERS = $(SIZER).32
 189 SIZERS_C = $(SIZER_32_C)
 190 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32
 191 else # !32
 192 SIZERS = $(SIZER).64
 193 SIZERS_C = $(SIZER_64_C)
 194 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.64
 195 endif # 32
 196 
 197 endif # solaris
 198 
 199 # XXX Hack for 6185483 - use hard-coded sizes.
 200 # Add the 64-bit platforms that need to be included into 32-bit build
 201 # and have sizes.64-$(PLATFORM)-$(LIBARCH) hardcoded in the workspace
 202 ifeq ($(PLATFORM)-$(LIBARCH), solaris-i386)
 203 # If you define DOHACK=true for some combination of $(PLATFORM)-$(LIBARCH),
 204 # make sure you have sizes.64-$(PLATFORM)-$(LIBARCH) pre-generated in
 205 # $(PLATFORM_SRC)/classes/sun/awt/X11/generator/
 206 DOHACK=true
 207 endif # Hack
 208 
 209 ifeq ($(DOHACK), true)
 210 PREDEFINED_SIZES_TMPL=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-$(PLATFORM)-$(LIBARCH)
 211 PREDEFINED_SIZES=$(WRAPPER_GENERATOR_DIR)/sizes.64
 212 SIZES += $(WRAPPER_GENERATOR_DIR)/sizes.64
 213 endif
 214 
 215 ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
 216 DOCOMPARE=true
 217 endif
 218 # 64 bit sizers are generated on platform-libarch (left) for use 
 219 # on platform-libarch (right) and stored under the latter name.
 220 # Do compare manually stored and automatically generated pair(s) 
 221 # if DOCOMPARE=true, just after the generation.
 222 STORED_SIZES_TMPL_solaris_amd64=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-solaris-i386
 223 
 224 WRAPPER_GENERATOR_JAVA=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/WrapperGenerator.java
 225 WRAPPER_GENERATOR_DIR=$(GENSRCDIR)/sun/awt/X11/generator
 226 WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator
 227 WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class 
 228 XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt
 229 
 230 $(SIZERS): $(SIZERS_C) 
 231         $(prep-target)
 232         $(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
 233 
 234 $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
 235         $(prep-target)
 236         $(BOOT_JAVAC_CMD) -d $(WRAPPER_GENERATOR_TEMPDIR) $(WRAPPER_GENERATOR_JAVA)
 237 
 238 $(SIZERS_C): $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
 239         $(prep-target)
 240         $(MKDIR) -p $(WRAPPER_GENERATOR_TEMPDIR)
 241         $(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \
 242             $(SIZER_DIR) $(XLIBTYPES) "sizer" $(subst .,,$(suffix $(basename $@)))
 243 
 244 $(SIZES): $(SIZERS)
 245         @if [ "$(DOHACK)$@" = "true$(PREDEFINED_SIZES)" ]; then \
 246             $(ECHO) COPYING $(PREDEFINED_SIZES_TMPL) into $@; \
 247             $(CP) $(PREDEFINED_SIZES_TMPL) $@; \
 248             $(CHMOD) +w $@;\
 249         else    \
 250             $(ECHO) GENERATING $@; \
 251             $(WRAPPER_GENERATOR_DIR)/sizer$(suffix $@) > $@; \
 252         fi
 253         @if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \
 254             $(ECHO) COMPARING $@ and $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
 255             $(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
 256         fi
 257 
 258 $(TEMPDIR)/.gen.wrappers: $(SIZES) $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES)
 259         $(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \
 260             $(GEN_DIR) $(XLIBTYPES) "gen" $(WRAPPER_GENERATOR_DIR)/sizes
 261 
 262 touch.wrappers: $(TEMPDIR)/.gen.wrappers
 263         $(MKDIR) -p $(TEMPDIR)
 264         $(TOUCH) $(TEMPDIR)/.gen.wrappers
 265 
 266 generated.clean:
 267         $(RM) -r $(WRAPPER_GENERATOR_TEMPDIR)
 268         $(RM) -r $(WRAPPER_GENERATOR_DIR)
 269         $(RM) -r $(GEN_DIR)/*.java
 270         $(RM) -r $(TEMPDIR)/.gen_icons
 271 
 272 ifdef OPENJDK
 273     ICONS_PATH_PREFIX=$(PLATFORM_SRC)
 274 else
 275     ICONS_PATH_PREFIX=$(CLOSED_SRC)/solaris
 276 endif
 277 
 278 ICONS = \
 279     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon16.png \
 280     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon24.png \
 281     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon32.png \
 282     $(ICONS_PATH_PREFIX)/classes/sun/awt/X11/java-icon48.png
 283 
 284 
 285 ICONPATH=$(PLATFORM_SRC)/classes/sun/awt/X11
 286 
 287 ICONS += \
 288    $(ICONPATH)/security-icon-bw16.png \
 289    $(ICONPATH)/security-icon-interim16.png \
 290    $(ICONPATH)/security-icon-yellow16.png \
 291    $(ICONPATH)/security-icon-bw24.png \
 292    $(ICONPATH)/security-icon-interim24.png \
 293    $(ICONPATH)/security-icon-yellow24.png \
 294    $(ICONPATH)/security-icon-bw32.png \
 295    $(ICONPATH)/security-icon-interim32.png \
 296    $(ICONPATH)/security-icon-yellow32.png \
 297    $(ICONPATH)/security-icon-bw48.png \
 298    $(ICONPATH)/security-icon-interim48.png \
 299    $(ICONPATH)/security-icon-yellow48.png
 300 
 301 TEMPDIR_CLASSES = $(TEMPDIR)/classes
 302 
 303 $(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class: ToBin.java
 304         @$(prep-target)
 305         $(BOOT_JAVAC_CMD) -d $(TEMPDIR_CLASSES) $<
 306 
 307 $(TEMPDIR)/.gen_icons: $(TEMPDIR_CLASSES)/sun/awt/X11/ToBin.class $(ICONS)
 308         $(prep-target)
 309         for i in $(ICONS); do \
 310             filename=`basename $$i`; \
 311             name=`$(ECHO) $$filename | $(TR) '\-.' '__'`;  \
 312             classname=$(GEN_DIR)/XAWTIcon32_$$name.java; \
 313             $(RM) $$classname; \
 314             $(ECHO) "package sun.awt.X11;" >> $$classname ; \
 315             $(ECHO) "public class XAWTIcon32_$$name {" >> $$classname; \
 316             $(ECHO) "public static int[] $$name = { " >> $$classname;  \
 317             $(CAT) $$i | \
 318               $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
 319                 -Djava.awt.headless=true \
 320                 sun.awt.X11.ToBin >> $$classname; \
 321             $(ECHO) "}; }" >> $$classname;  \
 322             classname=$(GEN_DIR)/XAWTIcon64_$$name.java; \
 323             $(RM) $$classname; \
 324             $(ECHO) "package sun.awt.X11;" >> $$classname ; \
 325             $(ECHO) "public class XAWTIcon64_$$name {" >> $$classname; \
 326             $(ECHO) "public static long[] $$name = { " >> $$classname;  \
 327             $(CAT) $$i | \
 328               $(BOOT_JAVA_CMD) -cp $(TEMPDIR_CLASSES)  \
 329                 -Djava.awt.headless=true \
 330                 sun.awt.X11.ToBin >> $$classname; \
 331             $(ECHO) "}; }" >> $$classname;  \
 332         done
 333         $(TOUCH) $@
 334 
 335 clean clobber:: generated.clean
 336 
 337 .PHONY: generated.clean robot_child
 338 
--- EOF ---