jdk/make/modules/Makefile
changeset 4524 697144bd8b04
child 4665 d14dc3d9e1fa
equal deleted inserted replaced
4523:87292b2c6421 4524:697144bd8b04
       
     1 #
       
     2 # Copyright 2009 Sun Microsystems, Inc.  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.  Sun designates this
       
     8 # particular file as subject to the "Classpath" exception as provided
       
     9 # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
       
    23 # have any questions.
       
    24 #
       
    25 
       
    26 #
       
    27 # Modularizing the JDK
       
    28 #
       
    29 
       
    30 BUILDDIR = ..
       
    31 include $(BUILDDIR)/common/Defs.gmk
       
    32 
       
    33 CLASSANALYZER_JAR=$(BUILDTOOLJARDIR)/classanalyzer.jar
       
    34 JAVA_FLAGS=$(JAVA_TOOLS_FLAGS) -Xbootclasspath:$(CLASSBINDIR)
       
    35 
       
    36 MODULE_LIB = $(ABS_OUTPUTDIR)/modules
       
    37 MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf
       
    38 MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
       
    39 
       
    40 TMP=$(ABS_TEMPDIR)/modules
       
    41 MODULE_CLASSLIST = $(TMP)/classlist
       
    42 MODULE_CLASSES = $(TMP)/classes
       
    43 MODULE_LIST = $(MODULE_CLASSLIST)/modules.list
       
    44 
       
    45 # Modules in the modules/ext directory
       
    46 EXT_MODULES = localedata security-sunec security-sunjce
       
    47 
       
    48 # Build PKCS#11 on all platforms except 64-bit Windows.
       
    49 # We exclude windows-amd64 because we don't have any
       
    50 # 64-bit PKCS#11 implementations to test with on that platform.
       
    51 PKCS11 = security-sunpkcs11
       
    52 ifeq ($(ARCH_DATA_MODEL), 64)
       
    53   ifeq ($(PLATFORM), windows)
       
    54     PKCS11 =
       
    55   endif
       
    56 endif
       
    57 
       
    58 EXT_MODULES += $(PKCS11)
       
    59 
       
    60 # Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform.
       
    61 ifeq ($(PLATFORM), windows)
       
    62   ifneq ($(ARCH_DATA_MODEL), 64)
       
    63     EXT_MODULES += security-sunmscapi
       
    64   endif
       
    65 endif
       
    66 
       
    67 
       
    68 JDK_MODULES = tools
       
    69 
       
    70 SUBDIRS = tools
       
    71 all build clean clobber::
       
    72 	$(SUBDIRS-loop)
       
    73 
       
    74 all:: unpack-jars gen-classlist modularize
       
    75 
       
    76 $(CLASSANALYZER_JAR):
       
    77 	$(CD) tools && $(MAKE) all
       
    78 
       
    79 JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -depth) 
       
    80 unpack-jars:
       
    81 	$(RM) -rf $(MODULE_CLASSES)
       
    82 	$(MKDIR) -p $(MODULE_CLASSES)
       
    83 	$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES)
       
    84 	for jf in  $(JAR_LIST) ; do \
       
    85 	   $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\
       
    86 	done
       
    87 
       
    88 gen-classlist: $(CLASSANALYZER_JAR)
       
    89 	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
       
    90 	@$(RM) -rf $(MODULE_CLASSLIST)
       
    91 	@$(MKDIR) -p $(MODULE_CLASSLIST)
       
    92 
       
    93 	@# Use java in the default tool directory.
       
    94 	@# OUTPUTDIR for solaris 64-bit doesn't have the tools.
       
    95 	$(JAVA_TOOLS_DIR)/java $(JAVA_FLAGS) \
       
    96 		-Dclassanalyzer.debug \
       
    97 		-jar $(CLASSANALYZER_JAR) \
       
    98 		-jdkhome $(OUTPUTDIR) \
       
    99 	        -config modules.config \
       
   100 	        -config modules.group \
       
   101 		-depconfig jdk7.depconfig \
       
   102 		-depconfig optional.depconfig \
       
   103 		-showdynamic \
       
   104 		-output $(MODULE_CLASSLIST)
       
   105 	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
       
   106 
       
   107 modularize: $(MODULE_JAR_MANIFEST_FILE)
       
   108 	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
       
   109 	@$(RM) -rf $(MODULE_LIB)
       
   110 	@$(MKDIR) -p $(MODULE_LIB)/lib
       
   111 	@$(MKDIR) -p $(MODULE_LIB)/jre/lib/ext
       
   112 
       
   113 	@# create modules
       
   114 	for m in `$(NAWK) '{print $$1}' $(MODULE_LIST)` ; do \
       
   115    	   $(ECHO) "Creating module $$m" ; \
       
   116    	   $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \
       
   117 	   if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \
       
   118    	       $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \
       
   119            fi ; \
       
   120 	   $(CD) $(MODULE_CLASSES) && \
       
   121                $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \
       
   122 		   $(MODULE_LIB)/$$m.jar \
       
   123 		   @$(TMP)/tmp.cf \
       
   124                    $(BOOT_JAR_JFLAGS) ; \
       
   125 	done
       
   126 	@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup)
       
   127 	@# move modules to lib, jre/lib, or jre/lib/ext
       
   128 	for m in $(EXT_MODULES) ; do \
       
   129 	   $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/jre/lib/ext ; \
       
   130 	done
       
   131 	for m in $(JDK_MODULES) ; do \
       
   132 	   $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/lib ; \
       
   133 	done
       
   134 	$(MV) $(MODULE_LIB)/*.jar $(MODULE_LIB)/jre/lib
       
   135 	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
       
   136 
       
   137 $(MODULE_JAR_MANIFEST_FILE):
       
   138 	$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@
       
   139 
       
   140 clean clobber::
       
   141 	$(RM) -rf $(MODULE_CLASSLIST)
       
   142 	$(RM) -rf $(MODULE_LIB)
       
   143 	$(RM) -f $(MODULE_JAR_MANIFEST_FILE)
       
   144 	$(RM) -f $(CLASSANALYZER_JAR)
       
   145