[前][次][番号順一覧][スレッド一覧]

ruby-changes:45675

From: nobu <ko1@a...>
Date: Wed, 1 Mar 2017 16:53:20 +0900 (JST)
Subject: [ruby-changes:45675] nobu:r57748 (trunk): common.mk: separate clean-ext

nobu	2017-03-01 16:53:15 +0900 (Wed, 01 Mar 2017)

  New Revision: 57748

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57748

  Log:
    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.

  Modified files:
    trunk/Makefile.in
    trunk/common.mk
    trunk/win32/Makefile.sub
Index: common.mk
===================================================================
--- common.mk	(revision 57747)
+++ common.mk	(revision 57748)
@@ -568,11 +568,30 @@ realclean-extout: distclean-extout https://github.com/ruby/ruby/blob/trunk/common.mk#L568
 realclean-platform: distclean-platform
 realclean-rubyspec: distclean-rubyspec
 
-clean-ext distclean-ext realclean-ext::
-	$(Q)$(RM) $(EXTS_MK)
+clean-ext:: ext/clean gems/clean timestamp/clean
+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)$(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: clean-enc.d
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 57747)
+++ win32/Makefile.sub	(revision 57748)
@@ -1063,31 +1063,31 @@ distclean-local:: https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L1063
 		-$(Q)$(RM) $(INSTALLED_LIST:/=\) $(arch_hdrdir:/=\)\ruby\config.h verconf.h
 		-$(Q)$(RMDIRS) $(arch_hdrdir:/=\)\ruby
 
-clean-ext distclean-ext realclean-ext::
-		@cd ext && for /R $(EXTS) %I in (.) \
-		do @if exist %I\Makefile ( \
+ext/clean.mk ext/distclean.mk ext/realclean.mk::
+	$(Q)if exist $(EXTS_MK) $(MAKE) -k -f $(EXTS_MK) top_srcdir=$(srcdir) $(*F)
+
+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 && ( \
 		    call set n=%I && \
-		    call set n=%n:%CD%\ext\=% && \
+		    call set n=%n:%CD%\$(@D)\=% && \
 		    call set n=%n:\.=% && \
-		    call echo $(@:-ext=)ing %n:\=/% & \
-		    $(MAKE) $(MFLAGS) $(@:-ext=) & \
+		    call echo $(@F)ing %n:\=/% & \
+		    $(MAKE) $(MFLAGS) $(@F) & \
 		    cd %CD% & \
 		    $(RMDIRS) %I \
 		) )
 
-distclean-ext realclean-ext::
-		-$(Q)$(RM) ext/extinit.c ext/configure-ext.mk
-		@cd ext && for /D $(EXTS) %I in (.) \
-		do @if exist %I\exts.mk del %I\exts.mk
-		-$(Q)rmdir ext 2> nul || @
-
-clean-extout:
+ext/distclean gems/distclean ext/realclean gems/realclean::
+		$(Q)cd $(@D) && for /R $(EXTS) %I in (exts.mk*) \
+		do $(Q)(del %I & rmdir %~dpI)
+		-$(Q)rmdir $(@D) 2> nul || @
 
 clean-enc distclean-enc realclean-enc:
 !if exist($(ENC_MK))
-	@echo $(@:-enc=ing) encodings
-	@-$(MAKE) $(MAKE_ENC) $(@:-enc=)
+	$(ECHO) $(@:-enc=ing) encodings
+	-$(Q)$(MAKE) $(MAKE_ENC) $(@:-enc=)
 !endif
 
 $(RBCONFIG): $(PREP)
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 57747)
+++ Makefile.in	(revision 57748)
@@ -416,36 +416,43 @@ distclean-local:: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L416
 	-$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h
 	-$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true
 
-clean-ext distclean-ext realclean-ext::
-	@[ -f $(EXTS_MK) ] && $(MAKE) -f $(EXTS_MK) $(@:-ext=)
-	@set dummy `echo "${EXTS}" | tr , ' '`; shift; \
+ext/clean.sub gems/clean.sub:: ext/clean.mk
+ext/distclean.sub gems/distclean.sub:: ext/distclean.mk
+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 .; \
 	set dummy `\
-	    cd ext 2>/dev/null && \
+	    cd $(@D) 2>/dev/null && \
 	    find "$$@" \( -name Makefile -o -name exts.mk \) -print | \
-	    sed -n 's:^\./::;s:^:ext/:;s:/[^/][^/]*$$::p' | sort -u; \
-	` ` \
-	    cd gems 2>/dev/null && \
-	    find "$$@" -name exts.mk -print | \
-	    sed -n 's:^\./::;s:^:gems/:;s:/[^/][^/]*$$::p' | sort -u; \
+	    sed -n 's:^\./::;s:^:$(@D)/:;s:/[^/][^/]*$$::p' | sort -u; \
 	`; shift; \
 	for dir do \
-	    echo $(@:-ext=)ing "$$dir"; \
 	    $(RM) "$$dir/exts.mk"; \
-	    { [ ! -f "$$dir/Makefile" ] || \
-		(cd "$$dir" && exec $(MAKE) $(mflags) $(@:-ext=)); } && \
-	    case "$@" in \
-	    *distclean-ext*|*realclean-ext*) \
-		$(RMDIRS) "$$dir" 2> /dev/null || true;; \
-	    esac; \
-	done
-	-$(Q)$(RM) ext/extinit.$(OBJEXT)
-
-distclean-ext realclean-ext::
-	-$(Q)$(RM) ext/extinit.c ext/configure-ext.mk
-	-$(Q)$(RMDIR) ext 2> /dev/null || true
+	    if [ -f "$$dir/Makefile" ]; then \
+		echo $(@F:.sub=)ing "$$dir"; \
+		(cd "$$dir" && exec $(MAKE) $(mflags) $(@F:.sub=)); \
+	    fi; \
+	done || true
 
-clean-extout:
+ext/distclean ext/realclean gems/distclean gems/realclean::
+	$(Q) set dummy `echo "${EXTS}" | tr , ' '`; shift; \
+	test "$$#" = 0 && set .; \
+	cd $(@D) 2>/dev/null && \
+	find "$$@" -type d -empty -exec $(RMDIRS) {} + 2> /dev/null || true
+	$(Q) $(RMDIRS) $(@D)
 
 clean-enc distclean-enc realclean-enc:
 	@test -f "$(ENC_MK)" || exit 0; \

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]