想象我有这样的:是否支持这种流程?
PROJECT1 := /path/to/first
PROJECT2 := /path/to/second
PROJECT3 := /path/to/third
我做一个查找从里面他们收集所有c,cpp,h
文件。我有类似:
PROJECT1_CPP := $(shell find $(PROJECT1) -name "*.cpp" -type "f")
PROJECT1_C := ... (the same happens for PROJECT2 and PROJECT3)
现在,我可以添加目标为他们每个人都喜欢:
project1.lib: $(PROJECT1_OBJS)
...
project2.lib: $(PROJECT2_OBJS)
...
project3.lib: $(PROJECT3_OBJS)
...
这种方法的事情是:有很多的重复代码(所有的动作为所有的构建几乎相同)。我希望能够做一些更通用的,如:
PROJECTS := /path/to/first
PROJECTS += /path/to/second
PROJECTS += /path/to/third
然后以某种方式遍历它们并构建它们。事情是这样的伪代码:
foreach project in PROJECTS
gather C/C++ files
build them
link them
link everything together
你能不能给我任何指标,让我应该开始?在Make中这甚至可能吗?
所有这些都可以完成,但是您想保留不同的'projectX.lib'吗?或者只是一个'final.lib'? –
现在不同的库。我可以将它们组合成一个单一的。 – Geo