author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 4975 | fff33270dd84 |
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 |
# |
|
27 |
# Makefile for building the classanalyzer tool |
|
28 |
# |
|
29 |
||
30 |
BUILDDIR = ../.. |
|
31 |
include $(BUILDDIR)/common/Defs.gmk |
|
32 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
33 |
PKGDIR = com/sun/classanalyzer |
4524 | 34 |
BUILDTOOL_SOURCE_ROOT = src |
35 |
BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java |
|
36 |
BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%)) |
|
37 |
||
38 |
BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN) |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
39 |
BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/classanalyzer_manifest.mf |
4524 | 40 |
|
41 |
FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \ |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
42 |
&& $(FIND) $(PKGDIR) -type f -print) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
43 |
|
4524 | 44 |
FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) |
45 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
46 |
CLASSANALYZER_JAR_FILE = $(BUILDTOOLJARDIR)/classanalyzer.jar |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
47 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
48 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
49 |
# ClassAnalyzer depends on the com.sun.tools.classfile API. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
50 |
# The tool is compiled with the latest version of the classfile |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
51 |
# library in the langtools repo to make sure that synchronized |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
52 |
# change is made if the classfile API is changed. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
53 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
54 |
# If langtools repo exists, build its own copy of the |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
55 |
# classfile library and use it for compile time and runtime. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
56 |
# If not exist (the top level repo is not a forest), use |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
57 |
# the built jdk tools that imports tools.jar from the latest |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
58 |
# promoted build. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
59 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
60 |
# If the classfile API is changed but not yet in a promoted build, |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
61 |
# the build might fail and the tool would need the langtools repo |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
62 |
# to build in that case. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
63 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
64 |
ifndef LANGTOOLS_TOPDIR |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
65 |
LANGTOOLS_TOPDIR=$(JDK_TOPDIR)/../langtools |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
66 |
endif |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
67 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
68 |
LANGTOOLS_TOPDIR_EXISTS := $(shell \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
69 |
if [ -d $(LANGTOOLS_TOPDIR) ] ; then \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
70 |
echo true; \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
71 |
else \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
72 |
echo false; \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
73 |
fi) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
74 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
75 |
CLASSFILE_SRC = $(LANGTOOLS_TOPDIR)/src/share/classes |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
76 |
CLASSFILE_PKGDIR = com/sun/tools/classfile |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
77 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
78 |
ifeq ($(LANGTOOLS_TOPDIR_EXISTS), true) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
79 |
FILES_classfile_java := $(shell \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
80 |
$(CD) $(CLASSFILE_SRC) && \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
81 |
$(FIND) $(CLASSFILE_PKGDIR) -name '*.java' -print) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
82 |
FILES_classfile_class = $(FILES_classfile_java:%.java=$(BUILDTOOLCLASSDIR)/%.class) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
83 |
CLASSFILE_JAR_FILE = $(BUILDTOOLJARDIR)/classfile.jar |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
84 |
BUILDTOOL_JAVAC = $(BOOT_JAVAC_CMD) $(JAVAC_JVM_FLAGS) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
85 |
$(BOOT_JAVACFLAGS) -classpath $(CLASSFILE_JAR_FILE) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
86 |
BUILDTOOL_JAVA = $(BOOT_JAVA_CMD) $(JAVA_TOOLS_FLAGS) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
87 |
-Xbootclasspath/p:$(CLASSFILE_JAR_FILE) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
88 |
else |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
89 |
# if langtools doesn't exist, use tools from the built jdk |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
90 |
BUILDTOOL_JAVAC = $(BINDIR)/javac $(JAVAC_JVM_FLAGS) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
91 |
$(BOOT_JAVACFLAGS) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
92 |
BUILDTOOL_JAVA = $(BINDIR)/java $(JAVA_TOOLS_FLAGS) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
93 |
endif |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
94 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
95 |
# Location of the output modules.list, <module>.classlist |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
96 |
# and other output files generated by the class analyzer tool. |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
97 |
# |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
98 |
MODULE_CLASSLIST = $(MODULES_TEMPDIR)/classlist |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
99 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
100 |
all build: classanalyzer gen-classlist |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
101 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
102 |
classanalyzer: $(CLASSFILE_JAR_FILE) $(CLASSANALYZER_JAR_FILE) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
103 |
|
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
104 |
gen-classlist: |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
105 |
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..." |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
106 |
@$(RM) -rf $(MODULE_CLASSLIST) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
107 |
@$(MKDIR) -p $(MODULE_CLASSLIST) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
108 |
$(BUILDTOOL_JAVA) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
109 |
-Dclassanalyzer.debug \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
110 |
-jar $(CLASSANALYZER_JAR_FILE) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
111 |
-jdkhome $(OUTPUTDIR) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
112 |
-config ../modules.config \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
113 |
-config ../modules.group \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
114 |
-depconfig ../jdk7.depconfig \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
115 |
-depconfig ../optional.depconfig \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
116 |
-showdynamic \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
117 |
-output $(MODULE_CLASSLIST) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
118 |
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..." |
4524 | 119 |
|
120 |
$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE) |
|
121 |
@$(prep-target) |
|
122 |
$(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@ |
|
123 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
124 |
$(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)/%.class : $(CLASSFILE_SRC)/$(CLASSFILE_PKGDIR)/%.java |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
125 |
@$(prep-target) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
126 |
@$(BUILDTOOL_JAVAC) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
127 |
-sourcepath $(CLASSFILE_SRC) \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
128 |
-d $(BUILDTOOLCLASSDIR) $< |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
129 |
|
4524 | 130 |
$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java |
131 |
@$(prep-target) |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
132 |
$(BUILDTOOL_JAVAC) \ |
4524 | 133 |
-sourcepath $(BUILDTOOL_SOURCE_ROOT) \ |
134 |
-d $(BUILDTOOLCLASSDIR) $< |
|
135 |
||
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
136 |
$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class) |
4524 | 137 |
@$(prep-target) |
4975 | 138 |
$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ |
139 |
-C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
140 |
@$(java-vm-cleanup) |
4524 | 141 |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
142 |
$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
143 |
@$(prep-target) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
144 |
$(CD) $(BUILDTOOLCLASSDIR) && \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
145 |
$(BOOT_JAR_CMD) cf $@ \ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
146 |
$(CLASSFILE_PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@ |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
147 |
@$(java-vm-cleanup) |
4524 | 148 |
|
149 |
clean clobber:: |
|
150 |
@$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR) |
|
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
151 |
@$(RM) -rf $(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR) |
4524 | 152 |
@$(RM) $(BUILDTOOL_MANIFEST_FILE) |
4681
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
153 |
@$(RM) $(CLASSANALYZER_JAR_FILE) |
7d382dfe6e55
6916217: make/modules/Makefile requires ALT_JDK_IMPORT_PATH
mchung
parents:
4524
diff
changeset
|
154 |
@$(RM) $(CLASSFILE_JAR_FILE) |