條件賦值有兩種方法
測試範例
testA = GOOD
testB = GOOD
test1 = morning!
test1 ?= afternoon!
test2 ?= afternoon!
testA += ${test1}
testB += ${test2}
test:
@echo "testA = ${testA}"
@echo "testB = ${testB}"
@echo "test1 = ${test1}"
@echo "test2 = ${test2}"
輸出:
testA = GOOD morning!
testB = GOOD afternoon!
test1 = morning!
test2 = afternoon!
我們測試另一個範例,這跟明天要講的有關
我們將 testB 的賦值由 GOOD 改成了 ${test}
testA = GOOD
testB = ${testA}
test1 = morning!
test1 ?= afternoon!
test2 ?= afternoon!
testA += ${test1}
testB += ${test2}
test:
@echo "testA = ${testA}"
@echo "testB = ${testB}"
輸出:
testA = GOOD morning!
testB = GOOD morning! afternoon!
輸出的 testB 卻變了 GOOD morning! afternoon!
這跟 Verilog 道理有點像, 明天在講解