@@ -817,6 +817,10 @@ XDIFF_LIB = xdiff/lib.a
817817
818818GENERATED_H += command-list.h
819819GENERATED_H += config-list.h
820+ GENERATED_H += hook-list.h
821+
822+ .PHONY : generated-hdrs
823+ generated-hdrs : $(GENERATED_H )
820824
821825LIB_H := $(sort $(patsubst ./% ,% ,$(shell git ls-files '* .h' ':!t/' ':!Documentation/' 2>/dev/null || \
822826 $(FIND ) . \
@@ -902,6 +906,7 @@ LIB_OBJS += hash-lookup.o
902906LIB_OBJS += hashmap.o
903907LIB_OBJS += help.o
904908LIB_OBJS += hex.o
909+ LIB_OBJS += hook.o
905910LIB_OBJS += ident.o
906911LIB_OBJS += json-writer.o
907912LIB_OBJS += kwset.o
@@ -2211,8 +2216,9 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
22112216 $(filter % .o,$^ ) $(LIBS )
22122217
22132218help.sp help.s help.o : command-list.h
2219+ hook.sp hook.s hook.o : hook-list.h
22142220
2215- builtin/help.sp builtin/help.s builtin/help.o : config-list.h GIT-PREFIX
2221+ builtin/help.sp builtin/help.s builtin/help.o : config-list.h hook-list.h GIT-PREFIX
22162222builtin/help.sp builtin/help.s builtin/help.o : EXTRA_CPPFLAGS = \
22172223 ' -DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
22182224 ' -DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@ -2235,15 +2241,17 @@ $(BUILT_INS): git$X
22352241config-list.h : generate-configlist.sh
22362242
22372243config-list.h : Documentation/* config.txt Documentation/config/* .txt
2238- $(QUIET_GEN )$(SHELL_PATH ) ./generate-configlist.sh \
2239- > $@ + && mv $@ + $@
2244+ $(QUIET_GEN )$(SHELL_PATH ) ./generate-configlist.sh > $@
22402245
22412246command-list.h : generate-cmdlist.sh command-list.txt
22422247
22432248command-list.h : $(wildcard Documentation/git* .txt)
22442249 $(QUIET_GEN )$(SHELL_PATH ) ./generate-cmdlist.sh \
22452250 $(patsubst % ,--exclude-program % ,$(EXCLUDED_PROGRAMS ) ) \
2246- command-list.txt > $@ + && mv $@ + $@
2251+ command-list.txt > $@
2252+
2253+ hook-list.h : generate-hooklist.sh Documentation/githooks.txt
2254+ $(QUIET_GEN )$(SHELL_PATH ) ./generate-hooklist.sh > $@
22472255
22482256SCRIPT_DEFINES = $(SHELL_PATH_SQ ) :$(DIFF_SQ ) :$(GIT_VERSION ) :\
22492257 $(localedir_SQ ) :$(NO_CURL ) :$(USE_GETTEXT_SCHEME ) :$(SANE_TOOL_PATH_SQ ) :\
@@ -2505,13 +2513,6 @@ ifneq ($(dep_files_present),)
25052513include $(dep_files_present )
25062514endif
25072515else
2508- # Dependencies on header files, for platforms that do not support
2509- # the gcc -MMD option.
2510- #
2511- # Dependencies on automatically generated headers such as command-list.h
2512- # should _not_ be included here, since they are necessary even when
2513- # building an object for the first time.
2514-
25152516$(OBJECTS ) : $(LIB_H ) $(GENERATED_H )
25162517endif
25172518
@@ -2909,7 +2910,7 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
29092910.PHONY : sparse $(SP_OBJ )
29102911sparse : $(SP_OBJ )
29112912
2912- EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/%
2913+ EXCEPT_HDRS := $( GENERATED_H ) unicode-width.h compat/% xdiff/%
29132914ifndef GCRYPT_SHA256
29142915 EXCEPT_HDRS += sha256/gcrypt.h
29152916endif
@@ -2931,7 +2932,8 @@ hdr-check: $(HCO)
29312932style :
29322933 git clang-format --style file --diff --extensions c,h
29332934
2934- check : config-list.h command-list.h
2935+ .PHONY : check
2936+ check : $(GENERATED_H )
29352937 @if sparse; \
29362938 then \
29372939 echo >&2 " Use 'make sparse' instead" ; \
0 commit comments