All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add XARGS to toplevel Makefile
@ 2006-09-28  6:02 Olaf Hering
  2006-09-28  8:33 ` Jan Engelhardt
  2006-09-30  7:54 ` Olaf Hering
  0 siblings, 2 replies; 6+ messages in thread
From: Olaf Hering @ 2006-09-28  6:02 UTC (permalink / raw)
  To: sam, Andrew Morton, linux-kernel


run xargs with --no-run-if-empty to avoid random failures:

  MAKE   tags
ctags: No files specified. Try "ctags --help".
make: *** [tags] Error 123

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 Makefile |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

Index: linux-2.6/Makefile
===================================================================
--- linux-2.6.orig/Makefile
+++ linux-2.6/Makefile
@@ -295,6 +295,7 @@ DEPMOD		= /sbin/depmod
 KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
+XARGS		= xargs --no-run-if-empty
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
 MODFLAGS	= -DMODULE
@@ -1049,7 +1050,7 @@ clean: archclean $(clean-dirs)
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
 		-o -name '*.symtypes' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 # mrproper - Delete all generated files, including .config
 #
@@ -1075,7 +1076,7 @@ distclean: mrproper
 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
 		-o -name '.*.rej' -o -size 0 \
 		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 
 # Packaging of the kernel to various formats
@@ -1237,7 +1238,7 @@ clean: $(clean-dirs)
 	@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 help:
 	@echo  '  Building external modules.'
@@ -1313,26 +1314,26 @@ endef
 
 define xtags
 	if $1 --version 2>&1 | grep -iq exuberant; then \
-	    $(all-sources) | xargs $1 -a \
+	    $(all-sources) | $(XARGS) $1 -a \
 		-I __initdata,__exitdata,__acquires,__releases \
 		-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
 		--extra=+f --c-kinds=+px; \
-	    $(all-kconfigs) | xargs $1 -a \
+	    $(all-kconfigs) | $(XARGS) $1 -a \
 		--langdef=kconfig \
 		--language-force=kconfig \
 		--regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
-	    $(all-defconfigs) | xargs $1 -a \
+	    $(all-defconfigs) | $(XARGS) $1 -a \
 		--langdef=dotconfig \
 		--language-force=dotconfig \
 		--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
 	elif $1 --version 2>&1 | grep -iq emacs; then \
-	    $(all-sources) | xargs $1 -a; \
-	    $(all-kconfigs) | xargs $1 -a \
+	    $(all-sources) | $(XARGS) $1 -a; \
+	    $(all-kconfigs) | $(XARGS) $1 -a \
 		--regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
-	    $(all-defconfigs) | xargs $1 -a \
+	    $(all-defconfigs) | $(XARGS) $1 -a \
 		--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
 	else \
-	    $(all-sources) | xargs $1 -a; \
+	    $(all-sources) | $(XARGS) $1 -a; \
 	fi
 endef
 
@@ -1371,12 +1372,12 @@ tags: FORCE
 includecheck:
 	find * $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
-		| xargs $(PERL) -w scripts/checkincludes.pl
+		| $(XARGS) $(PERL) -w scripts/checkincludes.pl
 
 versioncheck:
 	find * $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
-		| xargs $(PERL) -w scripts/checkversion.pl
+		| $(XARGS) $(PERL) -w scripts/checkversion.pl
 
 namespacecheck:
 	$(PERL) $(srctree)/scripts/namespace.pl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] add XARGS to toplevel Makefile
  2006-09-28  6:02 [PATCH] add XARGS to toplevel Makefile Olaf Hering
@ 2006-09-28  8:33 ` Jan Engelhardt
  2006-09-28 10:21   ` Sam Ravnborg
  2006-09-30  7:54 ` Olaf Hering
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2006-09-28  8:33 UTC (permalink / raw)
  To: Olaf Hering; +Cc: sam, Andrew Morton, linux-kernel

>
>run xargs with --no-run-if-empty to avoid random failures:

How about the short option, -r?




Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] add XARGS to toplevel Makefile
  2006-09-28  8:33 ` Jan Engelhardt
@ 2006-09-28 10:21   ` Sam Ravnborg
  2006-09-28 10:55     ` Segher Boessenkool
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2006-09-28 10:21 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Olaf Hering, Andrew Morton, linux-kernel

On Thu, Sep 28, 2006 at 10:33:01AM +0200, Jan Engelhardt wrote:
> >
> >run xargs with --no-run-if-empty to avoid random failures:
> 
> How about the short option, -r?
Is it more portable - otherwise the more descriptive option is preferred.

	Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] add XARGS to toplevel Makefile
  2006-09-28 10:21   ` Sam Ravnborg
@ 2006-09-28 10:55     ` Segher Boessenkool
  0 siblings, 0 replies; 6+ messages in thread
From: Segher Boessenkool @ 2006-09-28 10:55 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Jan Engelhardt, Olaf Hering, Andrew Morton, linux-kernel

>>> run xargs with --no-run-if-empty to avoid random failures:
>>
>> How about the short option, -r?
> Is it more portable - otherwise the more descriptive option is  
> preferred.

Neither is portable, and -r tends to hide real bugs; please use
something else instead, like making the relevant makefile targets
non-fatal (lots of-em already are).


