1 #
   2 # Copyright (c) 1996, 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 #
  27 # Makefile for character converters.
  28 #
  29 
  30 BUILDDIR = ../../..
  31 
  32 # charsets should be separated from nio module 
  33 MODULE  = charsets
  34 PACKAGE = sun.nio
  35 PRODUCT = sun
  36 
  37 # This re-directs all the class files to a separate location
  38 CLASSDESTDIR = $(TEMPDIR)/classes
  39 
  40 OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
  41 include $(BUILDDIR)/common/Defs.gmk
  42 
  43 #
  44 # Files
  45 #
  46 include FILES_java.gmk
  47 AUTO_FILES_JAVA_DIRS = sun/nio/cs/ext
  48 
  49 # For Cygwin, command line arguments that are paths must be converted to
  50 # windows style paths. These paths cannot be used as targets, however, because 
  51 # the ":" in them  will interfere with GNU Make rules, generating "multiple
  52 # target pattern" errors.
  53 
  54 # this define is for the rule:
  55 CHARSETS_JAR = $(LIBDIR)/charsets.jar
  56 
  57 # extcs
  58 FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java)
  59 
  60 #
  61 # These sun.awt charsets use sun/nio/cs/ext charsets that only exist
  62 # in JDK7 charsets.jar, which causes problem when build the symbol
  63 # table for rt.jar in Release.gmk. They are now removed from the
  64 # rt.jar when building jdk/jre image (in Release.gmk), so add them
  65 # into charsets.jar here
  66 #
  67 ifeq ($(PLATFORM), windows)
  68 FILES_src += \
  69         sun/awt/HKSCS.java
  70 else
  71 # Solaris/Linux
  72 FILES_src += \
  73         sun/awt/HKSCS.java \
  74         sun/awt/motif/X11GB2312.java \
  75         sun/awt/motif/X11GBK.java \
  76         sun/awt/motif/X11KSC5601.java
  77 endif # PLATFORM
  78 
  79 #
  80 # Rules
  81 #
  82 include $(BUILDDIR)/common/Classes.gmk
  83 
  84 build: $(FILES_genout_extcs) $(CHARSETS_JAR)
  85 
  86 #
  87 # Extra rules to build character converters.
  88 
  89 SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider
  90 SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION)
  91 
  92 GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping
  93 GENCSSRCDIR = $(BUILDDIR)/tools/src/build/tools/charsetmapping
  94 GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext
  95 
  96 FILES_MAP = $(GENCSDATASRC)/sjis0213.map
  97 FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat
  98 CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar
  99 
 100 $(FILES_DAT): $(FILES_MAP)
 101         @$(prep-target)
 102         $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \
 103                 $(FILES_MAP) $(FILES_DAT) sjis0213
 104 
 105 
 106 $(FILES_genout_extcs): \
 107                 $(GENCSDATASRC)/SingleByte-X.java.template  \
 108                 $(GENCSDATASRC)/DoubleByte-X.java.template \
 109                 $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
 110         @$(prep-target)
 111         $(RM) -r $(GENCSEXT)
 112         $(MKDIR) -p $(GENCSEXT)
 113         $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
 114         $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
 115                 $(GENCSSRCDIR)/EUC_TW.java
 116         $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) hkscs \
 117                 $(GENCSSRCDIR)/HKSCS.java
 118         $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) dbcs
 119 
 120 $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \
 121   $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH)
 122         $(install-file)
 123 
 124 $(CHARSETS_JAR): $(FILES_class) $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH) $(FILES_DAT)
 125         $(BOOT_JAR_CMD) cf0 $(CHARSETS_JAR) \
 126               -C $(CLASSDESTDIR) sun \
 127               -C $(CLASSDESTDIR) $(SERVICE_DESCRIPTION_PATH)  \
 128               $(BOOT_JAR_JFLAGS)
 129         @$(java-vm-cleanup)
 130 
 131 clean::
 132         $(RM) -r $(CLASSDESTDIR)
 133         $(RM) $(CHARSETS_JAR)