author | mchung |
Thu, 07 Jan 2010 08:14:48 -0800 | |
changeset 4665 | d14dc3d9e1fa |
parent 4524 | 697144bd8b04 |
child 4681 | 7d382dfe6e55 |
permissions | -rw-r--r-- |
4524 | 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 |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
43 |
MODULES_LIST = $(MODULE_CLASSLIST)/modules.list |
4524 | 44 |
|
45 |
SUBDIRS = tools |
|
46 |
all build clean clobber:: |
|
47 |
$(SUBDIRS-loop) |
|
48 |
||
49 |
all:: unpack-jars gen-classlist modularize |
|
50 |
||
51 |
$(CLASSANALYZER_JAR): |
|
52 |
$(CD) tools && $(MAKE) all |
|
53 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
54 |
JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print) |
4524 | 55 |
unpack-jars: |
56 |
$(RM) -rf $(MODULE_CLASSES) |
|
57 |
$(MKDIR) -p $(MODULE_CLASSES) |
|
58 |
$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES) |
|
59 |
for jf in $(JAR_LIST) ; do \ |
|
60 |
$(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\ |
|
61 |
done |
|
62 |
||
63 |
gen-classlist: $(CLASSANALYZER_JAR) |
|
64 |
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." |
|
65 |
@$(RM) -rf $(MODULE_CLASSLIST) |
|
66 |
@$(MKDIR) -p $(MODULE_CLASSLIST) |
|
67 |
||
68 |
@# Use java in the default tool directory. |
|
69 |
@# OUTPUTDIR for solaris 64-bit doesn't have the tools. |
|
70 |
$(JAVA_TOOLS_DIR)/java $(JAVA_FLAGS) \ |
|
71 |
-Dclassanalyzer.debug \ |
|
72 |
-jar $(CLASSANALYZER_JAR) \ |
|
73 |
-jdkhome $(OUTPUTDIR) \ |
|
74 |
-config modules.config \ |
|
75 |
-config modules.group \ |
|
76 |
-depconfig jdk7.depconfig \ |
|
77 |
-depconfig optional.depconfig \ |
|
78 |
-showdynamic \ |
|
79 |
-output $(MODULE_CLASSLIST) |
|
80 |
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." |
|
81 |
||
82 |
modularize: $(MODULE_JAR_MANIFEST_FILE) |
|
83 |
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." |
|
84 |
@$(RM) -rf $(MODULE_LIB) |
|
85 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
86 |
@# 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
|
87 |
@# 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
|
88 |
for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \ |
4524 | 89 |
$(ECHO) "Creating module $$m" ; \ |
90 |
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \ |
|
91 |
if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \ |
|
92 |
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \ |
|
93 |
fi ; \ |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
94 |
$(MKDIR) -p $(MODULE_LIB)/$$m/lib; \ |
4524 | 95 |
$(CD) $(MODULE_CLASSES) && \ |
96 |
$(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \ |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
97 |
$(MODULE_LIB)/$$m/lib/$$m.jar \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
98 |
@$(TMP)/tmp.cf \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
99 |
$(BOOT_JAR_JFLAGS); \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
100 |
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
|
101 |
if [ -d $(TMP)/$$s ] ; then \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
102 |
$(CP) -rf $(TMP)/$$s/* $(MODULE_LIB)/$$m; \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
103 |
$(RM) -rf $(MODULE_LIB)/$$m/classes; \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
104 |
fi \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
105 |
done \ |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
106 |
done |
4524 | 107 |
@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup) |
108 |
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." |
|
109 |
||
110 |
$(MODULE_JAR_MANIFEST_FILE): |
|
111 |
$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@ |
|
112 |
||
113 |
clean clobber:: |
|
114 |
$(RM) -rf $(MODULE_CLASSLIST) |
|
115 |
$(RM) -rf $(MODULE_LIB) |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
116 |
$(RM) $(MODULE_JAR_MANIFEST_FILE) |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4524
diff
changeset
|
117 |
$(RM) $(CLASSANALYZER_JAR) |