]> git.sesse.net Git - stockfish/commitdiff
Invoke .depend only on build targets
authorMinetaS <skdty87@gmail.com>
Tue, 6 Dec 2022 12:32:42 +0000 (21:32 +0900)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Thu, 8 Dec 2022 19:48:20 +0000 (20:48 +0100)
Add a constraint so that the dependency build only occurs when users
actually run build tasks.

This fixes a bug on some systems where gcc/g++ is not available.

closes https://github.com/official-stockfish/Stockfish/pull/4255

No functional change

src/Makefile

index 917bd5c06c7a83f9d4c48f9a531df196b0cb2d9d..0c98391bb84b25e599e972a48316a7b6e57bf98c 100644 (file)
@@ -512,7 +512,7 @@ endif
 
 ### Sometimes gcc is really clang
 ifeq ($(COMP),gcc)
-       gccversion = $(shell $(CXX) --version)
+       gccversion = $(shell $(CXX) --version 2>/dev/null)
        gccisclang = $(findstring clang,$(gccversion))
        ifneq ($(gccisclang),)
                profile_make = clang-profile-make
@@ -1006,4 +1006,6 @@ icc-profile-use:
 .depend: $(SRCS)
        -@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null
 
+ifneq (, $(filter $(MAKECMDGOALS), build profile-build))
 -include .depend
+endif