219 SetupCompileNativeFile = $(NamedParamsMacroTemplate)
220 define SetupCompileNativeFileBody
221 $1_FILENAME := $$(notdir $$($1_FILE))
222
223 # The target file to be generated.
224 $1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
225 $$($1_FILENAME))
226
227 # Generate the corresponding compile_commands.json fragment.
228 $1_OBJ_JSON = $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
229 $$(OUTPUTDIR)/,,$$($1_OBJ))).json
230 $$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON)
231
232 # Only continue if this object file hasn't been processed already. This lets
233 # the first found source file override any other with the same name.
234 ifeq ($$($1_OBJ_PROCESSED), )
235 $1_OBJ_PROCESSED := true
236 # This is the definite source file to use for $1_FILENAME.
237 $1_SRC_FILE := $$($1_FILE)
238
239 ifneq ($$($1_DISABLE_THIS_FILE_DEFINE), true)
240 $1_THIS_FILE = -DTHIS_FILE='"$$($1_FILENAME)"'
241 endif
242
243 ifeq ($$($1_OPTIMIZATION), )
244 $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS)
245 $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS)
246 else
247 ifeq ($$($1_OPTIMIZATION), NONE)
248 $1_OPT_CFLAGS := $(C_O_FLAG_NONE)
249 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
250 else ifeq ($$($1_OPTIMIZATION), LOW)
251 $1_OPT_CFLAGS := $(C_O_FLAG_NORM)
252 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
253 else ifeq ($$($1_OPTIMIZATION), HIGH)
254 $1_OPT_CFLAGS := $(C_O_FLAG_HI)
255 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HI)
256 else ifeq ($$($1_OPTIMIZATION), HIGHEST)
257 $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
258 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
259 else ifeq ($$($1_OPTIMIZATION), HIGHEST_JVM)
260 $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
261 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
409 # REORDER reorder file
410 # USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
411 # mapfile for the output symbols file
412 # CC the compiler to use, default is $(CC)
413 # LD the linker to use, default is $(LD)
414 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
415 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
416 # DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
417 # when compiling C code
418 # DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
419 # toolchain when compiling C++ code
420 # STRIP_SYMBOLS Set to false to override global strip policy and always leave
421 # symbols in the binary, if the toolchain allows for it
422 # DEBUG_SYMBOLS Set to false to disable generation of debug symbols
423 # COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
424 # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
425 # zipping
426 # STRIPFLAGS Optionally change the flags given to the strip command
427 # PRECOMPILED_HEADER Header file to use as precompiled header
428 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
429 #
430 # After being called, some variables are exported from this macro, all prefixed
431 # with parameter 1 followed by a '_':
432 # TARGET The library or executable created by the macro
433 # TARGET_DEPS All prerequisites for the target calculated by the macro
434 # ALL_OBJS All object files
435 # IMPORT_LIBRARY The import library created for a shared library on Windows
436 SetupNativeCompilation = $(NamedParamsMacroTemplate)
437 define SetupNativeCompilationBody
438
439 # If type is unspecified, default to LIBRARY
440 ifeq ($$($1_TYPE), )
441 $1_TYPE := LIBRARY
442 endif
443
444 # If we're doing a static build and producing a library
445 # force it to be a static library and remove the -l libraries
446 ifeq ($(STATIC_BUILD), true)
447 ifeq ($$($1_TYPE), LIBRARY)
448 $1_TYPE := STATIC_LIBRARY
686 # Track variable changes for all variables that affect the compilation command
687 # lines for all object files in this setup. This includes at least all the
688 # variables used in the call to add_native_source below.
689 $1_COMPILE_VARDEPS := $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
690 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_OPT_CFLAGS) $$($1_OPT_CXXFLAGS) \
691 $$($1_CC) $$($1_CXX) $$($1_AS) $$($1_ASFLAGS)
692 $1_COMPILE_VARDEPS_FILE := $$(call DependOnVariable, $1_COMPILE_VARDEPS, \
693 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).comp.vardeps)
694
695 ifneq ($$($1_PRECOMPILED_HEADER), )
696 ifeq ($(USE_PRECOMPILED_HEADER), true)
697 ifeq ($(TOOLCHAIN_TYPE), microsoft)
698 $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
699 $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
700 $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
701
702 $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
703 FILE := $$($1_GENERATED_PCH_SRC), \
704 BASE := $1, \
705 EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
706 DISABLE_THIS_FILE_DEFINE := true, \
707 ))
708
709 $1_USE_PCH_FLAGS := \
710 -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
711
712 $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
713
714 # Explicitly add the pch obj file first to ease comparing to old
715 # hotspot build.
716 $1_ALL_OBJS := $$($1_GENERATED_PCH_OBJ) $$($1_ALL_OBJS)
717
718 $$($1_GENERATED_PCH_SRC):
719 $(ECHO) "#include \"$$(notdir $$($1_PRECOMPILED_HEADER))\"" > $$@
720
721 else ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
722 ifeq ($(TOOLCHAIN_TYPE), gcc)
723 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch
724 $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled
725 else ifeq ($(TOOLCHAIN_TYPE), clang)
726 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch
|
219 SetupCompileNativeFile = $(NamedParamsMacroTemplate)
220 define SetupCompileNativeFileBody
221 $1_FILENAME := $$(notdir $$($1_FILE))
222
223 # The target file to be generated.
224 $1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
225 $$($1_FILENAME))
226
227 # Generate the corresponding compile_commands.json fragment.
228 $1_OBJ_JSON = $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \
229 $$(OUTPUTDIR)/,,$$($1_OBJ))).json
230 $$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON)
231
232 # Only continue if this object file hasn't been processed already. This lets
233 # the first found source file override any other with the same name.
234 ifeq ($$($1_OBJ_PROCESSED), )
235 $1_OBJ_PROCESSED := true
236 # This is the definite source file to use for $1_FILENAME.
237 $1_SRC_FILE := $$($1_FILE)
238
239 ifneq ($$($1_DEFINE_THIS_FILE), false)
240 ifneq ($$($$($1_BASE)_DEFINE_THIS_FILE), false)
241 $1_THIS_FILE = -DTHIS_FILE='"$$($1_FILENAME)"'
242 endif
243 endif
244
245 ifeq ($$($1_OPTIMIZATION), )
246 $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS)
247 $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS)
248 else
249 ifeq ($$($1_OPTIMIZATION), NONE)
250 $1_OPT_CFLAGS := $(C_O_FLAG_NONE)
251 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
252 else ifeq ($$($1_OPTIMIZATION), LOW)
253 $1_OPT_CFLAGS := $(C_O_FLAG_NORM)
254 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
255 else ifeq ($$($1_OPTIMIZATION), HIGH)
256 $1_OPT_CFLAGS := $(C_O_FLAG_HI)
257 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HI)
258 else ifeq ($$($1_OPTIMIZATION), HIGHEST)
259 $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
260 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
261 else ifeq ($$($1_OPTIMIZATION), HIGHEST_JVM)
262 $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
263 $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
411 # REORDER reorder file
412 # USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
413 # mapfile for the output symbols file
414 # CC the compiler to use, default is $(CC)
415 # LD the linker to use, default is $(LD)
416 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
417 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
418 # DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
419 # when compiling C code
420 # DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
421 # toolchain when compiling C++ code
422 # STRIP_SYMBOLS Set to false to override global strip policy and always leave
423 # symbols in the binary, if the toolchain allows for it
424 # DEBUG_SYMBOLS Set to false to disable generation of debug symbols
425 # COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
426 # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
427 # zipping
428 # STRIPFLAGS Optionally change the flags given to the strip command
429 # PRECOMPILED_HEADER Header file to use as precompiled header
430 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
431 # DEFINE_THIS_FILE Set to false to not set the THIS_FILE preprocessor macro
432 #
433 # After being called, some variables are exported from this macro, all prefixed
434 # with parameter 1 followed by a '_':
435 # TARGET The library or executable created by the macro
436 # TARGET_DEPS All prerequisites for the target calculated by the macro
437 # ALL_OBJS All object files
438 # IMPORT_LIBRARY The import library created for a shared library on Windows
439 SetupNativeCompilation = $(NamedParamsMacroTemplate)
440 define SetupNativeCompilationBody
441
442 # If type is unspecified, default to LIBRARY
443 ifeq ($$($1_TYPE), )
444 $1_TYPE := LIBRARY
445 endif
446
447 # If we're doing a static build and producing a library
448 # force it to be a static library and remove the -l libraries
449 ifeq ($(STATIC_BUILD), true)
450 ifeq ($$($1_TYPE), LIBRARY)
451 $1_TYPE := STATIC_LIBRARY
689 # Track variable changes for all variables that affect the compilation command
690 # lines for all object files in this setup. This includes at least all the
691 # variables used in the call to add_native_source below.
692 $1_COMPILE_VARDEPS := $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
693 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_OPT_CFLAGS) $$($1_OPT_CXXFLAGS) \
694 $$($1_CC) $$($1_CXX) $$($1_AS) $$($1_ASFLAGS)
695 $1_COMPILE_VARDEPS_FILE := $$(call DependOnVariable, $1_COMPILE_VARDEPS, \
696 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).comp.vardeps)
697
698 ifneq ($$($1_PRECOMPILED_HEADER), )
699 ifeq ($(USE_PRECOMPILED_HEADER), true)
700 ifeq ($(TOOLCHAIN_TYPE), microsoft)
701 $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
702 $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
703 $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
704
705 $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
706 FILE := $$($1_GENERATED_PCH_SRC), \
707 BASE := $1, \
708 EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
709 DEFINE_THIS_FILE := false, \
710 ))
711
712 $1_USE_PCH_FLAGS := \
713 -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
714
715 $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
716
717 # Explicitly add the pch obj file first to ease comparing to old
718 # hotspot build.
719 $1_ALL_OBJS := $$($1_GENERATED_PCH_OBJ) $$($1_ALL_OBJS)
720
721 $$($1_GENERATED_PCH_SRC):
722 $(ECHO) "#include \"$$(notdir $$($1_PRECOMPILED_HEADER))\"" > $$@
723
724 else ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
725 ifeq ($(TOOLCHAIN_TYPE), gcc)
726 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch
727 $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled
728 else ifeq ($(TOOLCHAIN_TYPE), clang)
729 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch
|