I have makefile(.mke)
on Windows and I need to count directories in a folder which start with "Install" and then make
if clause to throw an exception
if there are more than one directory like this.
For example:
Files: Install.1.0, Install.2.0, Install.3.0..
I have $(SrcRoot)
variable and I need to count directories in this folder then make if clause that "if (numberOfDirs > 1) throw an error.
"
In my example there would be an exception because there are 3 Install.. folders.
If by "throw an exception" you mean abort Make with an error message, this will do it:
INSTALLS := $(wildcard $(SrcRoot)/Install*)
ifneq (,$(word 2,$(INSTALLS)))
$(error there are too many Install directories)
endif