From 506b45db9c929e37a22d6fb8c41103220438258f Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 31 Aug 2016 02:41:31 +0000 Subject: [PATCH] mkmf.rb: separate timestamp files * lib/mkmf.rb (timestamp_file): separate timestamp files for each architectures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- common.mk | 10 +++++++--- lib/mkmf.rb | 15 ++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/common.mk b/common.mk index bf1b8a2a36..869608ef3e 100644 --- a/common.mk +++ b/common.mk @@ -210,7 +210,7 @@ showconfig: exts: build-ext EXTS_MK = exts.mk -$(EXTS_MK): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY) +$(EXTS_MK): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY) $(TIMESTAMPDIR)/.$(arch).time $(ECHO) generating makefile $@ $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" --command-output=$(EXTS_MK) $(EXTMK_ARGS) configure @@ -544,8 +544,8 @@ realclean-extout: distclean-extout clean-ext distclean-ext realclean-ext:: $(Q)$(RM) $(EXTS_MK) - $(Q)$(RM) $(EXTOUT)/.timestamp/.*.time - $(Q)$(RMDIR) $(EXTOUT)/.timestamp 2> $(NULL) || exit 0 + $(Q)$(RM) $(TIMESTAMPDIR)/.*.time $(TIMESTAMPDIR)/.$(arch).time $(TIMESTAMPDIR)/$(arch)/.time + $(Q)$(RMDIR) $(TIMESTAMPDIR)/$(arch) $(TIMESTAMPDIR) 2> $(NULL) || exit 0 clean-enc distclean-enc realclean-enc: PHONY @@ -716,6 +716,10 @@ $(ENC_TRANS_D): $(Q) $(MAKEDIRS) enc/trans $(@D) @exit > $@ +$(TIMESTAMPDIR)/.$(arch).time: + $(Q)$(MAKEDIRS) $(@D) $(TIMESTAMPDIR)/$(arch) + @exit > $@ + ### CCAN_DIR = {$(VPATH)}ccan diff --git a/lib/mkmf.rb b/lib/mkmf.rb index db461ad07d..c20e431978 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -2028,15 +2028,16 @@ preload = #{defined?($preload) && $preload ? $preload.join(' ') : ''} end def timestamp_file(name, target_prefix = nil) - if target_prefix - pat = [] - install_dirs.each do |n, d| - pat << n if /\$\(target_prefix\)\z/ =~ d - end - name = name.gsub(/\$\((#{pat.join("|")})\)/) {$&+target_prefix} + pat = {} + install_dirs.each do |n, d| + pat[n] = $` if /\$\(target_prefix\)\z/ =~ d end + name = name.gsub(/\$\((#{pat.keys.join("|")})\)/) {pat[$1]+target_prefix} + name.sub!(/\A\$\(extout\)\//, '') + name.sub!(/(\$\((?:site)?arch\))\/*/, '') + arch = $1 || '' name = name.gsub(/(\$[({]|[})])|(\/+)|[^-.\w]+/) {$1 ? "" : $2 ? ".-." : "_"} - "$(TIMESTAMP_DIR)/.#{name}.time" + File.join("$(TIMESTAMP_DIR)", arch, "#{name.sub(/\A(?=.)/, '.')}.time") end # :startdoc: