Skip to content

Commit d0867a3

Browse files
authored
Update git repo check logic in Makefile
Checking whether any submodules are registered is slightly more precise than checking for raw git. If we aren't in a git repository or that repo has no registered submodules, then the build is definitely created from the archive. Running `git submodule update` won't help in that case.
1 parent af78bda commit d0867a3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ checkghcpkg=$(if $(shell ghc-pkg list --simple-output $(1)),,$(error GHC package
3030
$(foreach pkg,$(GHC_PKGS),$(call checkghcpkg,$(pkg)))
3131

3232
# Check all submodules are initialized
33-
in_git_repo=$(shell git rev-parse --is-inside-work-tree 2> /dev/null )
34-
ifeq ($(in_git_repo),true)
35-
define SUBMOD_MSG
36-
Submodule $(1) missing. Initialize with
37-
git submodule update --init --recursive
38-
endef
39-
checksubmod=$(if $(wildcard $(1)/.git),,$(error $(SUBMOD_MSG)))
40-
else
33+
in_git_repo=$(shell git submodule 2> /dev/null )
34+
ifneq ($(in_git_repo),)
4135
define SUBMOD_MSG
4236
Submodule $(1) missing.
4337
This archive was exported from Git without the source files for
4438
submodules. You will need to acquire those files or, preferably,
4539
build instead from a clone of the BSC Git repository
4640
endef
4741
checksubmod=$(if $(wildcard $(1)/*),,$(error $(SUBMOD_MSG)))
42+
else
43+
define SUBMOD_MSG
44+
Submodule $(1) missing. Initialize with
45+
git submodule update --init --recursive
46+
endef
47+
checksubmod=$(if $(wildcard $(1)/.git),,$(error $(SUBMOD_MSG)))
4848
endif
4949
$(foreach submod,$(SUBMODS),$(call checksubmod,$(submod)))
5050
endif # NO_DEPS_CHECKS

0 commit comments

Comments
 (0)