make/common/NativeCompilation.gmk
changeset 52137 fea91995e077
parent 52022 804792ce736f
child 52813 767678b5e61b
equal deleted inserted replaced
52136:b52336cdb42d 52137:fea91995e077
    65 #
    65 #
    66 # Param 1: Name of file to create
    66 # Param 1: Name of file to create
    67 # Param 2: Working directory
    67 # Param 2: Working directory
    68 # Param 3: Source file
    68 # Param 3: Source file
    69 # Param 4: Compile command
    69 # Param 4: Compile command
    70 # Param 5: Object name
       
    71 ################################################################################
    70 ################################################################################
    72 define WriteCompileCommandsFragment
    71 define WriteCompileCommandsFragment
    73   $(call LogInfo, Creating compile commands fragment for $(notdir $3))
    72   $(call LogInfo, Creating compile commands fragment for $(notdir $3))
    74   $(call MakeDir, $(dir $1))
    73   $(call MakeDir, $(dir $1))
    75   $(call WriteFile,{ \
    74   $(call WriteFile,{ \
    76       "directory": "$(strip $2)"$(COMMA) \
    75       "directory": "$(strip $2)"$(COMMA) \
    77       "file": "$(strip $3)"$(COMMA) \
    76       "file": "$(strip $3)"$(COMMA) \
    78       "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
    77       "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
    79         $(subst $(FIXPATH),,$4))))"$(COMMA) \
    78         $(subst $(FIXPATH),,$4))))" \
    80       "output": "$(strip $5)" \
       
    81     }$(COMMA), \
    79     }$(COMMA), \
    82     $1)
    80     $1)
    83 endef
    81 endef
    84 
    82 
    85 ################################################################################
    83 ################################################################################
   329         $$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE)
   327         $$($$($1_BASE)_EXTRA_DEPS) $$($1_VARDEPS_FILE)
   330     $1_COMPILE_OPTIONS := $$($1_FLAGS) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)
   328     $1_COMPILE_OPTIONS := $$($1_FLAGS) $(CC_OUT_OPTION)$$($1_OBJ) $$($1_SRC_FILE)
   331 
   329 
   332     $$($1_OBJ_JSON): $$($1_OBJ_DEPS)
   330     $$($1_OBJ_JSON): $$($1_OBJ_DEPS)
   333 	$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
   331 	$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
   334 	    $$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ))
   332 	    $$($1_COMPILER) $$($1_COMPILE_OPTIONS))
   335 
   333 
   336     $$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
   334     $$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
   337 	$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
   335 	$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
   338 	$$(call MakeDir, $$(@D))
   336 	$$(call MakeDir, $$(@D))
   339         ifneq ($(TOOLCHAIN_TYPE), microsoft)
   337         ifneq ($(TOOLCHAIN_TYPE), microsoft)
   742             $$(OUTPUTDIR)/,,$$($1_PCH_FILE))).json
   740             $$(OUTPUTDIR)/,,$$($1_PCH_FILE))).json
   743         $1_ALL_OBJS_JSON += $$($1_PCH_FILE_JSON)
   741         $1_ALL_OBJS_JSON += $$($1_PCH_FILE_JSON)
   744 
   742 
   745         $$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
   743         $$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
   746 		$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
   744 		$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
   747 		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE))
   745 		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE))
   748       endif
   746       endif
   749     endif
   747     endif
   750   endif
   748   endif
   751 
   749 
   752   # Now call SetupCompileNativeFile for each source file we are going to compile.
   750   # Now call SetupCompileNativeFile for each source file we are going to compile.