@@ -598,6 +598,7 @@ SCRIPT_SH =
598598SCRIPT_LIB =
599599TEST_BUILTINS_OBJS =
600600TEST_PROGRAMS_NEED_X =
601+ THIRD_PARTY_SOURCES =
601602
602603# Having this variable in your environment would break pipelines because
603604# you cause "cd" to echo its destination to stdout. It can also take
@@ -818,12 +819,12 @@ VCSSVN_LIB = vcs-svn/lib.a
818819
819820GENERATED_H += command-list.h
820821
821- LIB_H := $(sort $(shell git ls-files '* .h' ':!t/' ':!Documentation/' 2>/dev/null || \
822+ LIB_H := $(sort $(patsubst ./ % , % , $( shell git ls-files '* .h' ':!t/' ':!Documentation/' 2>/dev/null || \
822823 $(FIND ) . \
823824 -name .git -prune -o \
824825 -name t -prune -o \
825826 -name Documentation -prune -o \
826- -name '* .h' -print) )
827+ -name '* .h' -print) ))
827828
828829LIB_OBJS += abspath.o
829830LIB_OBJS += advice.o
@@ -1146,6 +1147,20 @@ BUILTIN_OBJS += builtin/verify-tag.o
11461147BUILTIN_OBJS += builtin/worktree.o
11471148BUILTIN_OBJS += builtin/write-tree.o
11481149
1150+ # THIRD_PARTY_SOURCES is a list of patterns compatible with the
1151+ # $(filter) and $(filter-out) family of functions. They specify source
1152+ # files which are taken from some third-party source where we want to be
1153+ # less strict about issues such as coding style so we don't diverge from
1154+ # upstream unnecessarily (making merging in future changes easier).
1155+ THIRD_PARTY_SOURCES += compat/inet_ntop.c
1156+ THIRD_PARTY_SOURCES += compat/inet_pton.c
1157+ THIRD_PARTY_SOURCES += compat/nedmalloc/%
1158+ THIRD_PARTY_SOURCES += compat/obstack.%
1159+ THIRD_PARTY_SOURCES += compat/poll/%
1160+ THIRD_PARTY_SOURCES += compat/regex/%
1161+ THIRD_PARTY_SOURCES += sha1collisiondetection/%
1162+ THIRD_PARTY_SOURCES += sha1dc/%
1163+
11491164GITLIBS = common-main.o $(LIB_FILE ) $(XDIFF_LIB )
11501165EXTLIBS =
11511166
@@ -2600,6 +2615,7 @@ FIND_SOURCE_FILES = ( \
26002615 -o \( -name 'trash*' -type d -prune \) \
26012616 -o \( -name '*.[hcS]' -type f -print \) \
26022617 -o \( -name '*.sh' -type f -print \) \
2618+ | sed -e 's|^\./||' \
26032619 )
26042620
26052621$(ETAGS_TARGET ) : FORCE
@@ -2769,7 +2785,7 @@ EXCEPT_HDRS := $(GEN_HDRS) compat/% xdiff/%
27692785ifndef GCRYPT_SHA256
27702786 EXCEPT_HDRS += sha256/gcrypt.h
27712787endif
2772- CHK_HDRS = $(filter-out $(EXCEPT_HDRS ) ,$(patsubst ./ % , % , $( LIB_H ) ) )
2788+ CHK_HDRS = $(filter-out $(EXCEPT_HDRS ) ,$(LIB_H ) )
27732789HCO = $(patsubst % .h,% .hco,$(CHK_HDRS ) )
27742790
27752791$(HCO ) : % .hco: % .h FORCE
@@ -2792,12 +2808,8 @@ check: command-list.h
27922808 exit 1; \
27932809 fi
27942810
2795- C_SOURCES = $(patsubst % .o,% .c,$(C_OBJ ) )
2796- ifdef DC_SHA1_SUBMODULE
2797- COCCI_SOURCES = $(filter-out sha1collisiondetection/% ,$(C_SOURCES ) )
2798- else
2799- COCCI_SOURCES = $(filter-out sha1dc/% ,$(C_SOURCES ) )
2800- endif
2811+ FOUND_C_SOURCES = $(filter % .c,$(shell $(FIND_SOURCE_FILES ) ) )
2812+ COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES ) ,$(FOUND_C_SOURCES ) )
28012813
28022814% .cocci.patch : % .cocci $(COCCI_SOURCES )
28032815 @echo ' ' SPATCH $< ; \
0 commit comments