jdk/make/modules/Makefile
author mchung
Fri, 18 Dec 2009 11:36:23 -0800
changeset 4524 697144bd8b04
child 4665 d14dc3d9e1fa
permissions -rw-r--r--
6909572: Add a new target for building modules Summary: Add a new "modules" build target that builds jdk and jre module image Reviewed-by: alanb, ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4524
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     1
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     2
# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     4
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    10
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    15
# accompanied this code).
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    16
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    20
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    23
# have any questions.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    24
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    25
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    26
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    27
# Modularizing the JDK
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    28
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    29
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    30
BUILDDIR = ..
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    31
include $(BUILDDIR)/common/Defs.gmk
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    32
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    33
CLASSANALYZER_JAR=$(BUILDTOOLJARDIR)/classanalyzer.jar
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    34
JAVA_FLAGS=$(JAVA_TOOLS_FLAGS) -Xbootclasspath:$(CLASSBINDIR)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    35
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    36
MODULE_LIB = $(ABS_OUTPUTDIR)/modules
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    37
MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    38
MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    39
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    40
TMP=$(ABS_TEMPDIR)/modules
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    41
MODULE_CLASSLIST = $(TMP)/classlist
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    42
MODULE_CLASSES = $(TMP)/classes
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    43
MODULE_LIST = $(MODULE_CLASSLIST)/modules.list
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    44
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    45
# Modules in the modules/ext directory
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    46
EXT_MODULES = localedata security-sunec security-sunjce
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    47
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    48
# Build PKCS#11 on all platforms except 64-bit Windows.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    49
# We exclude windows-amd64 because we don't have any
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    50
# 64-bit PKCS#11 implementations to test with on that platform.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    51
PKCS11 = security-sunpkcs11
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    52
ifeq ($(ARCH_DATA_MODEL), 64)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    53
  ifeq ($(PLATFORM), windows)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    54
    PKCS11 =
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    55
  endif
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    56
endif
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    57
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    58
EXT_MODULES += $(PKCS11)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    59
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    60
# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    61
ifeq ($(PLATFORM), windows)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    62
  ifneq ($(ARCH_DATA_MODEL), 64)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    63
    EXT_MODULES += security-sunmscapi
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    64
  endif
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    65
endif
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    66
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    67
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    68
JDK_MODULES = tools
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    69
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    70
SUBDIRS = tools
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    71
all build clean clobber::
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    72
	$(SUBDIRS-loop)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    73
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    74
all:: unpack-jars gen-classlist modularize
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    75
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    76
$(CLASSANALYZER_JAR):
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    77
	$(CD) tools && $(MAKE) all
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    78
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    79
JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -depth) 
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    80
unpack-jars:
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    81
	$(RM) -rf $(MODULE_CLASSES)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    82
	$(MKDIR) -p $(MODULE_CLASSES)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    83
	$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    84
	for jf in  $(JAR_LIST) ; do \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    85
	   $(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    86
	done
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    87
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    88
gen-classlist: $(CLASSANALYZER_JAR)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    89
	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    90
	@$(RM) -rf $(MODULE_CLASSLIST)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    91
	@$(MKDIR) -p $(MODULE_CLASSLIST)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    92
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    93
	@# Use java in the default tool directory.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    94
	@# OUTPUTDIR for solaris 64-bit doesn't have the tools.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    95
	$(JAVA_TOOLS_DIR)/java $(JAVA_FLAGS) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    96
		-Dclassanalyzer.debug \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    97
		-jar $(CLASSANALYZER_JAR) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    98
		-jdkhome $(OUTPUTDIR) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    99
	        -config modules.config \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   100
	        -config modules.group \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   101
		-depconfig jdk7.depconfig \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   102
		-depconfig optional.depconfig \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   103
		-showdynamic \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   104
		-output $(MODULE_CLASSLIST)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   105
	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   106
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   107
modularize: $(MODULE_JAR_MANIFEST_FILE)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   108
	@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   109
	@$(RM) -rf $(MODULE_LIB)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   110
	@$(MKDIR) -p $(MODULE_LIB)/lib
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   111
	@$(MKDIR) -p $(MODULE_LIB)/jre/lib/ext
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   112
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   113
	@# create modules
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   114
	for m in `$(NAWK) '{print $$1}' $(MODULE_LIST)` ; do \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   115
   	   $(ECHO) "Creating module $$m" ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   116
   	   $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   117
	   if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   118
   	       $(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   119
           fi ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   120
	   $(CD) $(MODULE_CLASSES) && \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   121
               $(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   122
		   $(MODULE_LIB)/$$m.jar \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   123
		   @$(TMP)/tmp.cf \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   124
                   $(BOOT_JAR_JFLAGS) ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   125
	done
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   126
	@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   127
	@# move modules to lib, jre/lib, or jre/lib/ext
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   128
	for m in $(EXT_MODULES) ; do \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   129
	   $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/jre/lib/ext ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   130
	done
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   131
	for m in $(JDK_MODULES) ; do \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   132
	   $(MV) $(MODULE_LIB)/$$m.jar $(MODULE_LIB)/lib ; \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   133
	done
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   134
	$(MV) $(MODULE_LIB)/*.jar $(MODULE_LIB)/jre/lib
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   135
	@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   136
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   137
$(MODULE_JAR_MANIFEST_FILE):
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   138
	$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   139
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   140
clean clobber::
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   141
	$(RM) -rf $(MODULE_CLASSLIST)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   142
	$(RM) -rf $(MODULE_LIB)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   143
	$(RM) -f $(MODULE_JAR_MANIFEST_FILE)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   144
	$(RM) -f $(CLASSANALYZER_JAR)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
   145