113 ifndef LP64
114 $(error " Precompiled Headers only supported on 64-bit platforms!")
115 endif
116
117 PRECOMPILED_HEADER_DIR=.
118 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
119 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
120
121 PCH_FLAG = -include precompiled.hpp
122 PCH_FLAG/DEFAULT = $(PCH_FLAG)
123 PCH_FLAG/NO_PCH = -DNO_PCH
124 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
125
126 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
127 VM_PCH_FLAG/AOUT =
128 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
129
130 # We only use precompiled headers for the JVM build
131 CFLAGS += $(VM_PCH_FLAG)
132
133 # There are some files which don't like precompiled headers
134 # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
135 # But Clang doesn't support a precompiled header which was compiled with -O3
136 # to be used in a compilation unit which uses '-O0'. We could also prepare an
137 # extra '-O0' PCH file for the opt build and use it here, but it's probably
138 # not worth the effort as long as only two files need this special handling.
139 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
140 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
141 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
142 PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH)
143
144 endif
145 else # ($(USE_CLANG), true)
146 # check for precompiled headers support
147 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
148 # Allow the user to turn off precompiled headers from the command line.
149 ifneq ($(USE_PRECOMPILED_HEADER),0)
150 PRECOMPILED_HEADER_DIR=.
151 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
152 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
153 endif
154 endif
155 endif
156
157 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
158 ifeq ($(USE_PRECOMPILED_HEADER),0)
290 ifdef OPT_CFLAGS
291 ifneq ("$(origin OPT_CFLAGS)", "command line")
292 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
293 endif
294 endif
295
296 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
297
298 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
299 # if we use expensive-optimizations
300 ifeq ($(BUILDARCH), ia64)
301 OPT_CFLAGS += -fno-expensive-optimizations
302 endif
303
304 OPT_CFLAGS/NOOPT=-O0
305
306 # Work around some compiler bugs.
307 ifeq ($(USE_CLANG), true)
308 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
309 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
310 OPT_CFLAGS/unsafe.o += -01
311 endif
312 else
313 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
314 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
315 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
316 endif
317 endif
318
319 # Flags for generating make dependency flags.
320 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
321 ifeq ($(USE_CLANG),)
322 ifneq ($(CC_VER_MAJOR), 2)
323 DEPFLAGS += -fpch-deps
324 endif
325 endif
326
327 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
328 ifeq ($(USE_PRECOMPILED_HEADER),0)
329 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
330 endif
|
113 ifndef LP64
114 $(error " Precompiled Headers only supported on 64-bit platforms!")
115 endif
116
117 PRECOMPILED_HEADER_DIR=.
118 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
119 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
120
121 PCH_FLAG = -include precompiled.hpp
122 PCH_FLAG/DEFAULT = $(PCH_FLAG)
123 PCH_FLAG/NO_PCH = -DNO_PCH
124 PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
125
126 VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
127 VM_PCH_FLAG/AOUT =
128 VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
129
130 # We only use precompiled headers for the JVM build
131 CFLAGS += $(VM_PCH_FLAG)
132
133 # The following files are compiled at various optimization
134 # levels due to optimization issues encountered at the
135 # 'OPT_CFLAGS_DEFAULT' level. The Clang compiler issues a compile
136 # time error if there is an optimization level specification
137 # skew between the PCH file and the C++ file. Especially if the
138 # PCH file is compiled at a higher optimization level than
139 # the C++ file. One solution might be to prepare extra optimization
140 # level specific PCH files for the opt build and use them here, but
141 # it's probably not worth the effort as long as only a few files
142 # need this special handling.
143 PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
144 PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
145 PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
146 PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH)
147
148 endif
149 else # ($(USE_CLANG), true)
150 # check for precompiled headers support
151 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
152 # Allow the user to turn off precompiled headers from the command line.
153 ifneq ($(USE_PRECOMPILED_HEADER),0)
154 PRECOMPILED_HEADER_DIR=.
155 PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
156 PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
157 endif
158 endif
159 endif
160
161 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
162 ifeq ($(USE_PRECOMPILED_HEADER),0)
294 ifdef OPT_CFLAGS
295 ifneq ("$(origin OPT_CFLAGS)", "command line")
296 $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
297 endif
298 endif
299
300 OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
301
302 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
303 # if we use expensive-optimizations
304 ifeq ($(BUILDARCH), ia64)
305 OPT_CFLAGS += -fno-expensive-optimizations
306 endif
307
308 OPT_CFLAGS/NOOPT=-O0
309
310 # Work around some compiler bugs.
311 ifeq ($(USE_CLANG), true)
312 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
313 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
314 OPT_CFLAGS/unsafe.o += -O1
315 endif
316 else
317 # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
318 ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
319 OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
320 endif
321 endif
322
323 # Flags for generating make dependency flags.
324 DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
325 ifeq ($(USE_CLANG),)
326 ifneq ($(CC_VER_MAJOR), 2)
327 DEPFLAGS += -fpch-deps
328 endif
329 endif
330
331 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
332 ifeq ($(USE_PRECOMPILED_HEADER),0)
333 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
334 endif
|