git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Install issues

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 11, 2008, 21:11 UTC
Message-ID
<7vskpyynla.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20081110173101.3d76613b@pc09.procura.nl>
"H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
Show 10 quoted lines
> --- Makefile.org	2008-11-10 17:29:53.000000000 +0100
> +++ Makefile	2008-11-10 17:29:39.000000000 +0100
> @@ -1329,6 +1329,10 @@ check-sha1:: test-sha1$X
>  	./test-sha1.sh
>  
>  check: common-cmds.h
> +	@`sparse </dev/null 2>/dev/null` || (\
> +	    echo "The 'sparse' command is not available, so I cannot make the 'check' target" ;\
> +	    echo "Did you mean 'make test' instead?" ;\
> +	    exit 1 )

When you mean "grouping", using {} is much clearer to convey your intention. Use of needless (subshell) forces the reader to wonder if you wanted to do something that affects the environment for later commands inside, and in this case you didn't.

Why do you have sparse check inside a backtick to produce a string to be interpreted as a command to be executed?

How about doing this instead? 'sparse' without any parameter exits with success status silently; when you do not have the command, the shell will complain with "sparse: command not found" anyway, so you only need to suggest "make 'test'" and nothing else.

-- >8 --
Subject: Makefile: help people who run 'make check' by mistake

The target to run self test is 'make test', but there are people who try 'make check' and worse yet do not have sparse installed.

Suggest 'make test' target when they do not have 'sparse'.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git c/Makefile w/Makefile
index 40309e1..d3137ca 100644
--- c/Makefile
+++ w/Makefile
@@ -1355,7 +1355,16 @@ check-sha1:: test-sha1$X
 	./test-sha1.sh
 
 check: common-cmds.h
-	for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
+	if sparse; \
+	then \
+		for i in *.c; \
+		do \
+			sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
+		done; \
+	else \
+		echo 2>&1 "Did you mean 'make test'?"; \
+		exit 1; \
+	fi
 
 remove-dashes:
 	./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
Previous: Andreas Ericsson
Message 14 of 14 in “Install issues”
  1. H.Merijn BrandNov 10, 2008
  2. Miklos VajnaNov 10, 2008
  3. H.Merijn BrandNov 10, 2008
  4. Miklos VajnaNov 10, 2008
  5. H.Merijn BrandNov 11, 2008
  6. Andreas EricssonNov 11, 2008
  7. Junio C HamanoNov 11, 2008
  8. H.Merijn BrandNov 11, 2008
  9. Boyd Lynn GerberNov 11, 2008
  10. H.Merijn BrandNov 11, 2008
  11. Junio C HamanoNov 11, 2008
  12. H.Merijn BrandNov 11, 2008
  13. Andreas EricssonNov 12, 2008
  14. Junio C HamanoNov 11, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.