1 #
   2 # Copyright (c) 2012, 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 GENSRC_X11WRAPPERS :=
  27 GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
  28 
  29 GENSRC_SIZER_SRC := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator
  30 
  31 GENSRC_SIZES :=
  32 
  33 ifeq ($(PLATFORM)-$(LIBARCH), solaris-i386)
  34 GENSRC_SIZES := sizes.32 sizes.64
  35 else ifeq ($(PLATFORM), solaris)
  36 isalist:=$(shell $(ISAINFO))
  37 ifneq (,$(findstring sparcv9, $(isalist)))
  38 # On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
  39 GENSRC_SIZES := sizes.32 sizes.64
  40 else
  41 ifneq (,$(findstring amd64, $(isalist)))
  42 # On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL.
  43 GENSRC_SIZES := sizes.32 sizes.64
  44 else # !sparcv9 : includes (32-bit) sparc, i586
  45 GENSRC_SIZES := sizes.32
  46 endif # amd64
  47 endif # sparcv9
  48 else # !solaris
  49 ifeq ($(PLATFORM), macosx)
  50 GENSRC_SIZES := sizes.32 sizes.64
  51 else # !macosx
  52 GENSRC_SIZES := sizes.$(ARCH_DATA_MODEL)
  53 endif # !macosx
  54 endif # solaris
  55 
  56 
  57 ##########################################################################################
  58 
  59 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c : $(GENSRC_SIZER_SRC)/xlibtypes.txt
  60         $(MKDIR) -p $(@D)
  61         $(RM) $@
  62         $(TOOL_WRAPPERGENERATOR) $(@D) $< "sizer" $*
  63 
  64 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.c
  65         (cd $(@D) && $(CC) -m$* -o $@ $< $(CFLAGS_JDKLIB) \
  66               -I$(JDK_TOPDIR)/src/solaris/native/sun/awt \
  67               -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
  68               -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils -lc)
  69 
  70 ifeq ($(PLATFORM)-$(LIBARCH), solaris-i386)
  71 
  72 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.32 : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.32.exe
  73         $< > $@.tmp
  74         $(MV) $@.tmp $@
  75 
  76 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.64 : $(JDK_TOPDIR)/src/$(LEGACY_HOST_OS_API)/classes/sun/awt/X11/generator/sizes.64-$(PLATFORM)-$(LIBARCH)
  77         $(MKDIR) -p $(@D)
  78         $(CP) $< $@
  79 else
  80 
  81 $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes.% : $(GENSRC_X11WRAPPERS_TMP)/sizer/sizer.%.exe
  82         $< > $@.tmp
  83         $(MV) $@.tmp $@
  84 
  85 endif
  86 
  87 $(GENSRC_X11WRAPPERS_TMP)/classes/_the.classes : $(foreach S,$(GENSRC_SIZES),$(GENSRC_X11WRAPPERS_TMP)/sizer/$(S))
  88         $(MKDIR) -p $(@D)/sun/awt/X11
  89         $(RM) $(@D)/sun/awt/X11/*
  90         $(TOOL_WRAPPERGENERATOR) $(@D)/sun/awt/X11 $(GENSRC_SIZER_SRC)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizer/sizes
  91 ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
  92         $(ECHO) COMPARING $@ and $(GENSRC_SIZER_SRC)/sizes.64-$(PLATFORM)-i386
  93         $(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.64 $(GENSRC_SIZER_SRC)/sizes.64-$(PLATFORM)-i386
  94 endif
  95         $(TOUCH) $@
  96 
  97 GENSRC_X11WRAPPERS += $(GENSRC_X11WRAPPERS_TMP)/classes/_the.classes