Makefile: strip leading ./ in $(LIB_H)
Currently, $(LIB_H) is generated from two modes: if `git ls-files` is present, it will use that to enumerate the files in the repository; else it will use `$(FIND) .` to enumerate the files in the directory. There is a subtle difference between these two methods, however. With ls-files, filenames don't have a leading `./` while with $(FIND), they do. This results in $(CHK_HDRS) having to substitute out the leading `./` before it uses $(LIB_H). Unify the two possible values in $(LIB_H) by using patsubst to remove the `./` prefix at its definition. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu committed
Sep 16, 2019 at 12:23 UTC
cf6a2d2557a5a50e0b1cf3a861a0df948e2782fc
1 file changed
+3
-3
Makefile
+3
-3
@@ -818,12 +818,12 @@ VCSSVN_LIB = vcs-svn/lib.a
818
819
GENERATED_H += command-list.h
820
821
-LIB_H := $(sort $(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
821
+LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
822
$(FIND) . \
823
-name .git -prune -o \
824
-name t -prune -o \
825
-name Documentation -prune -o \
826
- -name '*.h' -print))
826
+ -name '*.h' -print)))
827
828
LIB_OBJS += abspath.o
829
LIB_OBJS += advice.o
@@ -2768,7 +2768,7 @@ EXCEPT_HDRS := $(GEN_HDRS) compat/% xdiff/%
2768
ifndef GCRYPT_SHA256
2769
EXCEPT_HDRS += sha256/gcrypt.h
2770
endif
2771
-CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
2771
+CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
2772
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
2773
2774
$(HCO): %.hco: %.h FORCE