make/common/NativeCompilation.gmk
changeset 49146 02b821c5df93
parent 49136 e9a335686df9
child 49155 7cd937277d5e
equal deleted inserted replaced
49145:2854589fd853 49146:02b821c5df93
   148 # Param 1: the string containing source file names with extensions
   148 # Param 1: the string containing source file names with extensions
   149 # The surrounding strip is needed to keep additional whitespace out
   149 # The surrounding strip is needed to keep additional whitespace out
   150 define replace_with_obj_extension
   150 define replace_with_obj_extension
   151 $(strip \
   151 $(strip \
   152   $(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \
   152   $(foreach extension, $(NATIVE_SOURCE_EXTENSIONS), \
   153       $(patsubst $(extension),%$(OBJ_SUFFIX),$(filter $(extension),$1))) \
   153       $(patsubst $(extension),%$(OBJ_SUFFIX), $(filter $(extension), $1))) \
   154 )
   154 )
   155 endef
   155 endef
   156 
   156 
   157 ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
   157 ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
   158   UNIX_PATH_PREFIX := /cygdrive
   158   UNIX_PATH_PREFIX := /cygdrive
   181     -e 's/^[	 ]*//' \
   181     -e 's/^[	 ]*//' \
   182     -e '/^$$$$/ d' \
   182     -e '/^$$$$/ d' \
   183     -e 's/$$$$/ :/' \
   183     -e 's/$$$$/ :/' \
   184     #
   184     #
   185 
   185 
   186 define add_native_source
   186 ################################################################################
   187   # param 1 = BUILD_MYPACKAGE
   187 # Create the recipe needed to compile a single native source file.
   188   # parma 2 = the source file name (..../alfa.c or .../beta.cpp)
   188 #
   189   # param 3 = the bin dir that stores all .o (.obj) and .d files.
   189 # Parameter 1 is the name of the rule, based on the name of the library/
   190   # param 4 = the c flags to the compiler
   190 # program being build and the name of the source code file, e.g.
   191   # param 5 = the c compiler
   191 # BUILD_LIBFOO_fooMain.cpp.
   192   # param 6 = the c++ flags to the compiler
   192 #
   193   # param 7 = the c++ compiler
   193 # Remaining parameters are named arguments:
   194   # param 8 = the flags to the assembler
   194 #   FILE - The full path of the source file to compiler
   195   # param 9 = set to disable THIS_FILE
   195 #   BASE - The name of the rule for the entire binary to build ($1)
   196 
   196 #   DISABLE_THIS_FILE_DEFINE - Set to true to disable the THIS_FILE define.
   197   ifeq ($9, )
   197 #
   198     $1_$2_THIS_FILE = -DTHIS_FILE='"$$(<F)"'
   198 SetupCompileNativeFile = $(NamedParamsMacroTemplate)
   199   endif
   199 define SetupCompileNativeFileBody
   200 
   200   $1_FILENAME := $$(notdir $$($1_FILE))
   201   ifeq ($$($1_$(notdir $2)_OPTIMIZATION), )
   201 
   202     $1_$(notdir $2)_OPT_CFLAGS := $$($1_OPT_CFLAGS)
   202   # The target file to be generated.
   203     $1_$(notdir $2)_OPT_CXXFLAGS := $$($1_OPT_CXXFLAGS)
   203   $1_OBJ := $$($$($1_BASE)_OBJECT_DIR)/$$(call replace_with_obj_extension, \
   204   else
   204       $$($1_FILENAME))
   205     ifeq (NONE, $$($1_$(notdir $2)_OPTIMIZATION))
   205 
   206       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_NONE)
   206   # Only continue if this object file hasn't been processed already. This lets
   207       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
   207   # the first found source file override any other with the same name.
   208     else ifeq (LOW, $$($1_$(notdir $2)_OPTIMIZATION))
   208   ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), )
   209       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_NORM)
   209     $$($1_BASE)_OBJS_SO_FAR += $$($1_OBJ)
   210       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
   210     # This is the definite source file to use for $1_FILENAME.
   211     else ifeq (HIGH, $$($1_$(notdir $2)_OPTIMIZATION))
   211     $1_SRC_FILE := $$($1_FILE)
   212       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HI)
   212 
   213       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HI)
   213     ifneq ($$($1_DISABLE_THIS_FILE_DEFINE), true)
   214     else ifeq (HIGHEST, $$($1_$(notdir $2)_OPTIMIZATION))
   214       $1_THIS_FILE = -DTHIS_FILE='"$$(<F)"'
   215       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
   215     endif
   216       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
   216 
   217     else ifeq (HIGHEST_JVM, $$($1_$(notdir $2)_OPTIMIZATION))
   217     ifeq ($$($1_OPTIMIZATION), )
   218       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
   218       $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS)
   219       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
   219       $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS)
   220     else ifeq (SIZE, $$($1_$(notdir $2)_OPTIMIZATION))
       
   221       $1_$(notdir $2)_OPT_CFLAGS := $(C_O_FLAG_SIZE)
       
   222       $1_$(notdir $2)_OPT_CXXFLAGS := $(CXX_O_FLAG_SIZE)
       
   223     else
   220     else
   224       $$(error Unknown value for OPTIMIZATION: $$($1_$(notdir $2)_OPTIMIZATION))
   221       ifeq ($$($1_OPTIMIZATION), NONE)
   225     endif
   222         $1_OPT_CFLAGS := $(C_O_FLAG_NONE)
   226   endif
   223         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NONE)
   227 
   224       else ifeq ($$($1_OPTIMIZATION), LOW)
   228   ifneq ($$($1_PRECOMPILED_HEADER), )
   225         $1_OPT_CFLAGS := $(C_O_FLAG_NORM)
   229     ifeq ($$(filter $$(notdir $2), $$($1_PRECOMPILED_HEADER_EXCLUDE)), )
   226         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
   230       $1_$2_USE_PCH_FLAGS := $$($1_USE_PCH_FLAGS)
   227       else ifeq ($$($1_OPTIMIZATION), HIGH)
   231     endif
   228         $1_OPT_CFLAGS := $(C_O_FLAG_HI)
   232   endif
   229         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HI)
   233 
   230       else ifeq ($$($1_OPTIMIZATION), HIGHEST)
   234   ifneq ($$(filter %.c, $2), )
   231         $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST)
   235     # Compile as a C file
   232         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST)
   236     $1_$2_FLAGS := $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $4 \
   233       else ifeq ($$($1_OPTIMIZATION), HIGHEST_JVM)
   237         $$($1_$(notdir $2)_OPT_CFLAGS) \
   234         $1_OPT_CFLAGS := $(C_O_FLAG_HIGHEST_JVM)
   238         $$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c
   235         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_HIGHEST_JVM)
   239     $1_$2_COMP := $5
   236       else ifeq ($$($1_OPTIMIZATION), SIZE)
   240     $1_$2_DEP_FLAG := $(C_FLAG_DEPS)
   237         $1_OPT_CFLAGS := $(C_O_FLAG_SIZE)
   241   else ifneq ($$(filter %.m, $2), )
   238         $1_OPT_CXXFLAGS := $(CXX_O_FLAG_SIZE)
   242     # Compile as an Objective-C file
   239       else
   243     $1_$2_FLAGS := -x objective-c $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $4 \
   240         $$(error Unknown value for file OPTIMIZATION: $$($1_OPTIMIZATION))
   244         $$($1_$(notdir $2)_OPT_CFLAGS) \
   241       endif
   245         $$($1_$(notdir $2)_CFLAGS) $$($1_$2_THIS_FILE) -c
   242     endif
   246     $1_$2_COMP := $5
   243 
   247     $1_$2_DEP_FLAG := $(C_FLAG_DEPS)
   244     ifneq ($$($$($1_BASE)_PRECOMPILED_HEADER), )
   248   else ifneq ($$(filter %.s %.S, $2), )
   245       ifeq ($$(filter $$($1_FILENAME), $$($$($1_BASE)_PRECOMPILED_HEADER_EXCLUDE)), )
   249     # Compile as assembler file
   246         $1_USE_PCH_FLAGS := $$($$($1_BASE)_USE_PCH_FLAGS)
   250     $1_$2_FLAGS := $8
   247       endif
   251     $1_$2_COMP := $(AS)
   248     endif
   252     $1_$2_DEP_FLAG :=
   249 
   253   else ifneq ($$(filter %.cpp, $2)$$(filter %.cc, $2)$$(filter %.mm, $2), )
   250     $1_BASE_CFLAGS :=  $$($$($1_BASE)_CFLAGS) $$($$($1_BASE)_EXTRA_CFLAGS) \
   254     # Compile as a C++ or Objective-C++ file
   251         $$($$($1_BASE)_SYSROOT_CFLAGS)
   255     $1_$2_FLAGS := $(CFLAGS_CCACHE) $$($1_$2_USE_PCH_FLAGS) $6 \
   252     $1_BASE_CXXFLAGS := $$($$($1_BASE)_CXXFLAGS) $$($$($1_BASE)_EXTRA_CXXFLAGS) \
   256         $$($1_$(notdir $2)_OPT_CXXFLAGS) \
   253         $$($$($1_BASE)_SYSROOT_CFLAGS) $$($1_EXTRA_CXXFLAGS)
   257         $$($1_$(notdir $2)_CXXFLAGS) $$($1_$2_THIS_FILE) -c
   254 
   258     $1_$2_COMP := $7
   255     ifneq ($$(filter %.c, $$($1_FILENAME)), )
   259     $1_$2_DEP_FLAG := $(CXX_FLAG_DEPS)
   256       # Compile as a C file
   260   else
   257       $1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CFLAGS) \
   261     $$(error Internal error in NativeCompilation.gmk: no compiler for file $2)
   258           $$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
   262   endif
   259       $1_COMPILER := $$($$($1_BASE)_CC)
   263   # Generate the .o (.obj) file name and place it in the bin dir.
   260       $1_DEP_FLAG := $(C_FLAG_DEPS)
   264   $1_$2_OBJ := $3/$$(call replace_with_obj_extension, $$(notdir $2))
   261     else ifneq ($$(filter %.m, $$($1_FILENAME)), )
   265   # Only continue if this object file hasn't been processed already. This lets the first found
   262       # Compile as an Objective-C file
   266   # source file override any other with the same name.
   263       $1_FLAGS := -x objective-c $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) \
   267   ifeq ($$(findstring $$($1_$2_OBJ), $$($1_OBJS_SO_FAR)), )
   264           $$($1_BASE_CFLAGS) $$($1_OPT_CFLAGS) $$($1_CFLAGS) $$($1_THIS_FILE) -c
   268     $1_OBJS_SO_FAR += $$($1_$2_OBJ)
   265       $1_COMPILER := $$($$($1_BASE)_CC)
   269     ifeq ($$(filter %.s %.S, $2), )
   266       $1_DEP_FLAG := $(C_FLAG_DEPS)
       
   267     else ifneq ($$(filter %.s %.S, $$($1_FILENAME)), )
       
   268       # Compile as assembler file
       
   269       $1_FLAGS := $$($$($1_BASE)_ASFLAGS)
       
   270       $1_COMPILER := $(AS)
       
   271       $1_DEP_FLAG :=
       
   272     else ifneq ($$(filter %.cpp %.cc %.mm, $$($1_FILENAME)), )
       
   273       # Compile as a C++ or Objective-C++ file
       
   274       $1_FLAGS := $(CFLAGS_CCACHE) $$($1_USE_PCH_FLAGS) $$($1_BASE_CXXFLAGS) \
       
   275           $$($1_OPT_CXXFLAGS) $$($1_CXXFLAGS) $$($1_THIS_FILE) -c
       
   276       $1_COMPILER := $$($$($1_BASE)_CXX)
       
   277       $1_DEP_FLAG := $(CXX_FLAG_DEPS)
       
   278     else
       
   279       $$(error Internal error in NativeCompilation.gmk: no compiler for file $$($1_FILENAME))
       
   280     endif
       
   281 
       
   282     ifeq ($$(filter %.s %.S, $$($1_FILENAME)), )
   270       # And this is the dependency file for this obj file.
   283       # And this is the dependency file for this obj file.
   271       $1_$2_DEP := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_$2_OBJ))
   284       $1_DEP := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_OBJ))
   272       # The dependency target file lists all dependencies as empty targets
   285       # The dependency target file lists all dependencies as empty targets to
   273       # to avoid make error "No rule to make target" for removed files
   286       # avoid make error "No rule to make target" for removed files
   274       $1_$2_DEP_TARGETS := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_$2_OBJ))
   287       $1_DEP_TARGETS := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_OBJ))
   275 
   288 
   276       # Include previously generated dependency information. (if it exists)
   289       # Include previously generated dependency information. (if it exists)
   277       -include $$($1_$2_DEP)
   290       -include $$($1_DEP)
   278       -include $$($1_$2_DEP_TARGETS)
   291       -include $$($1_DEP_TARGETS)
   279 
   292 
   280       ifeq ($(TOOLCHAIN_TYPE), microsoft)
   293       ifeq ($(TOOLCHAIN_TYPE), microsoft)
   281         # To avoid name clashes between pdbs for objects and libs/execs, put
   294         # To avoid name clashes between pdbs for objects and libs/execs, put
   282         # object pdbs in a separate subdir.
   295         # object pdbs in a separate subdir.
   283         $1_$2_DEBUG_OUT_FLAGS := -Fd$$(strip $$(patsubst $$($1_OBJECT_DIR)/%, \
   296         $1_DEBUG_OUT_FLAGS := -Fd$$(strip $$(patsubst $$($$($1_BASE)_OBJECT_DIR)/%, \
   284             $$($1_OBJECT_DIR)/pdb/%, $$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ))))
   297             $$($$($1_BASE)_OBJECT_DIR)/pdb/%, $$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_OBJ))))
   285       endif
   298       endif
   286     endif
   299     endif
   287 
   300 
   288     ifneq ($$(strip $$($1_$(notdir $2)_CFLAGS) $$($1_$(notdir $2)_CXXFLAGS) \
   301     ifneq ($$(strip $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION)), )
   289         $$($1_$(notdir $2)_OPTIMIZATION)), )
   302       $1_VARDEPS := $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPT_CFLAGS) \
   290       $1_$2_VARDEPS := $$($1_$(notdir $2)_CFLAGS) $$($1_$(notdir $2)_CXXFLAGS) \
   303           $$($1_OPT_CXXFLAGS)
   291           $$($1_$(notdir $2)_OPT_CFLAGS) $$($1_$(notdir $2)_OPT_CXXFLAGS)
   304       $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps)
   292       $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, $$($1_$2_OBJ).vardeps)
   305     endif
   293     endif
   306 
   294 
   307     $$($1_OBJ): $$($1_SRC_FILE) $$($$($1_BASE)_COMPILE_VARDEPS_FILE) \
   295     $$($1_$2_OBJ) : $2 $$($1_COMPILE_VARDEPS_FILE) $$($1_$2_VARDEPS_FILE) | $$($1_BUILD_INFO)
   308         $$($1_VARDEPS_FILE) | $$($$($1_BASE)_BUILD_INFO)
   296 	$$(call LogInfo, Compiling $$(notdir $2) (for $$($1_BASENAME)))
   309 	$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
   297 	$$(call MakeDir, $$(@D) $$(@D)/pdb)
   310 	$$(call MakeDir, $$(@D) $$(@D)/pdb)
   298         ifneq ($(TOOLCHAIN_TYPE), microsoft)
   311         ifneq ($(TOOLCHAIN_TYPE), microsoft)
   299           ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $2), solstudio)
   312           ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $$($1_FILENAME)), solstudio)
   300             # The Solaris studio compiler doesn't output the full path to the object file in the
   313             # The Solaris studio compiler doesn't output the full path to the
   301             # generated deps files. Fixing it with sed. If compiling assembly, don't try this.
   314             # object file in the generated deps files. Fixing it with sed. If
       
   315             # compiling assembly, don't try this.
   302 	    $$(call ExecuteWithLog, $$@, \
   316 	    $$(call ExecuteWithLog, $$@, \
   303 	        $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP).tmp $(CC_OUT_OPTION)$$($1_$2_OBJ) $2)
   317 	        $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP).tmp \
   304 	    $(SED) 's|^$$(@F):|$$@:|' $$($1_$2_DEP).tmp > $$($1_$2_DEP)
   318 	            $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
       
   319 	    $(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP)
   305           else
   320           else
   306 	    $$(call ExecuteWithLog, $$@, \
   321 	    $$(call ExecuteWithLog, $$@, \
   307 	        $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2)
   322 	        $$($1_COMPILER) $$($1_FLAGS) $$($1_DEP_FLAG) $$($1_DEP) \
       
   323 	            $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE))
   308           endif
   324           endif
   309           # Create a dependency target file from the dependency file.
   325           # Create a dependency target file from the dependency file.
   310           # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
   326           # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
   311           ifneq ($$($1_$2_DEP), )
   327           ifneq ($$($1_DEP), )
   312 	    $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
   328 	    $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS)
   313           endif
   329           endif
   314         else
   330         else
   315           # The Visual Studio compiler lacks a feature for generating make dependencies, but by
   331           # The Visual Studio compiler lacks a feature for generating make
   316           # setting -showIncludes, all included files are printed. These are filtered out and
   332           # dependencies, but by setting -showIncludes, all included files are
   317           # parsed into make dependences.
   333           # printed. These are filtered out and parsed into make dependences.
   318           # Keep as much as possible on one execution line for best performance on Windows.
   334           #
   319           # No need to save exit code from compilation since pipefail is always active on
   335           # Keep as much as possible on one execution line for best performance
   320           # Windows.
   336           # on Windows. No need to save exit code from compilation since
       
   337           # pipefail is always active on Windows.
   321 	  $$(call ExecuteWithLog, $$@, \
   338 	  $$(call ExecuteWithLog, $$@, \
   322 	      $$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
   339 	      $$($1_COMPILER) $$($1_FLAGS) -showIncludes $$($1_DEBUG_OUT_FLAGS) \
   323 	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) \
   340 	          $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)) \
   324 	      | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
   341 	      | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \
   325 	          -e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \
   342 	          -e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \
   326 	  $(ECHO) $$@: \\ > $$($1_$2_DEP) ; \
   343 	  $(ECHO) $$@: \\ > $$($1_DEP) ; \
   327 	  $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_OBJ).log \
   344 	  $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_OBJ).log \
   328 	      | $(SORT) -u >> $$($1_$2_DEP) ; \
   345 	      | $(SORT) -u >> $$($1_DEP) ; \
   329 	  $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
   346 	  $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS)
   330         endif
   347         endif
   331   endif
   348   endif
   332 endef
   349 endef
   333 
   350 
   334 # Setup make rules for creating a native binary (a shared library or an
   351 # Setup make rules for creating a native binary (a shared library or an
   639       ifeq ($(TOOLCHAIN_TYPE), microsoft)
   656       ifeq ($(TOOLCHAIN_TYPE), microsoft)
   640         $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
   657         $1_PCH_FILE := $$($1_OBJECT_DIR)/$1.pch
   641         $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
   658         $1_GENERATED_PCH_SRC := $$($1_OBJECT_DIR)/$1_pch.cpp
   642         $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
   659         $1_GENERATED_PCH_OBJ := $$($1_OBJECT_DIR)/$1_pch.obj
   643 
   660 
   644         $$(eval $$(call add_native_source,$1,$$($1_GENERATED_PCH_SRC), \
   661         $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \
   645             $$($1_OBJECT_DIR),,, \
   662             FILE := $$($1_GENERATED_PCH_SRC), \
   646             $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_SYSROOT_CFLAGS) \
   663             BASE := $1, \
   647                 -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
   664             EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \
   648             $$($1_CXX),,no_this_file))
   665             DISABLE_THIS_FILE_DEFINE := true, \
       
   666         ))
   649 
   667 
   650         $1_USE_PCH_FLAGS := \
   668         $1_USE_PCH_FLAGS := \
   651             -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
   669             -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER))
   652 
   670 
   653         $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
   671         $$($1_ALL_OBJS): $$($1_GENERATED_PCH_OBJ)
   686 
   704 
   687       endif
   705       endif
   688     endif
   706     endif
   689   endif
   707   endif
   690 
   708 
   691   # Now call add_native_source for each source file we are going to compile.
   709   # Now call SetupCompileNativeFile for each source file we are going to compile.
   692   $$(foreach p, $$($1_SRCS), \
   710   $$(foreach file, $$($1_SRCS), \
   693       $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \
   711       $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$(file)),\
   694           $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS), \
   712           FILE := $$(file), \
   695           $$($1_CC), \
   713           BASE := $1, \
   696           $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $$($1_SYSROOT_CFLAGS), \
   714       )) \
   697           $$($1_CXX), $$($1_ASFLAGS))))
   715   )
   698 
   716 
   699   # Setup rule for printing progress info when compiling source files.
   717   # Setup rule for printing progress info when compiling source files.
   700   # This is a rough heuristic and may not always print accurate information.
   718   # This is a rough heuristic and may not always print accurate information.
   701   $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
   719   $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
   702         ifeq ($$(wildcard $$($1_TARGET)), )
   720         ifeq ($$(wildcard $$($1_TARGET)), )