author | johnc |
Mon, 21 Nov 2011 09:24:56 -0800 | |
changeset 11171 | 02c21e3d0a66 |
parent 7672 | aec650969dd5 |
permissions | -rw-r--r-- |
4 | 1 |
# |
7672 | 2 |
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. |
4 | 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 |
|
5555 | 7 |
# published by the Free Software Foundation. Oracle designates this |
4 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5555 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
4 | 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 |
# |
|
5555 | 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. |
|
4 | 24 |
# |
25 |
||
26 |
# |
|
27 |
# |
|
28 |
# Rules shared by all Java makefiles. |
|
29 |
# |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
30 |
|
4 | 31 |
# Make sure the default rule is all |
32 |
rules_default_rule: all |
|
33 |
||
34 |
# |
|
35 |
# Directory set up. (Needed by deploy workspace) |
|
36 |
# |
|
6551
476ed8653670
6981043: Clean out all native code makefile logic from corba repository
ohair
parents:
5555
diff
changeset
|
37 |
$(CLASSDESTDIR) $(OUTPUTDIR) $(TEMPDIR) $(EXTDIR): |
4 | 38 |
$(MKDIR) -p $@ |
39 |
||
40 |
# |
|
41 |
# All source tree areas for java/properties files |
|
42 |
# |
|
43 |
ALL_CLASSES_SRC = $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes |
|
44 |
||
45 |
# |
|
46 |
# If AUTO_FILES_PROPERTIES_DIRS used, automatically find properties files |
|
47 |
# |
|
48 |
ifdef AUTO_FILES_PROPERTIES_DIRS |
|
3875
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
49 |
AUTO_FILES_PROPERTIES_FILTERS1 = $(SCM_DIRs) 'X-*' '*-X-*' ',*' |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
50 |
AUTO_FILES_PROPERTIES_FILTERS1 += $(AUTO_PROPERTIES_PRUNE) |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
51 |
FILES_properties_find_filters1 = $(AUTO_FILES_PROPERTIES_FILTERS1:%=-name % -prune -o) |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
52 |
FILES_properties_auto1 := \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
53 |
$(shell \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
54 |
for dir in $(ALL_CLASSES_SRC) ; do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
55 |
if [ -d $$dir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
56 |
( $(CD) $$dir; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
57 |
for sdir in $(AUTO_FILES_PROPERTIES_DIRS); do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
58 |
if [ -d $$sdir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
59 |
$(FIND) $$sdir $(FILES_properties_find_filters1) \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
60 |
-name '*.properties' -print ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
61 |
fi ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
62 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
63 |
); \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
64 |
fi; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
65 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
66 |
) |
4 | 67 |
else |
68 |
FILES_properties_auto1 = |
|
69 |
endif # AUTO_FILES_PROPERTIES_DIRS |
|
70 |
||
71 |
# Add any automatically found properties files to the properties file list |
|
72 |
FILES_properties += $(FILES_properties_auto1) |
|
73 |
||
74 |
# |
|
75 |
# Get Resources help |
|
76 |
# |
|
77 |
include $(TOPDIR)/make/common/internal/Resources.gmk |
|
78 |
||
79 |
# |
|
80 |
# Compiling .java files. |
|
81 |
# |
|
82 |
||
83 |
# |
|
84 |
# Automatically add to FILES_java if AUTO_FILES_JAVA_DIRS is defined |
|
85 |
# |
|
86 |
# There are two basic types of sources, normal source files and the |
|
87 |
# generated ones. The Normal sources will be located in: |
|
88 |
# $(ALL_CLASSES_SRC) |
|
89 |
# The generated sources, which might show up late to dinner, are at: |
|
90 |
# $(GENSRCDIR) |
|
91 |
# and since they could be generated late, we need to be careful that |
|
92 |
# we look for these sources late and not use the ':=' assignment which |
|
93 |
# might miss their generation. |
|
94 |
||
95 |
ifdef AUTO_FILES_JAVA_DIRS |
|
3875
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
96 |
# Filter out these files or directories |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
97 |
AUTO_FILES_JAVA_SOURCE_FILTERS1 = $(SCM_DIRs) 'X-*' '*-X-*' '*-template.java' ',*' |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
98 |
AUTO_FILES_JAVA_SOURCE_FILTERS2 = |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
99 |
AUTO_FILES_JAVA_SOURCE_FILTERS1 += $(AUTO_JAVA_PRUNE) |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
100 |
AUTO_FILES_JAVA_SOURCE_FILTERS2 += $(AUTO_JAVA_PRUNE) |
4 | 101 |
|
3875
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
102 |
# First list is the normal sources that should always be there, |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
103 |
# by using the ':=', which means we do this processing once. |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
104 |
FILES_java_find_filters1 = $(AUTO_FILES_JAVA_SOURCE_FILTERS1:%=-name % -prune -o) |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
105 |
FILES_java_auto1 := \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
106 |
$(shell \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
107 |
for dir in $(ALL_CLASSES_SRC) ; do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
108 |
if [ -d $$dir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
109 |
( $(CD) $$dir; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
110 |
for sdir in $(AUTO_FILES_JAVA_DIRS); do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
111 |
if [ -d $$sdir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
112 |
$(FIND) $$sdir $(FILES_java_find_filters1) \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
113 |
-name '*.java' -print ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
114 |
fi ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
115 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
116 |
); \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
117 |
fi; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
118 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
119 |
) |
4 | 120 |
# Second list is the generated sources that should be rare, but will likely |
121 |
# show up late and we need to look for them at the last minute, so we |
|
122 |
# cannot use the ':=' assigment here. But if this gets expanded multiple |
|
123 |
# times, the if tests should make them relatively cheap. |
|
3875
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
124 |
FILES_java_find_filters2 = $(AUTO_FILES_JAVA_SOURCE_FILTERS2:%=-name % -prune -o) |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
125 |
FILES_java_auto2 = \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
126 |
$(shell \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
127 |
for dir in $(GENSRCDIR); do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
128 |
if [ -d $$dir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
129 |
( $(CD) $$dir; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
130 |
for sdir in $(AUTO_FILES_JAVA_DIRS); do \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
131 |
if [ -d $$sdir ] ; then \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
132 |
$(FIND) $$sdir $(FILES_java_find_filters2) \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
133 |
-name '*.java' -print ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
134 |
fi ; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
135 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
136 |
); \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
137 |
fi; \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
138 |
done \ |
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
139 |
) |
4 | 140 |
else |
141 |
FILES_java_auto1 = |
|
142 |
FILES_java_auto2 = |
|
143 |
endif |
|
144 |
||
145 |
# Add all found java sources to FILES_java macro (if AUTO_FILES_JAVA_DIRS used) |
|
146 |
FILES_java += $(FILES_java_auto1) $(FILES_java_auto2) |
|
147 |
||
148 |
# File that will hold java source names that need compiling |
|
149 |
JAVA_SOURCE_LIST=$(TEMPDIR)/.classes.list |
|
150 |
||
151 |
# Add a java source to the list |
|
152 |
define add-java-file |
|
153 |
$(ECHO) "$?" >> $(JAVA_SOURCE_LIST) |
|
154 |
endef |
|
155 |
||
156 |
$(CLASSDESTDIR)/%.class: $(GENSRCDIR)/%.java |
|
157 |
@$(add-java-file) |
|
158 |
$(CLASSDESTDIR)/%.class: $(PLATFORM_SRC)/classes/%.java |
|
159 |
@$(add-java-file) |
|
160 |
$(CLASSDESTDIR)/%.class: $(SHARE_SRC)/classes/%.java |
|
161 |
@$(add-java-file) |
|
162 |
||
163 |
# List of class files needed |
|
164 |
FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class) |
|
165 |
||
166 |
# Construct list of java sources we need to compile |
|
167 |
source_list_prime: |
|
168 |
@$(MKDIR) -p $(TEMPDIR) |
|
169 |
# Note that we slip resources in so that compiled properties files get created: |
|
170 |
$(JAVA_SOURCE_LIST) : source_list_prime resources $(FILES_class) |
|
171 |
@$(TOUCH) $@ |
|
172 |
||
173 |
.delete.classlist: |
|
174 |
@$(RM) $(JAVA_SOURCE_LIST) |
|
175 |
||
176 |
# Make sure all newer sources are compiled (in a batch) |
|
177 |
classes : $(CLASSES_INIT) .delete.classlist .compile.classlist |
|
178 |
||
2199
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
179 |
# Use this javac option to force it to favor the sourcepath file classes |
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
180 |
# rather than any bootclasspath classes. |
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
181 |
JAVAC_PREFER_SOURCE = -Xprefer:source |
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
182 |
|
4 | 183 |
.compile.classlist : $(JAVA_SOURCE_LIST) |
184 |
@$(MKDIR) -p $(CLASSDESTDIR) |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
185 |
if [ -s $(JAVA_SOURCE_LIST) ] ; then \ |
3875
eea3f9d9076d
6883816: corba fix for missing javax/transaction/xa classes (the real fix)
ohair
parents:
3874
diff
changeset
|
186 |
$(CAT) $(JAVA_SOURCE_LIST); \ |
2199
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
187 |
$(JAVAC_CMD) $(JAVAC_PREFER_SOURCE) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST); \ |
4 | 188 |
fi |
189 |
@$(java-vm-cleanup) |
|
190 |
||
191 |
clobber clean:: |
|
192 |
$(RM) $(JAVA_SOURCE_LIST) |
|
193 |
||
194 |
ifndef DONT_CLOBBER_CLASSES |
|
195 |
ifndef PACKAGE |
|
196 |
DONT_CLOBBER_CLASSES = true |
|
197 |
else |
|
198 |
DONT_CLOBBER_CLASSES = false |
|
199 |
endif |
|
200 |
endif |
|
201 |
||
202 |
packages.clean: |
|
203 |
ifeq ($(DONT_CLOBBER_CLASSES),false) |
|
204 |
ifdef AUTO_FILES_JAVA_DIRS |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
205 |
$(RM) -r $(patsubst %, $(CLASSDESTDIR)/%, $(AUTO_FILES_JAVA_DIRS)) |
4 | 206 |
else |
207 |
$(RM) -r $(CLASSDESTDIR)/$(PKGDIR) |
|
208 |
endif |
|
209 |
endif |
|
210 |
||
211 |
classes.clean: packages.clean |
|
212 |
$(RM) $(JAVA_SOURCE_LIST) |
|
213 |
||
6551
476ed8653670
6981043: Clean out all native code makefile logic from corba repository
ohair
parents:
5555
diff
changeset
|
214 |
clean clobber:: classes.clean .delete.classlist |
4 | 215 |
|
216 |
# |
|
217 |
# Default dependencies |
|
218 |
# |
|
219 |
||
220 |
all: build |
|
221 |
||
6551
476ed8653670
6981043: Clean out all native code makefile logic from corba repository
ohair
parents:
5555
diff
changeset
|
222 |
build: classes |
4 | 223 |
|
224 |
default: all |
|
225 |
||
226 |
.PHONY: all build clean clobber \ |
|
227 |
.delete.classlist classes .compile.classlist classes.clean \ |
|
228 |
batch_compile |
|
229 |