@@ -598,6 +598,7 @@ SCRIPT_SH =
598
598
SCRIPT_LIB =
599
599
TEST_BUILTINS_OBJS =
600
600
TEST_PROGRAMS_NEED_X =
601
+ THIRD_PARTY_SOURCES =
601
602
602
603
# Having this variable in your environment would break pipelines because
603
604
# you cause "cd" to echo its destination to stdout. It can also take
@@ -818,12 +819,12 @@ VCSSVN_LIB = vcs-svn/lib.a
818
819
819
820
GENERATED_H += command-list.h
820
821
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 || \
822
823
$(FIND ) . \
823
824
-name .git -prune -o \
824
825
-name t -prune -o \
825
826
-name Documentation -prune -o \
826
- -name '* .h' -print) )
827
+ -name '* .h' -print) ))
827
828
828
829
LIB_OBJS += abspath.o
829
830
LIB_OBJS += advice.o
@@ -1146,6 +1147,20 @@ BUILTIN_OBJS += builtin/verify-tag.o
1146
1147
BUILTIN_OBJS += builtin/worktree.o
1147
1148
BUILTIN_OBJS += builtin/write-tree.o
1148
1149
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
+
1149
1164
GITLIBS = common-main.o $(LIB_FILE ) $(XDIFF_LIB )
1150
1165
EXTLIBS =
1151
1166
@@ -2600,6 +2615,7 @@ FIND_SOURCE_FILES = ( \
2600
2615
-o \( -name 'trash*' -type d -prune \) \
2601
2616
-o \( -name '*.[hcS]' -type f -print \) \
2602
2617
-o \( -name '*.sh' -type f -print \) \
2618
+ | sed -e 's|^\./||' \
2603
2619
)
2604
2620
2605
2621
$(ETAGS_TARGET ) : FORCE
@@ -2769,7 +2785,7 @@ EXCEPT_HDRS := $(GEN_HDRS) compat/% xdiff/%
2769
2785
ifndef GCRYPT_SHA256
2770
2786
EXCEPT_HDRS += sha256/gcrypt.h
2771
2787
endif
2772
- CHK_HDRS = $(filter-out $(EXCEPT_HDRS ) ,$(patsubst ./ % , % , $( LIB_H ) ) )
2788
+ CHK_HDRS = $(filter-out $(EXCEPT_HDRS ) ,$(LIB_H ) )
2773
2789
HCO = $(patsubst % .h,% .hco,$(CHK_HDRS ) )
2774
2790
2775
2791
$(HCO ) : % .hco: % .h FORCE
@@ -2792,12 +2808,8 @@ check: command-list.h
2792
2808
exit 1; \
2793
2809
fi
2794
2810
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 ) )
2801
2813
2802
2814
% .cocci.patch : % .cocci $(COCCI_SOURCES )
2803
2815
@echo ' ' SPATCH $< ; \
0 commit comments