As ejeffrey said, git was just an example.
Our common pattern for handling this is to create a file called "version" or similar. In our case, it's release_hash.txt, and sometimes a version.txt as well, and is usually autogenerated from a script that does a bunch of other stuff too (changelogs, etc). But create the file(s) however you want. In the file, stick something like:
HASH=123ABC
or
VERSION=v1.2.3
or whatever other information you want.
In the makefile:
include version.txt
or whatever you called it.
You will end up with a variable called VERSION just as if you'd defined it in the makefile.
You can then tell the compiler to define a symbol and set it to whatever you want, just like a #define. Or generate a header file if you really want to.
The point of this is that it's EASY to get arbitrary information into the makefile, and to somehow pass that along to the compiler. It's way clunkier to get information from your source code and pass it to the makefile.
One more thing I'll warn you about. You can just append the version name to the hex file, BUT it will eventually cause problems in the long run. When your version changes, make will have no idea that there USED to be a FILE_VERSION1.hex, and it will just get leftover. You should create a rule that does something like (using ejeffrey's example for reference):
$(BASENAME)_$(VERSION):
make clean
touch $(BASENAME)_$(VERSION):
This is just using an empty file to track the idea that the thing you're building now is different than the thing you build last time. There are other ways to handle this, but if you're project's not big and/or you're not changing versions all the time, this sledgehammer approach is really simple.
Depending on what else your doing, there may be other cleanup to do as well. Just giving you a heads up if you want your makefile to be squeaky clean.
One last thing I'll recommend. If you're going to work in Windows, and I generally work in Windows, use MSYS2. We've standardized on doing all of our builds/scripts/etc, as much as humanly possible, with tools like bash and all the other included tools. It's hard to imagine going back to using things like cmd and powershell.