source: trunk/openjdk/jdk/make/common/Library.gmk

Last change on this file was 448, checked in by dmik, 9 years ago

Remove SYM file generation on OS/2.

This doesn't make any practical sense as there is embedded HLL debug
info which is much more verbose than SYM and doesn't require separate
files (it is generated when -g option is passed to gcc).

This commint also removes the dependency on mapsym.exe and wmapsym.cmd.

File size: 10.0 KB
Line 
1#
2# Copyright (c) 1995, 2010, Oracle and/or its affiliates. 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. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle 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 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.
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
34include $(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
41ifneq ($(LIBRARY_SHORT),)
42LIBRARY_NAME = $(LIBRARY_SHORT)
43else
44LIBRARY_NAME = $(LIBRARY)
45endif
46
47ifeq ($(LIBRARY), fdlibm)
48ifeq ($(filter-out windows os2,$(PLATFORM)),)
49ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY_NAME).$(FDDLIBM_SUFFIX)
50ACTUAL_LIBRARY_DIR = $(OBJDIR)
51else # PLATFORM
52ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY_NAME).$(ARCH).$(FDDLIBM_SUFFIX)
53ACTUAL_LIBRARY_DIR = $(OBJDIR)
54endif #PLATFORM
55else # LIBRARY
56ACTUAL_LIBRARY_NAME = $(LIB_PREFIX)$(LIBRARY_NAME).$(LIBRARY_SUFFIX)
57ACTUAL_LIBRARY_DIR = $(LIB_LOCATION)
58endif
59ACTUAL_LIBRARY = $(ACTUAL_LIBRARY_DIR)/$(ACTUAL_LIBRARY_NAME)
60
61library:: $(ACTUAL_LIBRARY)
62
63FILES_o = $(patsubst %.c, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c))))
64FILES_o += $(patsubst %.s, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_s))))
65FILES_o += $(patsubst %.cpp, %.$(OBJECT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_cpp))))
66
67ifeq ($(INCREMENTAL_BUILD),true)
68FILES_d = $(patsubst %.c, %.$(DEPEND_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c))))
69FILES_d += $(patsubst %.cpp, %.$(DEPEND_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_cpp))))
70endif # INCREMENTAL_BUILD
71
72ifeq ($(PLATFORM),solaris)
73# List of all lint files, one for each .c file (only for C)
74FILES_ln = $(patsubst %.c, %.$(LINT_SUFFIX), $(addprefix $(OBJDIR)/, $(notdir $(FILES_c))))
75endif
76
77#
78# C++ libraries must be linked with CC.
79#
80ifdef CPLUSPLUSLIBRARY
81LINKER=$(LINK.cc)
82else
83LINKER=$(LINK.c)
84endif
85
86$(ACTUAL_LIBRARY):: $(INIT) $(TEMPDIR) $(LIBDIR) $(BINDIR) $(EXTDIR) classheaders
87
88#
89# COMPILE_APPROACH: Different approaches to compile up the native object
90# files as quickly as possible.
91# The setting of parallel works best on Unix, batch on Windows.
92#
93
94COMPILE_FILES_o = $(OBJDIR)/.files_compiled
95$(COMPILE_FILES_o): $(FILES_d) $(FILES_o)
96 @$(ECHO) "$<" >> $@
97clean::
98 $(RM) $(COMPILE_FILES_o)
99
100#
101# COMPILE_APPROACH=parallel: Will trigger compilations (just compilations) to
102# happen in parallel. Greatly decreases Unix build time, even on single CPU
103# machines, more so on multiple CPU machines. Default is 2 compiles
104# at a time, but can be adjusted with ALT_PARALLEL_COMPILE_JOBS.
105# Note that each .d file will also be dependent on it's .o file, see
106# Rules.gmk.
107# Note this does not depend on Rules.gmk to work like batch (below)
108# and this technique doesn't seem to help Windows build time nor does
109# it work very well, it's possible the Windows Visual Studio compilers
110# don't work well in a parallel situation, this needs investigation.
111#
112
113ifeq ($(COMPILE_APPROACH),parallel)
114
115.PHONY: library_parallel_compile
116
117library_parallel_compile:
118 @$(ECHO) "Begin parallel compiles: $(shell $(PWD))"
119 @$(MAKE) -j $(PARALLEL_COMPILE_JOBS) $(COMPILE_FILES_o)
120 @$(ECHO) "Done with parallel compiles: $(shell $(PWD))"
121
122$(ACTUAL_LIBRARY):: library_parallel_compile
123
124endif
125
126#
127# COMPILE_APPROACH=batch: Will trigger compilations (just compilations) to
128# happen in batch mode. Greatly decreases Windows build time.
129# See logic in Rules.gmk for how compiles happen, the $(MAKE) in
130# library_batch_compile below triggers the actions in Rules.gmk.
131# Note that each .d file will also be dependent on it's .o file, see
132# Rules.gmk.
133#
134ifeq ($(COMPILE_APPROACH),batch)
135
136.PHONY: library_batch_compile
137
138library_batch_compile:
139 @$(ECHO) "Begin BATCH compiles: $(shell $(PWD))"
140 $(MAKE) $(COMPILE_FILES_o)
141 $(MAKE) batch_compile
142 @$(ECHO) "Done with BATCH compiles: $(shell $(PWD))"
143 $(MAKE) COMPILE_APPROACH=normal $(COMPILE_FILES_o)
144
145$(ACTUAL_LIBRARY):: library_batch_compile
146
147endif
148
149ifeq ($(PLATFORM), windows)
150
151#
152# Library building rules.
153#
154
155$(LIBRARY).lib:: $(OBJDIR)
156
157ifeq ($(LIBRARY), fdlibm)
158$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lib
159
160$(OBJDIR)/$(LIBRARY).lib:: $(OBJDIR)/$(LIBRARY).lcf
161 @$(prep-target)
162 $(LIBEXE) -NODEFAULTLIB:MSVCRT -out:$@ -nologo \
163 @$(OBJDIR)/$(LIBRARY).lcf $(OTHER_LCF) $(LDLIBS_COMMON)
164else # LIBRARY
165# build it into $(OBJDIR) so that the other generated files get put
166# there, then copy just the DLL (and MAP file) to the requested directory.
167#
168$(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
169 @$(prep-target)
170 @$(MKDIR) -p $(OBJDIR)
171 $(LINK) -dll -out:$(OBJDIR)/$(@F) \
172 -map:$(OBJDIR)/$(LIBRARY).map \
173 $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \
174 $(OTHER_LCF) $(JAVALIB) $(LDLIBS)
175 $(CP) $(OBJDIR)/$(@F) $@
176 $(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
177 $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
178
179endif # LIBRARY
180
181$(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m)
182 @$(prep-target)
183 @$(MKDIR) -p $(TEMPDIR)
184 @$(ECHO) $(FILES_o) > $@
185ifndef LOCAL_RESOURCE_FILE
186 @$(ECHO) $(OBJDIR)/$(LIBRARY).res >> $@
187endif
188 @$(ECHO) Created $@
189
190# J2SE name required here
191RC_FLAGS += /D "J2SE_FNAME=$(LIBRARY).dll" \
192 /D "J2SE_INTERNAL_NAME=$(LIBRARY)" \
193 /D "J2SE_FTYPE=0x2L"
194
195$(OBJDIR)/$(LIBRARY).res: $(VERSIONINFO_RESOURCE)
196ifndef LOCAL_RESOURCE_FILE
197 @$(prep-target)
198 $(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(@) $(VERSIONINFO_RESOURCE)
199endif
200
201#
202# Install a .lib file if required.
203#
204ifeq ($(INSTALL_DOT_LIB), true)
205$(ACTUAL_LIBRARY):: $(LIBDIR)/$(LIBRARY).lib
206
207clean::
208 -$(RM) $(LIBDIR)/$(LIBRARY).lib
209
210$(LIBDIR)/$(LIBRARY).lib:: $(OBJDIR)/$(LIBRARY).lib
211 $(install-file)
212
213$(LIBDIR)/$(LIBRARY).dll:: $(OBJDIR)/$(LIBRARY).dll
214 $(install-file)
215
216endif # INSTALL_DOT_LIB
217
218else # PLATFORM == windows
219
220ifeq ($(PLATFORM), os2)
221
222$(ACTUAL_LIBRARY):: $(COMPILE_FILES_o) $(FILES_m) $(FILES_reorder) $(DEF_FILE)
223 @$(prep-target)
224 @$(ECHO) "STATS: LIBRARY=$(LIBRARY), PRODUCT=$(PRODUCT), _OPT=$(_OPT)"
225 @$(ECHO) "Rebuilding $@ because of $?"
226ifeq ($(LIBRARY), fdlibm)
227 $(AR) r $@ $(FILES_o)
228else # LIBRARY
229 $(LINK) $(LDFLAGS) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS) $(DEF_FILE)
230 $(IMPLIB) -o $(OBJDIR)/$(LIBRARY).lib $@
231endif # LIBRARY
232
233#
234# Install a .lib file if required.
235#
236ifeq ($(INSTALL_DOT_LIB), true)
237
238$(ACTUAL_LIBRARY):: $(LIBDIR)/$(LIBRARY).lib
239
240clean::
241 -$(RM) $(LIBDIR)/$(LIBRARY).lib
242 -$(RM) $(LIBDIR)/$(LIBRARY).dll
243
244$(LIBDIR)/$(LIBRARY).lib:: $(OBJDIR)/$(LIBRARY).lib
245 $(install-file)
246
247$(LIBDIR)/$(LIBRARY).dll:: $(ACTUAL_LIBRARY)
248 $(install-file)
249
250endif # INSTALL_DOT_LIB
251
252else # PLATFORM == os2
253
254#
255# On Solaris, use mcs to write the version into the comment section of
256# the shared library. On other platforms set this to false at the
257# make command line.
258#
259$(ACTUAL_LIBRARY):: $(COMPILE_FILES_o) $(FILES_m) $(FILES_reorder)
260 @$(prep-target)
261 @$(ECHO) "STATS: LIBRARY=$(LIBRARY), PRODUCT=$(PRODUCT), _OPT=$(_OPT)"
262 @$(ECHO) "Rebuilding $@ because of $?"
263ifeq ($(LIBRARY), fdlibm)
264 $(AR) -r $@ $(FILES_o)
265else # LIBRARY
266 $(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS)
267ifeq ($(WRITE_LIBVERSION),true)
268 $(MCS) -d -a "$(FULL_VERSION)" $@
269endif # WRITE_LIBVERSION
270endif # LIBRARY
271
272endif # PLATFORM == os2
273
274endif # PLATFORM == windows
275
276#
277# Cross check all linted files against each other
278#
279ifeq ($(PLATFORM),solaris)
280lint.errors : $(FILES_ln)
281 $(LINT.c) $(FILES_ln) $(LDLIBS)
282endif
283
284#
285# Class libraries with JNI native methods get a include to the package.
286#
287ifdef PACKAGE
288
289ifeq ($(PLATFORM), os2)
290# OS/2 specific vpath should come first
291vpath %.c $(PLATFORM_SRC_OS2)/native/$(PKGDIR)
292OTHER_INCLUDES += -I$(PLATFORM_SRC_OS2)/native/common
293OTHER_INCLUDES += -I$(PLATFORM_SRC_OS2)/native/$(PKGDIR)
294# path to common code used by many DLLs
295vpath %.cpp $(PLATFORM_SRC_OS2)/native/common
296endif
297
298vpath %.c $(PLATFORM_SRC)/native/$(PKGDIR)
299vpath %.c $(SHARE_SRC)/native/$(PKGDIR)
300OTHER_INCLUDES += -I$(SHARE_SRC)/native/common -I$(PLATFORM_SRC)/native/common
301OTHER_INCLUDES += -I$(SHARE_SRC)/native/$(PKGDIR) \
302 -I$(PLATFORM_SRC)/native/$(PKGDIR)
303
304endif
305
306#
307# Clean/clobber rules
308#
309clean::
310 $(RM) -r $(ACTUAL_LIBRARY)
311
312clobber:: clean
313
314#
315# INCREMENTAL_BUILD means that this workspace will be built over and over
316# possibly incrementally. This means tracking the object file dependencies
317# on include files so that sources get re-compiled when the include files
318# change. When building from scratch and doing a one time build (like
319# release engineering or nightly builds) set INCREMENTAL_BUILD=false.
320#
321
322ifeq ($(INCREMENTAL_BUILD),true)
323
324#
325# Workaround: gnumake sometimes says files is empty when it shouldn't
326# was: files := $(foreach file, $(wildcard $(OBJDIR)/*.$(DEPEND_SUFFIX)), $(file))
327#
328files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null)
329
330#
331# Only include these files if we have any.
332#
333ifneq ($(strip $(files)),)
334
335include $(files)
336
337endif # files
338
339endif # INCREMENTAL_BUILD
340
341#
342# Default dependencies
343#
344
345all: build
346
347build: library
348
349debug:
350 $(MAKE) VARIANT=DBG build
351
352fastdebug:
353 $(MAKE) VARIANT=DBG FASTDEBUG=true build
354
355openjdk:
356 $(MAKE) OPENJDK=true build
357
358.PHONY: all build debug fastdebug
359
Note: See TracBrowser for help on using the repository browser.