Makefile: add a target to run CGit through sparse

Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
John Keeping 2015-03-08 16:32:15 +00:00 committed by Jason A. Donenfeld
parent 97a91657a5
commit 5150b7c1e6
2 changed files with 11 additions and 1 deletions

View File

@ -68,6 +68,9 @@ all:: cgit
cgit: cgit:
$(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit $(EXTRA_GIT_TARGETS) NO_CURL=1 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk ../cgit $(EXTRA_GIT_TARGETS) NO_CURL=1
sparse:
$(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) -f ../cgit.mk NO_CURL=1 cgit-sparse
test: test:
@$(MAKE) --no-print-directory cgit EXTRA_GIT_TARGETS=all @$(MAKE) --no-print-directory cgit EXTRA_GIT_TARGETS=all
$(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all

View File

@ -96,7 +96,7 @@ CGIT_OBJS := $(addprefix $(CGIT_PREFIX),$(CGIT_OBJ_NAMES))
# Only cgit.c reference CGIT_VERSION so we only rebuild its objects when the # Only cgit.c reference CGIT_VERSION so we only rebuild its objects when the
# version changes. # version changes.
CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.o) CGIT_VERSION_OBJS := $(addprefix $(CGIT_PREFIX),cgit.o cgit.sp)
$(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION $(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION
$(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \ $(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \
-DCGIT_VERSION='"$(CGIT_VERSION)"' -DCGIT_VERSION='"$(CGIT_VERSION)"'
@ -129,3 +129,10 @@ $(CGIT_OBJS): %.o: %.c GIT-CFLAGS $(CGIT_PREFIX)CGIT-CFLAGS $(missing_dep_dirs)
$(CGIT_PREFIX)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS) $(CGIT_PREFIX)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS)
@echo 1>&1 " * $(LUA_MESSAGE)" @echo 1>&1 " * $(LUA_MESSAGE)"
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(CGIT_LIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(CGIT_LIBS)
CGIT_SP_OBJS := $(patsubst %.o,%.sp,$(CGIT_OBJS))
$(CGIT_SP_OBJS): %.sp: %.c GIT-CFLAGS $(CGIT_PREFIX)CGIT-CFLAGS FORCE
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(CGIT_CFLAGS) $(SPARSE_FLAGS) $<
cgit-sparse: $(CGIT_SP_OBJS)