Skip to content

Commit cf6a2d2

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7027f50 commit cf6a2d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,12 @@ VCSSVN_LIB = vcs-svn/lib.a
818818

819819
GENERATED_H += command-list.h
820820

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 || \
822822
$(FIND) . \
823823
-name .git -prune -o \
824824
-name t -prune -o \
825825
-name Documentation -prune -o \
826-
-name '*.h' -print))
826+
-name '*.h' -print)))
827827

828828
LIB_OBJS += abspath.o
829829
LIB_OBJS += advice.o
@@ -2768,7 +2768,7 @@ EXCEPT_HDRS := $(GEN_HDRS) compat/% xdiff/%
27682768
ifndef GCRYPT_SHA256
27692769
EXCEPT_HDRS += sha256/gcrypt.h
27702770
endif
2771-
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
2771+
CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))
27722772
HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
27732773

27742774
$(HCO): %.hco: %.h FORCE

0 commit comments

Comments
 (0)