2015-10-20 45 views
2

如何计算目录我已经在Windows makefile(.mke),我需要算一个文件夹的目录与“安装”开始,然后make如果子句抛出exception如果有这样一个以上的目录。make文件

例如:

Files: Install.1.0, Install.2.0, Install.3.0.. 

我有$(SrcRoot)变量,我需要计算该文件夹中的目录,然后做出是否子句“if (numberOfDirs > 1) throw an error.

在我的例子会有一个例外,因为有3个安装..文件夹。

回答

2

如果“抛出一个异常”你的意思是放弃一个错误消息让,这将做到这一点:

INSTALLS := $(wildcard $(SrcRoot)/Install*) 

ifneq (,$(word 2,$(INSTALLS))) 
$(error there are too many Install directories) 
endif 
+0

非常感谢您! –