< prev index next >

make/common/NativeCompilation.gmk

Print this page




 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 ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
 235     $$($1_BASE)_OBJS_SO_FAR += $$($1_OBJ)
 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)


 405 #   REORDER reorder file
 406 #   USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
 407 #       mapfile for the output symbols file
 408 #   CC the compiler to use, default is $(CC)
 409 #   LD the linker to use, default is $(LD)
 410 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
 411 #   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
 412 #   DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
 413 #       when compiling C code
 414 #   DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
 415 #       toolchain when compiling C++ code
 416 #   STRIP_SYMBOLS Set to false to override global strip policy and always leave
 417 #       symbols in the binary, if the toolchain allows for it
 418 #   DEBUG_SYMBOLS Set to false to disable generation of debug symbols
 419 #   COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
 420 #   ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
 421 #       zipping
 422 #   STRIPFLAGS Optionally change the flags given to the strip command
 423 #   PRECOMPILED_HEADER Header file to use as precompiled header
 424 #   PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH

 425 #
 426 # After being called, some variables are exported from this macro, all prefixed
 427 # with parameter 1 followed by a '_':
 428 #   TARGET The library or executable created by the macro
 429 #   TARGET_DEPS All prerequisites for the target calculated by the macro
 430 #   ALL_OBJS All object files
 431 #   IMPORT_LIBRARY The import library created for a shared library on Windows
 432 SetupNativeCompilation = $(NamedParamsMacroTemplate)
 433 define SetupNativeCompilationBody
 434 
 435   # If type is unspecified, default to LIBRARY
 436   ifeq ($$($1_TYPE), )
 437     $1_TYPE := LIBRARY
 438   endif
 439 
 440   # If we're doing a static build and producing a library
 441   # force it to be a static library and remove the -l libraries
 442   ifeq ($(STATIC_BUILD), true)
 443     ifeq ($$($1_TYPE), LIBRARY)
 444       $1_TYPE := STATIC_LIBRARY


 679   # Track variable changes for all variables that affect the compilation command
 680   # lines for all object files in this setup. This includes at least all the
 681   # variables used in the call to add_native_source below.
 682   $1_COMPILE_VARDEPS := $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
 683       $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_OPT_CFLAGS) $$($1_OPT_CXXFLAGS) \
 684       $$($1_CC) $$($1_CXX) $$($1_AS) $$($1_ASFLAGS)
 685   $1_COMPILE_VARDEPS_FILE := $$(call DependOnVariable, $1_COMPILE_VARDEPS, \
 686       $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).comp.vardeps)
 687 
 688   ifneq ($$($1_PRECOMPILED_HEADER), )
 689     ifeq ($(USE_PRECOMPILED_HEADER), true)
 690       ifeq ($(TOOLCHAIN_TYPE), microsoft)
 691         $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
 692         $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
 693         $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
 694 
 695         $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
 696             FILE := $$($1_GENERATED_PCH_SRC), \
 697             BASE := $1, \
 698             EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
 699             DISABLE_THIS_FILE_DEFINE := true, \
 700         ))
 701 
 702         $1_USE_PCH_FLAGS := \
 703             -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
 704 
 705         $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
 706 
 707         # Explicitly add the pch obj file first to ease comparing to old
 708         # hotspot build.
 709         $1_ALL_OBJS := $$($1_GENERATED_PCH_OBJ) $$($1_ALL_OBJS)
 710 
 711         $$($1_GENERATED_PCH_SRC):
 712                 $(ECHO) "#include \"$$(notdir $$($1_PRECOMPILED_HEADER))\"" > $$@
 713 
 714       else ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
 715         ifeq ($(TOOLCHAIN_TYPE), gcc)
 716           $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch
 717           $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled
 718         else ifeq ($(TOOLCHAIN_TYPE), clang)
 719           $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 ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
 235     $$($1_BASE)_OBJS_SO_FAR += $$($1_OBJ)
 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)


 407 #   REORDER reorder file
 408 #   USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
 409 #       mapfile for the output symbols file
 410 #   CC the compiler to use, default is $(CC)
 411 #   LD the linker to use, default is $(LD)
 412 #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
 413 #   DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
 414 #   DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
 415 #       when compiling C code
 416 #   DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
 417 #       toolchain when compiling C++ code
 418 #   STRIP_SYMBOLS Set to false to override global strip policy and always leave
 419 #       symbols in the binary, if the toolchain allows for it
 420 #   DEBUG_SYMBOLS Set to false to disable generation of debug symbols
 421 #   COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
 422 #   ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
 423 #       zipping
 424 #   STRIPFLAGS Optionally change the flags given to the strip command
 425 #   PRECOMPILED_HEADER Header file to use as precompiled header
 426 #   PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
 427 #   DEFINE_THIS_FILE Set to false to not set the THIS_FILE preprocessor macro
 428 #
 429 # After being called, some variables are exported from this macro, all prefixed
 430 # with parameter 1 followed by a '_':
 431 #   TARGET The library or executable created by the macro
 432 #   TARGET_DEPS All prerequisites for the target calculated by the macro
 433 #   ALL_OBJS All object files
 434 #   IMPORT_LIBRARY The import library created for a shared library on Windows
 435 SetupNativeCompilation = $(NamedParamsMacroTemplate)
 436 define SetupNativeCompilationBody
 437 
 438   # If type is unspecified, default to LIBRARY
 439   ifeq ($$($1_TYPE), )
 440     $1_TYPE := LIBRARY
 441   endif
 442 
 443   # If we're doing a static build and producing a library
 444   # force it to be a static library and remove the -l libraries
 445   ifeq ($(STATIC_BUILD), true)
 446     ifeq ($$($1_TYPE), LIBRARY)
 447       $1_TYPE := STATIC_LIBRARY


 682   # Track variable changes for all variables that affect the compilation command
 683   # lines for all object files in this setup. This includes at least all the
 684   # variables used in the call to add_native_source below.
 685   $1_COMPILE_VARDEPS := $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \
 686       $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_OPT_CFLAGS) $$($1_OPT_CXXFLAGS) \
 687       $$($1_CC) $$($1_CXX) $$($1_AS) $$($1_ASFLAGS)
 688   $1_COMPILE_VARDEPS_FILE := $$(call DependOnVariable, $1_COMPILE_VARDEPS, \
 689       $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).comp.vardeps)
 690 
 691   ifneq ($$($1_PRECOMPILED_HEADER), )
 692     ifeq ($(USE_PRECOMPILED_HEADER), true)
 693       ifeq ($(TOOLCHAIN_TYPE), microsoft)
 694         $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
 695         $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
 696         $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
 697 
 698         $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
 699             FILE := $$($1_GENERATED_PCH_SRC), \
 700             BASE := $1, \
 701             EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
 702             DEFINE_THIS_FILE := false, \
 703         ))
 704 
 705         $1_USE_PCH_FLAGS := \
 706             -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
 707 
 708         $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
 709 
 710         # Explicitly add the pch obj file first to ease comparing to old
 711         # hotspot build.
 712         $1_ALL_OBJS := $$($1_GENERATED_PCH_OBJ) $$($1_ALL_OBJS)
 713 
 714         $$($1_GENERATED_PCH_SRC):
 715                 $(ECHO) "#include \"$$(notdir $$($1_PRECOMPILED_HEADER))\"" > $$@
 716 
 717       else ifneq ($(findstring $(TOOLCHAIN_TYPE), gcc clang), )
 718         ifeq ($(TOOLCHAIN_TYPE), gcc)
 719           $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).gch
 720           $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled
 721         else ifeq ($(TOOLCHAIN_TYPE), clang)
 722           $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch


< prev index next >