Describe the bug
Your Makefile variable GIT_REFRESH_PREREQ relies on .git/index if path .git exists.
This doesn't apply to submodules because .git is a file here, instead of being a directory.
The error you get in such case:
make[1]: *** No rule to make target '.git/index', needed by 'version.inc'. Stop.
To Reproduce
Steps to reproduce the behavior (untested):
Kind of ...
$ mkdir /tmp/parent
$ cd /tmp/parent
$ git init
$ git submodule add https://github.com/cea-hpc/modules.git
$ cd modules
$ ./configure
$ make
...
Expected behavior
It should build even when you are a submodule of another git repository.
Additional context
Workaround: remove ".git/index".