Skip to content

Commit 15caca2

Browse files
ramsay-jonesgitster
authored andcommitted
Makefile: improve SPARSE_FLAGS customisation
In order to enable greater user customisation of the SPARSE_FLAGS variable, we introduce a new SP_EXTRA_FLAGS variable to use for target specific settings. Without using the new variable, setting the SPARSE_FLAGS on the 'make' command-line would also override the value set by the target-specific rules in the Makefile (effectively making them useless). Also, this enables the SP_EXTRA_FLAGS to be used in the future for any other internal customisations, such as for some platform specific values. In addition, we initialise the SPARSE_FLAGS to the default (empty) value using a conditional assignment (?=). This allows SPARSE_FLAGS to be set from the environment as well as from the command-line. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f42615b commit 15caca2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,11 @@ SPATCH = spatch
568568

569569
export TCL_PATH TCLTK_PATH
570570

571-
SPARSE_FLAGS =
571+
# user customisation variable for 'sparse' target
572+
SPARSE_FLAGS ?=
573+
# internal/platform customisation variable for 'sparse'
574+
SP_EXTRA_FLAGS =
575+
572576
SPATCH_FLAGS = --all-includes --patch .
573577

574578

@@ -2347,10 +2351,10 @@ gettext.sp gettext.s gettext.o: GIT-PREFIX
23472351
gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
23482352
-DGIT_LOCALE_PATH='"$(localedir_relative_SQ)"'
23492353

2350-
http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SPARSE_FLAGS += \
2354+
http-push.sp http.sp http-walker.sp remote-curl.sp imap-send.sp: SP_EXTRA_FLAGS += \
23512355
-DCURL_DISABLE_TYPECHECK
23522356

2353-
pack-revindex.sp: SPARSE_FLAGS += -Wno-memcpy-max-count
2357+
pack-revindex.sp: SP_EXTRA_FLAGS += -Wno-memcpy-max-count
23542358

23552359
ifdef NO_EXPAT
23562360
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
@@ -2364,7 +2368,7 @@ endif
23642368
ifdef USE_NED_ALLOCATOR
23652369
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
23662370
-DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
2367-
compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
2371+
compat/nedmalloc/nedmalloc.sp: SP_EXTRA_FLAGS += -Wno-non-pointer-null
23682372
endif
23692373

23702374
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
@@ -2688,7 +2692,7 @@ SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
26882692

26892693
$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
26902694
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
2691-
$(SPARSE_FLAGS) $<
2695+
$(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $<
26922696

26932697
.PHONY: sparse $(SP_OBJ)
26942698
sparse: $(SP_OBJ)

0 commit comments

Comments
 (0)