make/common/NativeCompilation.gmk
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54491 a805bf992bf1
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
   758 		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE))
   758 		    $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE))
   759       endif
   759       endif
   760     endif
   760     endif
   761   endif
   761   endif
   762 
   762 
   763   # Create a rule to collect all the individual make dependency files into a
       
   764   # single makefile.
       
   765   $1_DEPS_FILE := $$($1_OBJECT_DIR)/$1.d
       
   766 
       
   767   $$($1_DEPS_FILE): $$($1_ALL_OBJS)
       
   768 	$(RM) $$@
       
   769         # CD into dir to reduce risk of hitting command length limits, which
       
   770         # could otherwise happen if TOPDIR is a very long path.
       
   771 	$(CD) $$($1_OBJECT_DIR) && $(CAT) *.d > $$@.tmp
       
   772 	$(CD) $$($1_OBJECT_DIR) && $(CAT) *.d.targets | $(SORT) -u >> $$@.tmp
       
   773         # After generating the file, which happens after all objects have been
       
   774         # compiled, copy it to .old extension. On the next make invocation, this
       
   775         # .old file will be included by make.
       
   776 	$(CP) $$@.tmp $$@.old
       
   777 	$(MV) $$@.tmp $$@
       
   778 
       
   779   $1 += $$($1_DEPS_FILE)
       
   780 
       
   781   # The include must be on the .old file, which represents the state from the
       
   782   # previous invocation of make. The file being included must not have a rule
       
   783   # defined for it as otherwise make will think it has to run the rule before
       
   784   # being able to include the file, which would be wrong since we specifically
       
   785   # need the file as it was generated by a previous make invocation.
       
   786   ifneq ($$(wildcard $$($1_DEPS_FILE).old), )
       
   787     $1_DEPS_FILE_LOADED := true
       
   788     -include $$($1_DEPS_FILE).old
       
   789   endif
       
   790 
       
   791   # Now call SetupCompileNativeFile for each source file we are going to compile.
   763   # Now call SetupCompileNativeFile for each source file we are going to compile.
   792   $$(foreach file, $$($1_SRCS), \
   764   $$(foreach file, $$($1_SRCS), \
   793       $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$(file)),\
   765       $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$(file)),\
   794           FILE := $$(file), \
   766           FILE := $$(file), \
   795           BASE := $1, \
   767           BASE := $1, \
   798 
   770 
   799   # Setup rule for printing progress info when compiling source files.
   771   # Setup rule for printing progress info when compiling source files.
   800   # This is a rough heuristic and may not always print accurate information.
   772   # This is a rough heuristic and may not always print accurate information.
   801   $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
   773   $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE)
   802         ifeq ($$(wildcard $$($1_TARGET)), )
   774         ifeq ($$(wildcard $$($1_TARGET)), )
   803 	  $(ECHO) 'Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \
   775 	  $$(call LogWarn, Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \
   804 	      $$(filter-out %.vardeps, $$?)) file(s)'
   776 	      $$(filter-out %.vardeps, $$?)) file(s))
   805         else
   777         else
   806 	  $(ECHO) $$(strip 'Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET))' \
   778 	  $$(call LogWarn, $$(strip Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) \
   807 	      $$(if $$(filter-out %.vardeps, $$?), \
   779 	      $$(if $$(filter-out %.vardeps, $$?), \
   808 	        'due to $$(words $$(filter-out %.vardeps, $$?)) file(s)', \
   780 	        due to $$(words $$(filter-out %.vardeps, $$?)) file(s), \
   809 	      $$(if $$(filter %.vardeps, $$?), 'due to makefile changes')))
   781 	      $$(if $$(filter %.vardeps, $$?), due to makefile changes))))
   810         endif
   782         endif
   811 	$(TOUCH) $$@
   783 	$(TOUCH) $$@
   812 
   784 
   813   # On windows we need to create a resource file
   785   # On windows we need to create a resource file
   814   ifeq ($(call isTargetOs, windows), true)
   786   ifeq ($(call isTargetOs, windows), true)
   846 		    >> $$($1_RES_DEPS_FILE) ; \
   818 		    >> $$($1_RES_DEPS_FILE) ; \
   847 		$(ECHO) >> $$($1_RES_DEPS_FILE) ;\
   819 		$(ECHO) >> $$($1_RES_DEPS_FILE) ;\
   848 		$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEPS_FILE) \
   820 		$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEPS_FILE) \
   849 		    > $$($1_RES_DEPS_TARGETS_FILE)
   821 		    > $$($1_RES_DEPS_TARGETS_FILE)
   850     endif
   822     endif
       
   823   endif
       
   824 
       
   825   # Create a rule to collect all the individual make dependency files into a
       
   826   # single makefile.
       
   827   $1_DEPS_FILE := $$($1_OBJECT_DIR)/$1.d
       
   828 
       
   829   $$($1_DEPS_FILE): $$($1_ALL_OBJS) $$($1_RES)
       
   830 	$(RM) $$@
       
   831         # CD into dir to reduce risk of hitting command length limits, which
       
   832         # could otherwise happen if TOPDIR is a very long path.
       
   833 	$(CD) $$($1_OBJECT_DIR) && $(CAT) *.d > $$@.tmp
       
   834 	$(CD) $$($1_OBJECT_DIR) && $(CAT) *.d.targets | $(SORT) -u >> $$@.tmp
       
   835         # After generating the file, which happens after all objects have been
       
   836         # compiled, copy it to .old extension. On the next make invocation, this
       
   837         # .old file will be included by make.
       
   838 	$(CP) $$@.tmp $$@.old
       
   839 	$(MV) $$@.tmp $$@
       
   840 
       
   841   $1 += $$($1_DEPS_FILE)
       
   842 
       
   843   # The include must be on the .old file, which represents the state from the
       
   844   # previous invocation of make. The file being included must not have a rule
       
   845   # defined for it as otherwise make will think it has to run the rule before
       
   846   # being able to include the file, which would be wrong since we specifically
       
   847   # need the file as it was generated by a previous make invocation.
       
   848   ifneq ($$(wildcard $$($1_DEPS_FILE).old), )
       
   849     $1_DEPS_FILE_LOADED := true
       
   850     -include $$($1_DEPS_FILE).old
   851   endif
   851   endif
   852 
   852 
   853   ifneq ($(DISABLE_MAPFILES), true)
   853   ifneq ($(DISABLE_MAPFILES), true)
   854     $1_REAL_MAPFILE := $$($1_MAPFILE)
   854     $1_REAL_MAPFILE := $$($1_MAPFILE)
   855     ifeq ($(call isTargetOs, windows), false)
   855     ifeq ($(call isTargetOs, windows), false)