1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

common.mk: separate clean-ext

* common.mk (clean-ext): separate clean-up of makefiles and
  timestamps, and clean-up of subdirectories under ext and gems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-01 07:53:15 +00:00
parent 9da188550c
commit 3cef10489a
3 changed files with 66 additions and 40 deletions

View file

@ -416,36 +416,43 @@ distclean-local::
-$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h -$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h
-$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true -$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true
clean-ext distclean-ext realclean-ext:: ext/clean.sub gems/clean.sub:: ext/clean.mk
@[ -f $(EXTS_MK) ] && $(MAKE) -f $(EXTS_MK) $(@:-ext=) ext/distclean.sub gems/distclean.sub:: ext/distclean.mk
@set dummy `echo "${EXTS}" | tr , ' '`; shift; \ ext/realclean.sub gems/realclean.sub:: ext/realclean.mk
ext/clean.mk ext/distclean.mk ext/realclean.mk::
$(Q) [ -f $(EXTS_MK) ] && exec $(MAKE) -f $(EXTS_MK) $(@F:.mk=)
ext/clean:: ext/clean.sub
ext/distclean:: ext/distclean.sub
ext/realclean:: ext/realclean.sub
gems/clean:: gems/clean.sub
gems/distclean:: gems/distclean.sub
gems/realclean:: gems/realclean.sub
ext/clean.sub ext/distclean.sub ext/realclean.sub \
gems/clean.sub gems/distclean.sub gems/realclean.sub::
$(Q) set dummy `echo "${EXTS}" | tr , ' '`; shift; \
test "$$#" = 0 && set .; \ test "$$#" = 0 && set .; \
set dummy `\ set dummy `\
cd ext 2>/dev/null && \ cd $(@D) 2>/dev/null && \
find "$$@" \( -name Makefile -o -name exts.mk \) -print | \ find "$$@" \( -name Makefile -o -name exts.mk \) -print | \
sed -n 's:^\./::;s:^:ext/:;s:/[^/][^/]*$$::p' | sort -u; \ sed -n 's:^\./::;s:^:$(@D)/:;s:/[^/][^/]*$$::p' | sort -u; \
` ` \
cd gems 2>/dev/null && \
find "$$@" -name exts.mk -print | \
sed -n 's:^\./::;s:^:gems/:;s:/[^/][^/]*$$::p' | sort -u; \
`; shift; \ `; shift; \
for dir do \ for dir do \
echo $(@:-ext=)ing "$$dir"; \
$(RM) "$$dir/exts.mk"; \ $(RM) "$$dir/exts.mk"; \
{ [ ! -f "$$dir/Makefile" ] || \ if [ -f "$$dir/Makefile" ]; then \
(cd "$$dir" && exec $(MAKE) $(mflags) $(@:-ext=)); } && \ echo $(@F:.sub=)ing "$$dir"; \
case "$@" in \ (cd "$$dir" && exec $(MAKE) $(mflags) $(@F:.sub=)); \
*distclean-ext*|*realclean-ext*) \ fi; \
$(RMDIRS) "$$dir" 2> /dev/null || true;; \ done || true
esac; \
done
-$(Q)$(RM) ext/extinit.$(OBJEXT)
distclean-ext realclean-ext:: ext/distclean ext/realclean gems/distclean gems/realclean::
-$(Q)$(RM) ext/extinit.c ext/configure-ext.mk $(Q) set dummy `echo "${EXTS}" | tr , ' '`; shift; \
-$(Q)$(RMDIR) ext 2> /dev/null || true test "$$#" = 0 && set .; \
cd $(@D) 2>/dev/null && \
clean-extout: find "$$@" -type d -empty -exec $(RMDIRS) {} + 2> /dev/null || true
$(Q) $(RMDIRS) $(@D)
clean-enc distclean-enc realclean-enc: clean-enc distclean-enc realclean-enc:
@test -f "$(ENC_MK)" || exit 0; \ @test -f "$(ENC_MK)" || exit 0; \

View file

