【发布时间】:2020-12-08 09:43:33
【问题描述】:
使用nmake 我有以下makefile,它目前可以完成我需要它做的事情。 mycmd(正在运行的程序)将获取一个.inp 文件并生成一个.out 文件。我可以根据需要制作任意数量的.inp 文件,并且不需要更改makefile。它会找到它们并制作所有相关的.out 文件。
#####################################################################################
# A SUFFIXES declaration is required in order to later use the rule with target .inp.out
#####################################################################################
.SUFFIXES: .inp
#####################################################################################
# Here, NMAKE will expand *.inp in the prereq list for all, into the list of *.inp
# files in the directory, and then it will start a new NMAKE instance, specifying the
# goals to build all those files.
#####################################################################################
all: *.inp
$(MAKE) $(**:.inp=.out)
#####################################################################################
# $(*B) represents the current target's base name minus the path and the file extension
#####################################################################################
.inp.out:
mycmd -i $(*B).inp -o $(*B).out
我的问题是,如何进一步增强这个 makefile,以便我可以为一组 .inp 文件运行它,而不是 *.inp 而是说 ABC*.inp?
【问题讨论】: