作者gecer (gecer)
看板Programming
標題Re: [問題] makefile語法疑問
時間Wed Nov 30 20:57:08 2022
小弟試著更改makefile內容
===============================================================================
source:=folder1_%\
folder2_%\
$(source)
@echo $@
===============================================================================
指令make folder1_01
folder01_01
指令make folder2__01
folder02_01
但是如果增加一個沒有%的target pattern
===============================================================================
source:=sim\
folder1_%\
folder2_%\
$(source)
@echo $@
===============================================================================
指令make sim
mixed implicit and normal rules: deprecated syntax
sim
指令make folder1_01
mixed implicit and normal rules: deprecated syntax
No rule to make target 'folder1_01'. Stop.
似乎增加一個normal target pattern會影響到含% target pattern的match
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.143.209.106 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Programming/M.1669813030.A.1FD.html
1F:推 LPH66: 所以你想要讓同一批指令給含 % 和不含 % 的123.194.181.180 12/01 19:50
2F:→ LPH66: 規則執行是嗎?123.194.181.180 12/01 19:50
3F:→ gecer: 對的220.143.209.106 12/02 08:01
4F:推 LPH66: 稍微搜了一下, 好像只能用巨集了, 如下123.194.181.180 12/06 19:41
6F:→ LPH66: 把同一批指令寫成巨集, 然後把所有規則分開123.194.181.180 12/06 19:42
7F:→ LPH66: 在每個規則中使用巨集定義指令123.194.181.180 12/06 19:43
8F:→ LPH66: 上面那個問題問的是同指令給多個 % 規則用123.194.181.180 12/06 19:43
9F:→ LPH66: 不過看起來因為 % 的處理規則的關係123.194.181.180 12/06 19:43
10F:→ LPH66: 要混一般目標的話應該也只能一起這樣用123.194.181.180 12/06 19:44