Commit 3e1d42b7d980e29595572e550d5ce58c0a34f15f

Andreas Ericsson 2008-11-18T22:17:40

Add a 'sparse' make target Given the confusion on git@vger, we'd better not name this target "check" or (worse) "test", but it's still useful to have. As "sparse", noone should have problems understanding what it does. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

diff --git a/Makefile b/Makefile
index 49306be..bbbf64b 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,8 @@ OS     = unix
 BASIC_CFLAGS := -Isrc
 BASIC_CFLAGS += -fvisibility=hidden
 
-OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
+SRC_C = $(wildcard src/*.c)
+OBJS = $(patsubst %.c,%.o,$(SRC_C))
 HDRS = $(wildcard src/*.h)
 PUBLIC_HEADERS = $(wildcard src/git/*.h)
 HDRS += $(PUBLIC_HEADERS)
@@ -39,6 +40,9 @@ apidocs:
 
 test: $(TEST_RUN)
 
+sparse:
+	@for i in $(SRC_C); do sparse $$i $(SPARSE_FLAGS) $(BASIC_CFLAGS) $(CFLAGS); done
+
 install-headers: $(PUBLIC_HEADERS)
 	@mkdir -p /tmp/gitinc/git
 	@for i in $^; do cat .HEADER $$i > /tmp/gitinc/$${i##src/}; done
@@ -91,3 +95,4 @@ $(TEST_RUN): tests/%.run: tests/%.exe
 .PHONY: test $(TEST_RUN)
 .PHONY: apidocs
 .PHONY: install-headers
+.PHONY: sparse