author | ohair |
Fri, 18 Sep 2009 16:26:51 -0700 | |
changeset 3874 | 02fe9a813203 |
parent 3871 | 3d528461f61d |
child 3875 | eea3f9d9076d |
permissions | -rw-r--r-- |
4 | 1 |
# |
3291 | 2 |
# Copyright 1995-2009 Sun Microsystems, Inc. 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 |
|
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 |
# |
|
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 |
|
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
31 |
# Used with wildcard to look into a java package for files (assumes max 5 deep) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
32 |
_WC_DIRS = * */* */*/* */*/*/* */*/*/*/* |
4 | 33 |
|
34 |
# Make sure the default rule is all |
|
35 |
rules_default_rule: all |
|
36 |
||
37 |
# |
|
38 |
# Directory set up. (Needed by deploy workspace) |
|
39 |
# |
|
40 |
$(CLASSDESTDIR) $(CLASSHDRDIR) $(OBJDIR) $(OUTPUTDIR) $(BINDIR) $(LIBDIR) $(LIBDIR)/$(LIBARCH) $(TEMPDIR) $(EXTDIR): |
|
41 |
$(MKDIR) -p $@ |
|
42 |
||
43 |
# |
|
44 |
# All source tree areas for java/properties files |
|
45 |
# |
|
46 |
ALL_CLASSES_SRC = $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes |
|
47 |
||
48 |
# |
|
49 |
# If AUTO_FILES_PROPERTIES_DIRS used, automatically find properties files |
|
50 |
# |
|
51 |
ifdef AUTO_FILES_PROPERTIES_DIRS |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
52 |
# Wildcard all possible properties files |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
53 |
_WC_PROP_FILES = $(patsubst %, %/*.properties, $(_WC_DIRS)) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
54 |
# Wildcard package directories for this Makefile |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
55 |
_AUTO_WC_PROP_FILES = $(foreach dir, $(AUTO_FILES_PROPERTIES_DIRS), \ |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
56 |
$(patsubst %, $(dir)/%, $(_WC_PROP_FILES)) ) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
57 |
# Wildcard all source directories |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
58 |
_AUTO_WC_ALL_PROP_FILES1 = $(foreach dir, $(ALL_CLASSES_SRC), \ |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
59 |
$(patsubst %, $(dir)/%, $(_AUTO_WC_PROP_FILES)) ) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
60 |
# Find all files meeting this pattern |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
61 |
FILES_properties_auto1 := $(wildcard $(_AUTO_WC_ALL_PROP_FILES1)) |
4 | 62 |
else |
63 |
FILES_properties_auto1 = |
|
64 |
endif # AUTO_FILES_PROPERTIES_DIRS |
|
65 |
||
66 |
# Add any automatically found properties files to the properties file list |
|
67 |
FILES_properties += $(FILES_properties_auto1) |
|
68 |
||
69 |
# |
|
70 |
# Get Resources help |
|
71 |
# |
|
72 |
include $(TOPDIR)/make/common/internal/Resources.gmk |
|
73 |
||
74 |
# |
|
75 |
# Compiling .java files. |
|
76 |
# |
|
77 |
||
78 |
# |
|
79 |
# Automatically add to FILES_java if AUTO_FILES_JAVA_DIRS is defined |
|
80 |
# |
|
81 |
# There are two basic types of sources, normal source files and the |
|
82 |
# generated ones. The Normal sources will be located in: |
|
83 |
# $(ALL_CLASSES_SRC) |
|
84 |
# The generated sources, which might show up late to dinner, are at: |
|
85 |
# $(GENSRCDIR) |
|
86 |
# and since they could be generated late, we need to be careful that |
|
87 |
# we look for these sources late and not use the ':=' assignment which |
|
88 |
# might miss their generation. |
|
89 |
||
90 |
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
|
91 |
# Wildcard all possible java files |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
92 |
_WC_JAVA_FILES = $(patsubst %, %/*.java, $(_WC_DIRS)) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
93 |
# Wildcard package directories for this Makefile |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
94 |
_AUTO_WC_JAVA_FILES = $(foreach dir, $(AUTO_FILES_JAVA_DIRS), \ |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
95 |
$(patsubst %, $(dir)/%, $(_WC_JAVA_FILES)) ) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
96 |
# Wildcard all source directories |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
97 |
_AUTO_WC_ALL_JAVA_FILES1 = $(foreach dir, $(ALL_CLASSES_SRC), \ |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
98 |
$(patsubst %, $(dir)/%, $(_AUTO_WC_JAVA_FILES)) ) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
99 |
# Find all files meeting this pattern |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
100 |
FILES_java_auto1 := $(wildcard $(_AUTO_WC_ALL_JAVA_FILES1)) |
4 | 101 |
|
102 |
# Second list is the generated sources that should be rare, but will likely |
|
103 |
# show up late and we need to look for them at the last minute, so we |
|
104 |
# cannot use the ':=' assigment here. But if this gets expanded multiple |
|
105 |
# times, the if tests should make them relatively cheap. |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
106 |
# Wildcard the generated source directories |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
107 |
_AUTO_WC_ALL_JAVA_FILES2 = $(patsubst %, $(GENSRCDIR)/%, $(_AUTO_WC_JAVA_FILES)) |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
108 |
# Find all files meeting this pattern |
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
109 |
FILES_java_auto2 = $(wildcard $(_AUTO_WC_ALL_JAVA_FILES2)) |
4 | 110 |
else |
111 |
FILES_java_auto1 = |
|
112 |
FILES_java_auto2 = |
|
113 |
endif |
|
114 |
||
115 |
# Add all found java sources to FILES_java macro (if AUTO_FILES_JAVA_DIRS used) |
|
116 |
FILES_java += $(FILES_java_auto1) $(FILES_java_auto2) |
|
117 |
||
118 |
# File that will hold java source names that need compiling |
|
119 |
JAVA_SOURCE_LIST=$(TEMPDIR)/.classes.list |
|
120 |
||
121 |
# Add a java source to the list |
|
122 |
define add-java-file |
|
123 |
$(ECHO) "$?" >> $(JAVA_SOURCE_LIST) |
|
124 |
endef |
|
125 |
||
126 |
$(CLASSDESTDIR)/%.class: $(GENSRCDIR)/%.java |
|
127 |
@$(add-java-file) |
|
128 |
$(CLASSDESTDIR)/%.class: $(PLATFORM_SRC)/classes/%.java |
|
129 |
@$(add-java-file) |
|
130 |
$(CLASSDESTDIR)/%.class: $(SHARE_SRC)/classes/%.java |
|
131 |
@$(add-java-file) |
|
132 |
||
133 |
# List of class files needed |
|
134 |
FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class) |
|
135 |
||
136 |
# Got to include exported files. |
|
137 |
FILES_class += $(FILES_export:%.java=$(CLASSDESTDIR)/%.class) |
|
138 |
||
139 |
# Construct list of java sources we need to compile |
|
140 |
source_list_prime: |
|
141 |
@$(MKDIR) -p $(TEMPDIR) |
|
142 |
# Note that we slip resources in so that compiled properties files get created: |
|
143 |
$(JAVA_SOURCE_LIST) : source_list_prime resources $(FILES_class) |
|
144 |
@$(TOUCH) $@ |
|
145 |
||
146 |
.delete.classlist: |
|
147 |
@$(RM) $(JAVA_SOURCE_LIST) |
|
148 |
||
149 |
# Make sure all newer sources are compiled (in a batch) |
|
150 |
classes : $(CLASSES_INIT) .delete.classlist .compile.classlist |
|
151 |
||
2199
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
152 |
# 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
|
153 |
# rather than any bootclasspath classes. |
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
154 |
JAVAC_PREFER_SOURCE = -Xprefer:source |
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
155 |
|
4 | 156 |
.compile.classlist : $(JAVA_SOURCE_LIST) |
157 |
@$(MKDIR) -p $(CLASSDESTDIR) |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
158 |
if [ -s $(JAVA_SOURCE_LIST) ] ; then \ |
3874
02fe9a813203
6883790: corba build problem related to wildcard and vpath, regression
ohair
parents:
3871
diff
changeset
|
159 |
$(CAT) $(JAVA_SOURCE_LIST); \ |
2199
05f4bf151242
6790292: BOOTDIR of jdk6 u12 will not work with jdk7 builds
ohair
parents:
4
diff
changeset
|
160 |
$(JAVAC_CMD) $(JAVAC_PREFER_SOURCE) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST); \ |
4 | 161 |
fi |
162 |
@$(java-vm-cleanup) |
|
163 |
||
164 |
clobber clean:: |
|
165 |
$(RM) $(JAVA_SOURCE_LIST) |
|
166 |
||
167 |
ifndef DONT_CLOBBER_CLASSES |
|
168 |
ifndef PACKAGE |
|
169 |
DONT_CLOBBER_CLASSES = true |
|
170 |
else |
|
171 |
DONT_CLOBBER_CLASSES = false |
|
172 |
endif |
|
173 |
endif |
|
174 |
||
175 |
packages.clean: |
|
176 |
ifeq ($(DONT_CLOBBER_CLASSES),false) |
|
177 |
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
|
178 |
$(RM) -r $(patsubst %, $(CLASSDESTDIR)/%, $(AUTO_FILES_JAVA_DIRS)) |
4 | 179 |
else |
180 |
$(RM) -r $(CLASSDESTDIR)/$(PKGDIR) |
|
181 |
endif |
|
182 |
endif |
|
183 |
||
184 |
classes.clean: packages.clean |
|
185 |
$(RM) $(JAVA_SOURCE_LIST) |
|
186 |
||
187 |
# |
|
188 |
# C and C++ make dependencies |
|
189 |
# |
|
190 |
include $(TOPDIR)/make/common/internal/NativeCompileRules.gmk |
|
191 |
||
192 |
# |
|
193 |
# Running Javah to generate stuff into CClassHeaders. |
|
194 |
# |
|
195 |
||
196 |
ifdef FILES_export |
|
197 |
||
198 |
CLASSES.export = $(subst /,.,$(FILES_export:%.java=%)) |
|
199 |
CLASSES.export += $(subst /,.,$(FILES_export2:%.java=%)) |
|
200 |
CLASSES.export += $(subst /,.,$(FILES_export3:%.java=%)) |
|
201 |
CLASSES_export = $(FILES_export:%.java=$(CLASSDESTDIR)/%.class) |
|
202 |
CLASSES_export += $(FILES_export2:%.java=$(CLASSDESTDIR)/%.class) |
|
203 |
CLASSES_export += $(FILES_export3:%.java=$(CLASSDESTDIR)/%.class) |
|
204 |
||
205 |
# Fix when deploy workspace makefiles don't depend on this name |
|
206 |
#CLASSHDR_DOTFILE=$(CLASSHDRDIR)/.classheaders |
|
207 |
||
208 |
CLASSHDR_DOTFILE=$(OBJDIR)/.class.headers.$(ARCH) |
|
209 |
||
210 |
classheaders: classes $(CLASSHDR_DOTFILE) |
|
211 |
||
212 |
$(CLASSHDR_DOTFILE): $(CLASSES_export) |
|
213 |
$(prep-target) |
|
214 |
$(JAVAH_CMD) -d $(CLASSHDRDIR)/ \ |
|
215 |
$(CLASSES.export) $(subst $$,\$$,$(EXPORTED_inner)) |
|
216 |
@$(java-vm-cleanup) |
|
217 |
@$(TOUCH) $@ |
|
218 |
||
219 |
classheaders.clean: |
|
3871
3d528461f61d
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents:
3291
diff
changeset
|
220 |
$(RM) -r $(CLASSHDRDIR) $(CLASSHDR_DOTFILE) |
4 | 221 |
|
222 |
else # FILES_export |
|
223 |
||
224 |
classheaders: classes |
|
225 |
||
226 |
classheaders.clean: |
|
227 |
||
228 |
endif # FILES_export |
|
229 |
||
230 |
clean clobber:: classheaders.clean classes.clean .delete.classlist |
|
231 |
||
232 |
# |
|
233 |
# Default dependencies |
|
234 |
# |
|
235 |
||
236 |
all: build |
|
237 |
||
238 |
build: classheaders |
|
239 |
||
240 |
default: all |
|
241 |
||
242 |
.PHONY: all build clean clobber \ |
|
243 |
.delete.classlist classes .compile.classlist classes.clean \ |
|
244 |
classheaders classheaders.clean \ |
|
245 |
batch_compile |
|
246 |