author | never |
Mon, 12 Jul 2010 22:27:18 -0700 | |
changeset 5926 | a36f90d986b6 |
parent 5506 | 202f599c92aa |
child 7668 | d4a77089c587 |
permissions | -rw-r--r-- |
4524 | 1 |
# |
5506 | 2 |
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
4524 | 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 |
|
5506 | 7 |
# published by the Free Software Foundation. Oracle designates this |
4524 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
4524 | 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 |
# |
|
5506 | 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. |
|
4524 | 24 |
# |
25 |
||
26 |
BUILDDIR = .. |
|
27 |
include $(BUILDDIR)/common/Defs.gmk |
|
28 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
29 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
30 |
# Modularizing the JDK |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
31 |
# - Post jdk build process until the source tree is restructured |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
32 |
# for modules build |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
33 |
# - <outputdir>/modules/<module> will be created for each module. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
34 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
35 |
# Steps: |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
36 |
# 0. During jdk build before this makefile is invoked, classes, |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
37 |
# resource files, and other non-class files such as native libraries, |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
38 |
# properties file, images, etc are created. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
39 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
40 |
# Non-class files are copied to <outputdir>/tmp/modules/<MODULE> |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
41 |
# directory in this step to prepare for the post-build modularization. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
42 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
43 |
# The MODULE variable defined in other makefiles specifies |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
44 |
# the lowest-level module that the non-class files belong to. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
45 |
# The name might or might not be the same as the name of the modules |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
46 |
# in the resulting <outputdir>/modules directory. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
47 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
48 |
# 1. Unpack all jars in the <builddir>/lib directory to a temporary |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
49 |
# location (<outputdir>/tmp/modules/classes) to prepare for modules |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
50 |
# creation. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
51 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
52 |
# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
53 |
# class list for all modules and also perform dependency analysis. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
54 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
55 |
# Input configuration files :- |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
56 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
57 |
# modules.config : defines the low-level modules and specifies |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
58 |
# what classes and resource files each module includes. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
59 |
# modules.group : defines the module groups and its members. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
60 |
# jdk7.depconfig : lists the dynamic dependencies including |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
61 |
# use of reflection Class.forName and JNI FindClass and |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
62 |
# service provider. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
63 |
# optional.depconfig : lists the optional dependencies |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
64 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
65 |
# 3. Create one directory for each module (<outputdir>/modules/<module>) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
66 |
# based on the output files from (2). |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
67 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
68 |
# modules.list lists the modules to be created for the modules |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
69 |
# build and its members. For each module (m) in modules.list, |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
70 |
# a. create $m/lib/$m.jar with all classes and resource files |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
71 |
# listed in $m.classlist and $m.resources respectively. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
72 |
# b. copy all non-class files from its members to |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
73 |
# <outputdir>/modules/$m. |
4524 | 74 |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
75 |
|
4524 | 76 |
MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf |
77 |
MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp |
|
78 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
79 |
TMP = $(ABS_MODULES_TEMPDIR) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
80 |
MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
81 |
MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes |
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
82 |
MODULES_LIST = $(MODULE_CLASSLIST)/modules.list |
4524 | 83 |
|
84 |
all:: unpack-jars gen-classlist modularize |
|
85 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
86 |
JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) |
4524 | 87 |
unpack-jars: |
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
88 |
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." |
4524 | 89 |
$(RM) -rf $(MODULE_CLASSES) |
90 |
$(MKDIR) -p $(MODULE_CLASSES) |
|
91 |
$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES) |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
92 |
@for jf in $(JAR_LIST) ; do \ |
4524 | 93 |
$(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\ |
94 |
done |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
95 |
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." |
4524 | 96 |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
97 |
gen-classlist: |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
98 |
$(CD) tools && $(MAKE) all |
4524 | 99 |
|
100 |
modularize: $(MODULE_JAR_MANIFEST_FILE) |
|
101 |
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
102 |
@$(RM) -rf $(MODULES_DIR) |
4524 | 103 |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
104 |
@# create jar file for modules and |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
105 |
@# copy other files from all members of this module |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
106 |
for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ |
4524 | 107 |
$(ECHO) "Creating module $$m" ; \ |
108 |
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \ |
|
109 |
if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ |
|
110 |
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ |
|
111 |
fi ; \ |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
112 |
$(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \ |
4524 | 113 |
$(CD) $(MODULE_CLASSES) && \ |
114 |
$(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
115 |
$(ABS_MODULES_DIR)/$$m/lib/$$m.jar \ |
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
116 |
@$(TMP)/tmp.cf \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
117 |
$(BOOT_JAR_JFLAGS); \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
118 |
for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
119 |
if [ -d $(TMP)/$$s ] ; then \ |
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
120 |
$(CP) -rf $(TMP)/$$s/* $(ABS_MODULES_DIR)/$$m; \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
121 |
$(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \ |
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
122 |
fi \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
123 |
done \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
124 |
done |
4524 | 125 |
@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup) |
126 |
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." |
|
127 |
||
128 |
$(MODULE_JAR_MANIFEST_FILE): |
|
129 |
$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@ |
|
130 |
||
131 |
clean clobber:: |
|
132 |
$(RM) -rf $(MODULE_CLASSLIST) |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4665
diff
changeset
|
133 |
$(RM) -rf $(MODULES_DIR) |
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
134 |
$(RM) $(MODULE_JAR_MANIFEST_FILE) |