On Wed, Sep 22, 2021 at 1:17 PM Jeff King <peff@xxxxxxxx> wrote: > > On Wed, Sep 22, 2021 at 11:28:38AM -0700, Junio C Hamano wrote: > > > > ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto) > > > -dep_check = $(shell $(CC) $(ALL_CFLAGS) \ > > > +dep_check = $(shell $(CC) \ > > > -c -MF /dev/null -MQ /dev/null -MMD -MP \ > > > -x c /dev/null -o /dev/null 2>&1; \ > > > echo $$?) > > > > I am all for this simplification. It takes us back to the state > > before 1816bf26 (Makefile: Improve compiler header dependency check, > > 2011-08-30). But I think that is more or less orthogonal to the > > "you are not supposed to feed an empty compilation unit" issue. > > Hmm, my suggestion was off the cuff without digging to see whether we > used to do something similar. ;) > > I do worry a bit that we'd be regressing the case that commit tried to > fix. OTOH, I'm not sure I understand its commit message. It talks about > things in CFLAGS being a problem, but it looks like the original (and my > proposal here) would not look at CFLAGS at all? If people are putting > stuff into CC that will break when used without CFLAGS, then I feel like > the answer might be "don't do that". Or are there common situations > where $(CC) is not expected to behave sensibly on its own? Yes, the problem was ONLY with the gcc that came in macOS before they moved to clang and that had a frankenstein set of options which will prevent people building BOTH fat binaries and doing this header dependency computation at the same time. Ironically, modern clang makes his use case even uglier (running on top of Ævar's fix) : $ make CFLAGS="-arch x86_64 -arch arm64" fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't create temporary output file: /dev/null.lipo (Operation not permitted) clang: error: lipo command failed with exit code 1 (use -v to see invocation) fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't create temporary output file: /dev/null.lipo (Operation not permitted) clang: error: lipo command failed with exit code 1 (use -v to see invocation) Non-zero 1 exit with COMPUTE_HEADER_DEPENDENCIES=auto, set it to "yes" or "no" t so the test fails, and COMPUTE_HEADER_DEPENDENCIES is disabled, but it shouldn't and works fine if the test is overridden with COMPUTE_HEADER_DEPENDENCIES=yes so by removing the CFLAGS from that test, we will actually be fixing this use case as well IMHO. Carlo