author | prr |
Wed, 19 Jan 2011 17:07:51 -0800 | |
changeset 7945 | 7296aacd696f |
parent 7668 | d4a77089c587 |
child 8022 | d11e5f2eb62c |
permissions | -rw-r--r-- |
2 | 1 |
# |
7668 | 2 |
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
2 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
2 | 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. |
|
2 | 24 |
# |
25 |
||
26 |
# |
|
27 |
# Generic makefile for building shared libraries. |
|
28 |
# |
|
29 |
||
30 |
# WARNING: This file is shared with other workspaces. |
|
31 |
# So when it includes other files, it must use JDK_TOPDIR. |
|
32 |
# |
|
33 |
||
34 |
include $(JDK_TOPDIR)/make/common/Classes.gmk |
|
35 |
||
36 |
# |
|
37 |
# It is important to define these *after* including Classes.gmk |
|
38 |
# in order to override the values defined inthat makefile. |
|
39 |
# |
|
40 |
||
41 |
ifeq ($(LIBRARY), fdlibm) |
|
42 |
ifeq ($(PLATFORM),windows) |
|
43 |
ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY).$(FDDLIBM_SUFFIX) |
|
44 |
ACTUAL_LIBRARY_DIR = $(OBJDIR) |
|
45 |
else # PLATFORM |
|
46 |
ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY).$(ARCH).$(FDDLIBM_SUFFIX) |
|
47 |
ACTUAL_LIBRARY_DIR = $(OBJDIR) |
|
48 |
endif #PLATFORM |
|
49 |
else # LIBRARY |
|
50 |
ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) |
|
51 |
ACTUAL_LIBRARY_DIR = $(LIB_LOCATION) |
|
52 |
endif |
|
53 |
ACTUAL_LIBRARY = $(ACTUAL_LIBRARY_DIR)/$(ACTUAL_LIBRARY_NAME) |
|
54 |
||
55 |
library:: $(ACTUAL_LIBRARY) |
|
56 |
||
57 |
FILES_o = $(patsubst %.c, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c)))) |
|
58 |
FILES_o += $(patsubst %.s, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_s)))) |
|
59 |
FILES_o += $(patsubst %.cpp, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_cpp)))) |
|
60 |
||
61 |
ifeq ($(INCREMENTAL_BUILD),true) |
|
62 |
FILES_d = $(patsubst %.c, %.$(DEPEND_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c)))) |
|
63 |
FILES_d += $(patsubst %.cpp, %.$(DEPEND_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_cpp)))) |
|
64 |
endif # INCREMENTAL_BUILD |
|
65 |
||
66 |
ifeq ($(PLATFORM),solaris) |
|
67 |
# List of all lint files, one for each .c file (only for C) |
|
68 |
FILES_ln = $(patsubst %.c, %.$(LINT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c)))) |
|
69 |
endif |
|
70 |
||
71 |
# |
|
72 |
# C++ libraries must be linked with CC. |
|
73 |
# |
|
74 |
ifdef CPLUSPLUSLIBRARY |
|
75 |
LINKER=$(LINK.cc) |
|
76 |
else |
|
77 |
LINKER=$(LINK.c) |
|
78 |
endif |
|
79 |
||
80 |
$(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders |
|
81 |
||
82 |
# |
|
83 |
# COMPILE_APPROACH: Different approaches to compile up the native object |
|
84 |
# files as quickly as possible. |
|
85 |
# The setting of parallel works best on Unix, batch on Windows. |
|
86 |
# |
|
87 |
||
88 |
COMPILE_FILES_o = $(OBJDIR)/.files_compiled |
|
89 |
$(COMPILE_FILES_o): $(FILES_d) $(FILES_o) |
|
90 |
@$(ECHO) "$<" >> $@ |
|
91 |
clean:: |
|
92 |
$(RM) $(COMPILE_FILES_o) |
|
93 |
||
94 |
# |
|
95 |
# COMPILE_APPROACH=parallel: Will trigger compilations (just compilations) to |
|
96 |
# happen in parallel. Greatly decreases Unix build time, even on single CPU |
|
97 |
# machines, more so on multiple CPU machines. Default is 2 compiles |
|
98 |
# at a time, but can be adjusted with ALT_PARALLEL_COMPILE_JOBS. |
|
99 |
# Note that each .d file will also be dependent on it's .o file, see |
|
100 |
# Rules.gmk. |
|
101 |
# Note this does not depend on Rules.gmk to work like batch (below) |
|
102 |
# and this technique doesn't seem to help Windows build time nor does |
|
103 |
# it work very well, it's possible the Windows Visual Studio compilers |
|
104 |
# don't work well in a parallel situation, this needs investigation. |
|
105 |
# |
|
106 |
||
107 |
ifeq ($(COMPILE_APPROACH),parallel) |
|
108 |
||
109 |
.PHONY: library_parallel_compile |
|
110 |
||
111 |
library_parallel_compile: |
|
112 |
@$(ECHO) "Begin parallel compiles: $(shell $(PWD))" |
|
113 |
@$(MAKE) -j $(PARALLEL_COMPILE_JOBS) $(COMPILE_FILES_o) |
|
114 |
@$(ECHO) "Done with parallel compiles: $(shell $(PWD))" |
|
115 |
||
116 |
$(ACTUAL_LIBRARY):: library_parallel_compile |
|
117 |
||
118 |
endif |
|
119 |
||
120 |
# |
|
121 |
# COMPILE_APPROACH=batch: Will trigger compilations (just compilations) to |
|
122 |
# happen in batch mode. Greatly decreases Windows build time. |
|
123 |
# See logic in Rules.gmk for how compiles happen, the $(MAKE) in |
|
124 |
# library_batch_compile below triggers the actions in Rules.gmk. |
|
125 |
# Note that each .d file will also be dependent on it's .o file, see |
|
126 |
# Rules.gmk. |
|
127 |
# |
|
128 |
ifeq ($(COMPILE_APPROACH),batch) |
|
129 |
||
130 |
.PHONY: library_batch_compile |
|
131 |
||
132 |
library_batch_compile: |
|
133 |
@$(ECHO) "Begin BATCH compiles: $(shell $(PWD))" |
|
134 |
$(MAKE) $(COMPILE_FILES_o) |
|
135 |
$(MAKE) batch_compile |
|
136 |
@$(ECHO) "Done with BATCH compiles: $(shell $(PWD))" |
|
137 |
$(MAKE) COMPILE_APPROACH=normal $(COMPILE_FILES_o) |
|
138 |
||
139 |
$(ACTUAL_LIBRARY):: library_batch_compile |
|
140 |
||
141 |
endif |
|
142 |
||
143 |
ifeq ($(PLATFORM), windows) |
|
144 |
||
145 |
# |
|
146 |
# Library building rules. |
|
147 |
# |
|
148 |
||
149 |
$(LIBRARY).lib:: $(OBJDIR) |
|
150 |
||
151 |
ifeq ($(LIBRARY), fdlibm) |
|
152 |
$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lib |
|
153 |
||
154 |
$(OBJDIR)/$(LIBRARY).lib:: $(OBJDIR)/$(LIBRARY).lcf |
|
155 |
@$(prep-target) |
|
156 |
$(LIBEXE) -NODEFAULTLIB:MSVCRT -out:$@ -nologo \ |
|
157 |
@$(OBJDIR)/$(LIBRARY).lcf $(OTHER_LCF) $(LDLIBS_COMMON) |
|
158 |
else # LIBRARY |
|
159 |
# build it into $(OBJDIR) so that the other generated files get put |
|
160 |
# there, then copy just the DLL (and MAP file) to the requested directory. |
|
161 |
# |
|
162 |
$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf |
|
163 |
@$(prep-target) |
|
164 |
@$(MKDIR) -p $(OBJDIR) |
|
165 |
$(LINK) -dll -out:$(OBJDIR)/$(@F) \ |
|
166 |
-map:$(OBJDIR)/$(LIBRARY).map \ |
|
167 |
$(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \ |
|
168 |
$(OTHER_LCF) $(JAVALIB) $(LDLIBS) |
|
169 |
$(CP) $(OBJDIR)/$(@F) $@ |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
170 |
$(install-module-file) |
2 | 171 |
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D) |
172 |
$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) |
|
173 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
174 |
$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
175 |
|
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
176 |
$(ACTUAL_LIBRARY_DIR)/%.map: FORCE |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
177 |
$(install-module-file) |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
178 |
|
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
179 |
$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
180 |
$(install-module-file) |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
181 |
|
2 | 182 |
endif # LIBRARY |
183 |
||
184 |
$(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m) |
|
185 |
@$(prep-target) |
|
186 |
@$(MKDIR) -p $(TEMPDIR) |
|
187 |
@$(ECHO) $(FILES_o) > $@ |
|
188 |
ifndef LOCAL_RESOURCE_FILE |
|
189 |
@$(ECHO) $(OBJDIR)/$(LIBRARY).res >> $@ |
|
190 |
endif |
|
191 |
@$(ECHO) Created $@ |
|
192 |
||
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
193 |
# JDK name required here |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
194 |
RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \ |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
195 |
/D "JDK_INTERNAL_NAME=$(LIBRARY)" \ |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
196 |
/D "JDK_FTYPE=0x2L" |
2 | 197 |
|
198 |
$(OBJDIR)/$(LIBRARY).res: $(VERSIONINFO_RESOURCE) |
|
199 |
ifndef LOCAL_RESOURCE_FILE |
|
200 |
@$(prep-target) |
|
201 |
$(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(@) $(VERSIONINFO_RESOURCE) |
|
202 |
endif |
|
203 |
||
204 |
# |
|
205 |
# Install a .lib file if required. |
|
206 |
# |
|
207 |
ifeq ($(INSTALL_DOT_LIB), true) |
|
208 |
$(ACTUAL_LIBRARY):: $(LIBDIR)/$(LIBRARY).lib |
|
209 |
||
210 |
clean:: |
|
211 |
-$(RM) $(LIBDIR)/$(LIBRARY).lib |
|
212 |
||
213 |
$(LIBDIR)/$(LIBRARY).lib:: $(OBJDIR)/$(LIBRARY).lib |
|
214 |
$(install-file) |
|
215 |
||
216 |
$(LIBDIR)/$(LIBRARY).dll:: $(OBJDIR)/$(LIBRARY).dll |
|
217 |
$(install-file) |
|
218 |
||
219 |
endif # INSTALL_DOT_LIB |
|
220 |
||
221 |
else # PLATFORM |
|
222 |
||
223 |
# |
|
224 |
# On Solaris, use mcs to write the version into the comment section of |
|
225 |
# the shared library. On other platforms set this to false at the |
|
226 |
# make command line. |
|
227 |
# |
|
228 |
$(ACTUAL_LIBRARY):: $(COMPILE_FILES_o) $(FILES_m) $(FILES_reorder) |
|
229 |
@$(prep-target) |
|
917
75261da60fff
6729772: 64-bit build with SS12 compiler: SIGSEGV (0xb) at pc=0x0000000000000048, pid=14826, tid=2
ohair
parents:
2
diff
changeset
|
230 |
@$(ECHO) "STATS: LIBRARY=$(LIBRARY), PRODUCT=$(PRODUCT), OPTIMIZATION_LEVEL=$(OPTIMIZATION_LEVEL)" |
2 | 231 |
@$(ECHO) "Rebuilding $@ because of $?" |
232 |
ifeq ($(LIBRARY), fdlibm) |
|
233 |
$(AR) -r $@ $(FILES_o) |
|
234 |
else # LIBRARY |
|
235 |
$(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
236 |
$(install-module-file) |
2 | 237 |
ifeq ($(WRITE_LIBVERSION),true) |
238 |
$(MCS) -d -a "$(FULL_VERSION)" $@ |
|
239 |
endif # WRITE_LIBVERSION |
|
240 |
endif # LIBRARY |
|
241 |
||
242 |
endif # PLATFORM |
|
243 |
||
244 |
# |
|
245 |
# Cross check all linted files against each other |
|
246 |
# |
|
247 |
ifeq ($(PLATFORM),solaris) |
|
248 |
lint.errors : $(FILES_ln) |
|
249 |
$(LINT.c) $(FILES_ln) $(LDLIBS) |
|
250 |
endif |
|
251 |
||
252 |
# |
|
253 |
# Class libraries with JNI native methods get a include to the package. |
|
254 |
# |
|
255 |
ifdef PACKAGE |
|
256 |
vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR) |
|
257 |
vpath %.c $(SHARE_SRC)/native/$(PKGDIR) |
|
258 |
OTHER_INCLUDES += -I$(SHARE_SRC)/native/common -I$(PLATFORM_SRC)/native/common |
|
259 |
OTHER_INCLUDES += -I$(SHARE_SRC)/native/$(PKGDIR) \ |
|
260 |
-I$(PLATFORM_SRC)/native/$(PKGDIR) |
|
261 |
endif |
|
262 |
||
263 |
# |
|
264 |
# Clean/clobber rules |
|
265 |
# |
|
266 |
clean:: |
|
267 |
$(RM) -r $(ACTUAL_LIBRARY) |
|
268 |
||
269 |
clobber:: clean |
|
270 |
||
271 |
# |
|
272 |
# INCREMENTAL_BUILD means that this workspace will be built over and over |
|
273 |
# possibly incrementally. This means tracking the object file dependencies |
|
274 |
# on include files so that sources get re-compiled when the include files |
|
275 |
# change. When building from scratch and doing a one time build (like |
|
276 |
# release engineering or nightly builds) set INCREMENTAL_BUILD=false. |
|
277 |
# |
|
278 |
||
279 |
ifeq ($(INCREMENTAL_BUILD),true) |
|
280 |
||
281 |
# |
|
282 |
# Workaround: gnumake sometimes says files is empty when it shouldn't |
|
283 |
# was: files := $(foreach file, $(wildcard $(OBJDIR)/*.$(DEPEND_SUFFIX)), $(file)) |
|
284 |
# |
|
285 |
files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null) |
|
286 |
||
287 |
# |
|
288 |
# Only include these files if we have any. |
|
289 |
# |
|
290 |
ifneq ($(strip $(files)),) |
|
291 |
||
292 |
include $(files) |
|
293 |
||
294 |
endif # files |
|
295 |
||
296 |
endif # INCREMENTAL_BUILD |
|
297 |
||
298 |
# |
|
299 |
# Default dependencies |
|
300 |
# |
|
301 |
||
302 |
all: build |
|
303 |
||
304 |
build: library |
|
305 |
||
306 |
debug: |
|
307 |
$(MAKE) VARIANT=DBG build |
|
308 |
||
309 |
fastdebug: |
|
310 |
$(MAKE) VARIANT=DBG FASTDEBUG=true build |
|
311 |
||
312 |
openjdk: |
|
313 |
$(MAKE) OPENJDK=true build |
|
314 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
315 |
FORCE: |
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
3111
diff
changeset
|
316 |
|
2 | 317 |
.PHONY: all build debug fastdebug |
318 |