Wed, 15 Dec 2010 05:43:54 -0800
7006659: temporary adlc files are added to the build variables
Summary: Don't recurse into sub-directories when looking for source files.
Reviewed-by: never, brutisso
1 #
2 # Copyright (c) 1998, 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.
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 #
23 #
25 # Rules to build JVM and related libraries, included from vm.make in the build
26 # directory.
28 # Common build rules.
29 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
30 include $(MAKEFILES_DIR)/rules.make
32 default: build
34 #----------------------------------------------------------------------
35 # Defs
37 GENERATED = ../generated
38 DEP_DIR = $(GENERATED)/dependencies
40 # reads the generated files defining the set of .o's and the .o .h dependencies
41 -include $(DEP_DIR)/*.d
43 # read machine-specific adjustments (%%% should do this via buildtree.make?)
44 include $(MAKEFILES_DIR)/$(BUILDARCH).make
46 # set VPATH so make knows where to look for source files
47 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
48 # The adfiles directory contains ad_<arch>.[ch]pp.
49 # The jvmtifiles directory contains jvmti*.[ch]pp
50 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles
51 VPATH += $(Src_Dirs_V:%=%:)
53 # set INCLUDES for C preprocessor
54 Src_Dirs_I += $(GENERATED)
55 INCLUDES += $(Src_Dirs_I:%=-I%)
57 ifeq (${VERSION}, debug)
58 SYMFLAG = -g
59 else
60 SYMFLAG =
61 endif
63 # The following variables are defined in the generated flags.make file.
64 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
65 JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
66 HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
67 BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
68 BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
69 VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
71 CPPFLAGS = \
72 ${SYSDEFS} \
73 ${INCLUDES} \
74 ${BUILD_VERSION} \
75 ${BUILD_TARGET} \
76 ${BUILD_USER} \
77 ${HS_LIB_ARCH} \
78 ${JRE_VERSION} \
79 ${VM_DISTRO}
81 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
82 CFLAGS += $(CFLAGS_WARN)
84 # Do not use C++ exception handling
85 CFLAGS += $(CFLAGS/NOEX)
87 # Extra flags from gnumake's invocation or environment
88 CFLAGS += $(EXTRA_CFLAGS)
90 # Math Library (libm.so), do not use -lm.
91 # There might be two versions of libm.so on the build system:
92 # libm.so.1 and libm.so.2, and we want libm.so.1.
93 # Depending on the Solaris release being used to build with,
94 # /usr/lib/libm.so could point at a libm.so.2, so we are
95 # explicit here so that the libjvm.so you have built will work on an
96 # older Solaris release that might not have libm.so.2.
97 # This is a critical factor in allowing builds on Solaris 10 or newer
98 # to run on Solaris 8 or 9.
99 #
100 LIBM=/usr/lib$(ISA_DIR)/libm.so.1
102 ifeq ("${Platform_compiler}", "sparcWorks")
103 # The whole megilla:
104 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
105 # Old Comment: List the libraries in the order the compiler was designed for
106 # Not sure what the 'designed for' comment is referring too above.
107 # The order may not be too significant anymore, but I have placed this
108 # older libm before libCrun, just to make sure it's found and used first.
109 LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc -ldemangle
110 else
111 ifeq ($(COMPILER_REV_NUMERIC), 502)
112 # SC6.1 has it's own libm.so: specifying anything else provokes a name conflict.
113 LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor -ldemangle
114 else
115 LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor -ldemangle
116 endif # 502
117 endif # 505
118 else
119 LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
120 endif # sparcWorks
122 # By default, link the *.o into the library, not the executable.
123 LINK_INTO$(LINK_INTO) = LIBJVM
125 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
127 #----------------------------------------------------------------------
128 # jvm_db & dtrace
129 include $(MAKEFILES_DIR)/dtrace.make
131 #----------------------------------------------------------------------
132 # JVM
134 JVM = jvm
135 LIBJVM = lib$(JVM).so
136 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
138 CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
139 CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
140 CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
141 CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
142 CORE_PATHS += $(GENERATED)/jvmtifiles
144 COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
146 COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
147 COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
148 COMPILER2_PATHS += $(GENERATED)/adfiles
150 # Include dirs per type.
151 Src_Dirs/CORE := $(CORE_PATHS)
152 Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS)
153 Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS)
154 Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS)
155 Src_Dirs/ZERO := $(CORE_PATHS)
156 Src_Dirs/SHARK := $(CORE_PATHS)
157 Src_Dirs := $(Src_Dirs/$(TYPE))
159 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp chaitin\* c2_\* runtime_\*
160 COMPILER1_SPECIFIC_FILES := c1_\*
161 SHARK_SPECIFIC_FILES := shark
162 ZERO_SPECIFIC_FILES := zero
164 # Always exclude these.
165 Src_Files_EXCLUDE := dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
167 # Exclude per type.
168 Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
169 Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
170 Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
171 Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES)
172 Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
173 Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES)
175 Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE))
177 # Special handling of arch model.
178 ifeq ($(Platform_arch_model), x86_32)
179 Src_Files_EXCLUDE += \*x86_64\*
180 endif
181 ifeq ($(Platform_arch_model), x86_64)
182 Src_Files_EXCLUDE += \*x86_32\*
183 endif
185 # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
186 define findsrc
187 $(notdir $(shell find $(1)/. ! -name . -prune \
188 -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
189 -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
190 endef
192 Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e)))
194 Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))))
196 JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS)
198 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
200 mapfile : $(MAPFILE) $(MAPFILE_DTRACE_OPT)
201 rm -f $@
202 cat $^ > $@
204 mapfile_reorder : mapfile $(MAPFILE_DTRACE_OPT) $(REORDERFILE)
205 rm -f $@
206 cat $^ > $@
208 ifeq ($(LINK_INTO),AOUT)
209 LIBJVM.o =
210 LIBJVM_MAPFILE =
211 LIBS_VM = $(LIBS)
212 else
213 LIBJVM.o = $(JVM_OBJ_FILES)
214 LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
215 LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
216 LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM))
217 ifndef USE_GCC
218 LIBS_VM = $(LIBS)
219 else
220 # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
221 # get around library dependency and compatibility issues. Must use gcc not
222 # g++ to link.
223 LFLAGS_VM += $(STATIC_LIBGCC)
224 LIBS_VM += $(STATIC_STDCXX) $(LIBS)
225 endif
226 endif
228 ifdef USE_GCC
229 LINK_VM = $(LINK_LIB.c)
230 else
231 LINK_VM = $(LINK_LIB.CC)
232 endif
233 # making the library:
234 $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE)
235 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
236 @echo Linking vm...
237 $(QUIETLY) $(LINK_LIB.CC/PRE_HOOK)
238 $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM)
239 $(QUIETLY) $(LINK_LIB.CC/POST_HOOK)
240 $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
241 $(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
242 $(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
243 endif # filter -sbfast -xsbfast
246 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
248 install_jvm: $(LIBJVM)
249 @echo "Copying $(LIBJVM) to $(DEST_JVM)"
250 $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
252 #----------------------------------------------------------------------
253 # Other files
255 # Gamma launcher
256 include $(MAKEFILES_DIR)/launcher.make
258 # Signal interposition library
259 include $(MAKEFILES_DIR)/jsig.make
261 # Serviceability agent
262 include $(MAKEFILES_DIR)/saproc.make
264 #----------------------------------------------------------------------
266 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) $(BUILDLIBSAPROC) dtraceCheck
268 install: install_jvm install_jsig install_saproc
270 .PHONY: default build install install_jvm