1 #
2 # Copyright (c) 1999, 2012, 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.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
25 # Rules to build JVM and related libraries, included from vm.make in the build
26 # directory.
27
28 # Common build rules.
29 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
30 include $(MAKEFILES_DIR)/rules.make
31 include $(GAMMADIR)/make/altsrc.make
32
33 default: build
34
35 #----------------------------------------------------------------------
36 # Defs
37
38 GENERATED = ../generated
39 DEP_DIR = $(GENERATED)/dependencies
40
41 # reads the generated files defining the set of .o's and the .o .h dependencies
42 -include $(DEP_DIR)/*.d
43
44 # read machine-specific adjustments (%%% should do this via buildtree.make?)
45 ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
46 include $(MAKEFILES_DIR)/zeroshark.make
47 else
48 include $(MAKEFILES_DIR)/$(BUILDARCH).make
49 -include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make
50 endif
51
52 # set VPATH so make knows where to look for source files
53 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
54 # The adfiles directory contains ad_<arch>.[ch]pp.
55 # The jvmtifiles directory contains jvmti*.[ch]pp
56 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
57 VPATH += $(Src_Dirs_V:%=%:)
58
59 # set INCLUDES for C preprocessor.
60 Src_Dirs_I += $(GENERATED)
61 # The order is important for the precompiled headers to work.
62 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
63
64 # SYMFLAG is used by {jsig,saproc}.make
65 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
227
228 JVM_OBJ_FILES = $(Obj_Files)
229
230 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
231
232 mapfile : $(MAPFILE) vm.def
233 rm -f $@
234 awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \
235 { system ("cat vm.def"); } \
236 else \
237 { print $$0 } \
238 }' > $@ < $(MAPFILE)
239
240 mapfile_reorder : mapfile $(REORDERFILE)
241 rm -f $@
242 cat $^ > $@
243
244 vm.def: $(Res_Files) $(Obj_Files)
245 sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
246
247 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
248 STATIC_CXX = false
249 else
250 ifeq ($(ZERO_LIBARCH), ppc64)
251 STATIC_CXX = false
252 else
253 STATIC_CXX = true
254 endif
255 endif
256
257 ifeq ($(LINK_INTO),AOUT)
258 LIBJVM.o =
259 LIBJVM_MAPFILE =
260 LIBS_VM = $(LIBS)
261 else
262 LIBJVM.o = $(JVM_OBJ_FILES)
263 LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
264 LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
265 LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
266
267 # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
268 # get around library dependency and compatibility issues. Must use gcc not
269 # g++ to link.
270 ifeq ($(STATIC_CXX), true)
271 LFLAGS_VM += $(STATIC_LIBGCC)
272 LIBS_VM += $(STATIC_STDCXX)
273 else
274 LIBS_VM += -lstdc++
275 endif
276
277 LIBS_VM += $(LIBS)
278 endif
279 ifeq ($(JVM_VARIANT_ZERO), true)
280 LIBS_VM += $(LIBFFI_LIBS)
281 endif
282 ifeq ($(JVM_VARIANT_ZEROSHARK), true)
283 LIBS_VM += $(LIBFFI_LIBS) $(LLVM_LIBS)
284 LFLAGS_VM += $(LLVM_LDFLAGS)
285 endif
286
287 LINK_VM = $(LINK_LIB.CC)
288
289 # rule for building precompiled header
290 $(PRECOMPILED_HEADER):
291 $(QUIETLY) echo Generating precompiled header $@
292 $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
293 $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
294
295 # making the library:
296
297 ifneq ($(JVM_BASE_ADDR),)
298 # By default shared library is linked at base address == 0. Modify the
299 # linker script if JVM prefers a different base location. It can also be
300 # implemented with 'prelink -r'. But 'prelink' is not (yet) available on
301 # our build platform (AS-2.1).
302 LD_SCRIPT = libjvm.so.lds
|
1 #
2 # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
3 # Copyright (c) 2013 Red Hat, Inc.
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # This code is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License version 2 only, as
8 # published by the Free Software Foundation.
9 #
10 # This code is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # version 2 for more details (a copy is included in the LICENSE file that
14 # accompanied this code).
15 #
16 # You should have received a copy of the GNU General Public License version
17 # 2 along with this work; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 # or visit www.oracle.com if you need additional information or have any
22 # questions.
23 #
26 # Rules to build JVM and related libraries, included from vm.make in the build
27 # directory.
28
29 # Common build rules.
30 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
31 include $(MAKEFILES_DIR)/rules.make
32 include $(GAMMADIR)/make/altsrc.make
33
34 default: build
35
36 #----------------------------------------------------------------------
37 # Defs
38
39 GENERATED = ../generated
40 DEP_DIR = $(GENERATED)/dependencies
41
42 # reads the generated files defining the set of .o's and the .o .h dependencies
43 -include $(DEP_DIR)/*.d
44
45 # read machine-specific adjustments (%%% should do this via buildtree.make?)
46 ifeq ($(TYPE),ZERO)
47 include $(MAKEFILES_DIR)/zeroshark.make
48 else ifeq ($(TYPE),SHARK)
49 include $(MAKEFILES_DIR)/zeroshark.make
50 else
51 include $(MAKEFILES_DIR)/$(BUILDARCH).make
52 -include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make
53 endif
54
55 # set VPATH so make knows where to look for source files
56 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
57 # The adfiles directory contains ad_<arch>.[ch]pp.
58 # The jvmtifiles directory contains jvmti*.[ch]pp
59 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles
60 VPATH += $(Src_Dirs_V:%=%:)
61
62 # set INCLUDES for C preprocessor.
63 Src_Dirs_I += $(GENERATED)
64 # The order is important for the precompiled headers to work.
65 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
66
67 # SYMFLAG is used by {jsig,saproc}.make
68 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
230
231 JVM_OBJ_FILES = $(Obj_Files)
232
233 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
234
235 mapfile : $(MAPFILE) vm.def
236 rm -f $@
237 awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \
238 { system ("cat vm.def"); } \
239 else \
240 { print $$0 } \
241 }' > $@ < $(MAPFILE)
242
243 mapfile_reorder : mapfile $(REORDERFILE)
244 rm -f $@
245 cat $^ > $@
246
247 vm.def: $(Res_Files) $(Obj_Files)
248 sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
249
250 ifeq ($(TYPE),SHARK)
251 STATIC_CXX = false
252 else
253 ifeq ($(ZERO_LIBARCH), ppc64)
254 STATIC_CXX = false
255 else
256 STATIC_CXX = true
257 endif
258 endif
259
260 ifeq ($(LINK_INTO),AOUT)
261 LIBJVM.o =
262 LIBJVM_MAPFILE =
263 LIBS_VM = $(LIBS)
264 else
265 LIBJVM.o = $(JVM_OBJ_FILES)
266 LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
267 LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
268 LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
269
270 # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
271 # get around library dependency and compatibility issues. Must use gcc not
272 # g++ to link.
273 ifeq ($(STATIC_CXX), true)
274 LFLAGS_VM += $(STATIC_LIBGCC)
275 LIBS_VM += $(STATIC_STDCXX)
276 else
277 LIBS_VM += -lstdc++
278 endif
279
280 LIBS_VM += $(LIBS)
281 endif
282 ifeq ($(TYPE),ZERO)
283 LIBS_VM += $(LIBFFI_LIBS)
284 endif
285 ifeq ($(TYPE),SHARK)
286 LIBS_VM += $(LIBFFI_LIBS) $(LLVM_LIBS)
287 LFLAGS_VM += $(LLVM_LDFLAGS)
288 endif
289
290 LINK_VM = $(LINK_LIB.CC)
291
292 # rule for building precompiled header
293 $(PRECOMPILED_HEADER):
294 $(QUIETLY) echo Generating precompiled header $@
295 $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)
296 $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE)
297
298 # making the library:
299
300 ifneq ($(JVM_BASE_ADDR),)
301 # By default shared library is linked at base address == 0. Modify the
302 # linker script if JVM prefers a different base location. It can also be
303 # implemented with 'prelink -r'. But 'prelink' is not (yet) available on
304 # our build platform (AS-2.1).
305 LD_SCRIPT = libjvm.so.lds
|