Segher


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] add XARGS to toplevel Makefile
  2006-09-28  6:02 [PATCH] add XARGS to toplevel Makefile Olaf Hering
  2006-09-28  8:33 ` Jan Engelhardt
@ 2006-09-30  7:54 ` Olaf Hering
  2006-09-30  8:05   ` Willy Tarreau
  1 sibling, 1 reply; 6+ messages in thread
From: Olaf Hering @ 2006-09-30  7:54 UTC (permalink / raw)
  To: sam, Andrew Morton, linux-kernel


run xargs with --no-run-if-empty to avoid random failures:

  MAKE   tags
ctags: No files specified. Try "ctags --help".
make: *** [tags] Error 123

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 Makefile |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

Index: linux-2.6/Makefile
===================================================================
--- linux-2.6.orig/Makefile
+++ linux-2.6/Makefile
@@ -295,6 +295,8 @@ DEPMOD		= /sbin/depmod
 KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
+# assume xargs comes from GNU findutils or GNU coreutils
+XARGS		= $(shell if [ "$$(uname -s)" = "Linux" ]; then echo "xargs --no-run-if-empty" ; else echo "xargs" ; fi )
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
 MODFLAGS	= -DMODULE
@@ -1049,7 +1051,7 @@ clean: archclean $(clean-dirs)
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
 		-o -name '*.symtypes' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 # mrproper - Delete all generated files, including .config
 #
@@ -1075,7 +1077,7 @@ distclean: mrproper
 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
 		-o -name '.*.rej' -o -size 0 \
 		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 
 # Packaging of the kernel to various formats
@@ -1237,7 +1239,7 @@ clean: $(clean-dirs)
 	@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
-		-type f -print | xargs rm -f
+		-type f -print | $(XARGS) rm -f
 
 help:
 	@echo  '  Building external modules.'
@@ -1313,26 +1315,26 @@ endef
 
 define xtags
 	if $1 --version 2>&1 | grep -iq exuberant; then \
-	    $(all-sources) | xargs $1 -a \
+	    $(all-sources) | $(XARGS) $1 -a \
 		-I __initdata,__exitdata,__acquires,__releases \
 		-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
 		--extra=+f --c-kinds=+px; \
-	    $(all-kconfigs) | xargs $1 -a \
+	    $(all-kconfigs) | $(XARGS) $1 -a \
 		--langdef=kconfig \
 		--language-force=kconfig \
 		--regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
-	    $(all-defconfigs) | xargs $1 -a \
+	    $(all-defconfigs) | $(XARGS) $1 -a \
 		--langdef=dotconfig \
 		--language-force=dotconfig \
 		--regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \
 	elif $1 --version 2>&1 | grep -iq emacs; then \
-	    $(all-sources) | xargs $1 -a; \
-	    $(all-kconfigs) | xargs $1 -a \
+	    $(all-sources) | $(XARGS) $1 -a; \
+	    $(all-kconfigs) | $(XARGS) $1 -a \
 		--regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
-	    $(all-defconfigs) | xargs $1 -a \
+	    $(all-defconfigs) | $(XARGS) $1 -a \
 		--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
 	else \
-	    $(all-sources) | xargs $1 -a; \
+	    $(all-sources) | $(XARGS) $1 -a; \
 	fi
 endef
 
@@ -1371,12 +1373,12 @@ tags: FORCE
 includecheck:
 	find * $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
-		| xargs $(PERL) -w scripts/checkincludes.pl
+		| $(XARGS) $(PERL) -w scripts/checkincludes.pl
 
 versioncheck:
 	find * $(RCS_FIND_IGNORE) \
 		-name '*.[hcS]' -type f -print | sort \
-		| xargs $(PERL) -w scripts/checkversion.pl
+		| $(XARGS) $(PERL) -w scripts/checkversion.pl
 
 namespacecheck:
 	$(PERL) $(srctree)/scripts/namespace.pl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] add XARGS to toplevel Makefile
  2006-09-30  7:54 ` Olaf Hering
@ 2006-09-30  8:05   ` Willy Tarreau
  0 siblings, 0 replies; 6+ messages in thread
From: Willy Tarreau @ 2006-09-30  8:05 UTC (permalink / raw)
  To: Olaf Hering; +Cc: sam, Andrew Morton, linux-kernel

Hi Olaf,

On Sat, Sep 30, 2006 at 09:54:27AM +0200, Olaf Hering wrote:
> 
> run xargs with --no-run-if-empty to avoid random failures:
> 
>   MAKE   tags
> ctags: No files specified. Try "ctags --help".
> make: *** [tags] Error 123

> +# assume xargs comes from GNU findutils or GNU coreutils
> +XARGS		= $(shell if [ "$$(uname -s)" = "Linux" ]; then echo "xargs --no-run-if-empty" ; else echo "xargs" ; fi )

I'd rather test xargs' support for the option than check the OS with uname.
Something like the following might a little bit be more appropriate :

XARGS		= $(shell if xargs --no-run-if-empty true </dev/null 2>/dev/null; then echo "xargs --no-run-if-empty" ; else echo "xargs" ; fi )

Best regards,
Willy


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-09-30  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-28  6:02 [PATCH] add XARGS to toplevel Makefile Olaf Hering
2006-09-28  8:33 ` Jan Engelhardt
2006-09-28 10:21   ` Sam Ravnborg
2006-09-28 10:55     ` Segher Boessenkool
2006-09-30  7:54 ` Olaf Hering
2006-09-30  8:05   ` Willy Tarreau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.