@ -568,11 +568,30 @@ realclean-extout: distclean-extout
realclean-platform: distclean-platform realclean-platform: distclean-platform
realclean-rubyspec: distclean-rubyspec realclean-rubyspec: distclean-rubyspec
clean-ext distclean-ext realclean-ext:: clean-ext:: ext/clean gems/clean timestamp/clean
$(Q)$(RM) $(EXTS_MK) distclean-ext:: ext/distclean gems/distclean timestamp/distclean
realclean-ext:: ext/realclean gems/realclean timestamp/realclean
ext/clean.mk ext/distclean.mk ext/realclean.mk::
ext/clean gems/clean:: ext/clean.mk
ext/distclean gems/distclean:: ext/distclean.mk
ext/realclean gems/realclean:: ext/realclean.mk
timestamp/clean:: ext/clean gems/clean
timestamp/distclean:: ext/distclean gems/distclean
timestamp/realclean:: ext/realclean gems/realclean
timestamp/clean timestamp/distclean timestamp/realclean::
$(Q)$(RM) $(TIMESTAMPDIR)/.*.time $(TIMESTAMPDIR)/.$(arch).time $(TIMESTAMPDIR)/$(arch)/.time $(Q)$(RM) $(TIMESTAMPDIR)/.*.time $(TIMESTAMPDIR)/.$(arch).time $(TIMESTAMPDIR)/$(arch)/.time
$(Q)$(RMDIRS) $(TIMESTAMPDIR)/$(arch) 2> $(NULL) || exit 0 $(Q)$(RMDIRS) $(TIMESTAMPDIR)/$(arch) 2> $(NULL) || exit 0
clean-ext::
-$(Q)$(RM) ext/extinit.$(OBJEXT)
distclean-ext realclean-ext::
-$(Q)$(RM) $(EXTS_MK) ext/extinit.* ext/configure-ext.mk
-$(Q)$(RMDIR) ext 2> $(NULL) || exit 0
clean-enc distclean-enc realclean-enc: PHONY clean-enc distclean-enc realclean-enc: PHONY
clean-enc: clean-enc.d clean-enc: clean-enc.d

View file

@ -1063,31 +1063,31 @@ distclean-local::
-$(Q)$(RM) $(INSTALLED_LIST:/=\) $(arch_hdrdir:/=\)\ruby\config.h verconf.h -$(Q)$(RM) $(INSTALLED_LIST:/=\) $(arch_hdrdir:/=\)\ruby\config.h verconf.h
-$(Q)$(RMDIRS) $(arch_hdrdir:/=\)\ruby -$(Q)$(RMDIRS) $(arch_hdrdir:/=\)\ruby
clean-ext distclean-ext realclean-ext:: ext/clean.mk ext/distclean.mk ext/realclean.mk::
@cd ext && for /R $(EXTS) %I in (.) \ $(Q)if exist $(EXTS_MK) $(MAKE) -k -f $(EXTS_MK) top_srcdir=$(srcdir) $(*F)
do @if exist %I\Makefile ( \
ext/clean gems/clean ext/distclean gems/distclean ext/realclean gems/realclean::
$(Q)cd $(@D) && for /R $(EXTS) %I in (.) \
do $(Q)if exist %I\Makefile ( \
cd %I && ( \ cd %I && ( \
call set n=%I && \ call set n=%I && \
call set n=%n:%CD%\ext\=% && \ call set n=%n:%CD%\$(@D)\=% && \
call set n=%n:\.=% && \ call set n=%n:\.=% && \
call echo $(@:-ext=)ing %n:\=/% & \ call echo $(@F)ing %n:\=/% & \
$(MAKE) $(MFLAGS) $(@:-ext=) & \ $(MAKE) $(MFLAGS) $(@F) & \
cd %CD% & \ cd %CD% & \
$(RMDIRS) %I \ $(RMDIRS) %I \
) ) ) )
distclean-ext realclean-ext:: ext/distclean gems/distclean ext/realclean gems/realclean::
-$(Q)$(RM) ext/extinit.c ext/configure-ext.mk $(Q)cd $(@D) && for /R $(EXTS) %I in (exts.mk*) \
@cd ext && for /D $(EXTS) %I in (.) \ do $(Q)(del %I & rmdir %~dpI)
do @if exist %I\exts.mk del %I\exts.mk -$(Q)rmdir $(@D) 2> nul || @
-$(Q)rmdir ext 2> nul || @
clean-extout:
clean-enc distclean-enc realclean-enc: clean-enc distclean-enc realclean-enc:
!if exist($(ENC_MK)) !if exist($(ENC_MK))
@echo $(@:-enc=ing) encodings $(ECHO) $(@:-enc=ing) encodings
@-$(MAKE) $(MAKE_ENC) $(@:-enc=) -$(Q)$(MAKE) $(MAKE_ENC) $(@:-enc=)
!endif !endif
$(RBCONFIG): $(PREP) $(RBCONFIG): $(PREP)