我有一個makefile。如何在生成文件規則中使用百分比字符
我需要在src1和src2下的源文件的C:/ bin /下建立一組目標。
讓他們的順序說,在生成文件
的某些部分$ {dest_dir將}/AO $ {dest_dir將}/BO $ {dest_dir將}/CO $ {dest_dir將} /做
要求
dest_dir將= C:/ bin中
SRC_DIR1 = C:/ SRC1
SRC_DIR2 = C:/ SRC2
,我已經爲他們的規則如下
#規則#1
$ {} dest_dir將/%○:。$ {} SRC_DIR1 /%C
#the command required to build the target
echo "Source: $< Target: [email protected] "
#rule #2
$ {dest_dir將} /%○:。$ {SRC_DIR2} /%C
#the command required to build the target
echo "Source: $< Target: [email protected] "
讓AC和BC是在SRC_DIR1和CC和特區是在SRC_DIR2
當我建立它建立精細要去規則a.o和B.O#1,那麼規則#2 c.o和d.o
我沒想到它會被罰款。因爲我期待它爲c.o的規則#1,並拋出一個錯誤,說「沒有規則,使目標c.c」。但它適用於規則#2,並從SRC_DIR2中的c.c構建c.o。
有人可以解釋我是如何工作的?在這種情況下,通配符字符%
是如何工作的以及規則匹配是如何發生的?
非常感謝Beta ..我明白了.. – tamizhan 2009-09-10 06:14:13