In GNU Make, currently I am lowering the case of a drive letter using the following substitution.
$(eval _ABS_PATH=$(subst C:,c:,$(abspath $(DIRECTORY))))
How can I modify this such that I can have A-Z substitution to a-z for the drive letter?
Thanks!
I'm not sure why you're using eval here; why not just:
_ABS_PATH = $(subst C:,c:,$(abspath $(DIRECTORY)))
But, anyway, anytime you need to do something massively clever with string translations, etc. in GNU make there's a good bet that John Graham-Cumming has already done it for you. Check out his most excellent toolkit GMSL (GNU Make Standard Library) for many common functions. Included there is a variation of lc (lowercase). Rather than reproduce it here (along with the copyright notice as it's under a BSD license) you can go get a copy.
Once you have it you can do something like this if you want the entire path lowercased:
include gmsl
_ABS_PATH = $(call lc,$(abspath $(DIRECTORY)))
If you just want the drive letter to be lowercased but not the rest it's more complex, something like this should work:
include gmsl
_DRIVE = $(word 1,$(subst :, ,$(abspath $(DIRECTORY))))
_ABS_PATH = $(call lc,$(_DRIVE)):$(patsubst $(_DRIVE):%,%,$(abspath $(DIRECTORY)))
There may be simpler ways. Also if you're sure the value of DIRECTORY is already set you should consider using ":=" here instead of "=" as it will make things MUCH more efficient (especially if $(_ABS_PATH) is used a lot).