diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-16 11:43:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-16 18:42:46 +0900 |
commit | dc1c4e46758ace2c9e5e822df0d64b16bb564bb4 (patch) | |
tree | f87f9cf03c9489bf76643d6d7a7fd7bbb39dffc3 /ext | |
parent | be65cf53253fa955cd4016459b3add3ba6046837 (diff) | |
download | ruby-dc1c4e46758ace2c9e5e822df0d64b16bb564bb4.tar.gz |
Clean extension build directories and exts.mk file
Diffstat (limited to 'ext')
-rwxr-xr-x | ext/extmk.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb index 9c12bda919..cc560be1f2 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -722,6 +722,7 @@ begin mf.puts "ECHO = $(ECHO1:0=@echo)" mf.puts "MFLAGS = -$(MAKEFLAGS)" if $nmake mf.puts "override MFLAGS := $(filter-out -j%,$(MFLAGS))" if $gnumake + mf.puts "ext_build_dir = #{File.dirname($command_output)}" mf.puts def mf.macro(name, values, max = 70) @@ -764,6 +765,7 @@ begin mf.macro "SUBMAKEOPTS", submakeopts mf.macro "NOTE_MESG", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb skip] mf.macro "NOTE_NAME", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb fail] + %w[RM RMDIRS RMDIR RMALL].each {|w| mf.macro w, [RbConfig::CONFIG[w]]} mf.puts targets = %w[all install static install-so install-rb clean distclean realclean] targets.each do |tgt| @@ -798,16 +800,20 @@ begin exts.each do |d| d = d[0..-2] t = "#{d}#{tgt}" - if /^(dist|real)?clean$/ =~ tgt + if clean = /^(dist|real)?clean$/.match(tgt) deps = exts.select {|e|e.start_with?(d)}.map {|e|"#{e[0..-2]}#{tgt}"} - [t] - pd = ' ' + deps.join(' ') unless deps.empty? + pd = [' clean-local', *deps].join(' ') else pext = File.dirname(d) pd = " #{pext}/#{tgt}" if exts.include?("#{pext}/.") end mf.puts "#{t}:#{pd}\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)" + if clean and clean.begin(1) + mf.puts "\t$(Q)$(RM) $(ext_build_dir)/exts.mk\n\t$(Q)$(RMDIRS) -p $(@D)" + end end end + mf.puts "\n""clean-local:\n\t$(Q)$(RM) $(ext_build_dir)/*~ $(ext_build_dir)/*.bak $(ext_build_dir)/core" mf.puts "\n""extso:\n" mf.puts "\t@echo EXTSO=$(EXTSO)" |