定義錯誤狀態檢測功能在我makefile
我有如何在Makefile中
run_sh:
echo"run script";\
toolk -run -tcl sequence.tcl | tee ./log/catch.log;\
$(call chck "./log/catch.log")
我想從上面的日誌文件趕上error status=0
消息和檢查,如果不是「0」退出形式創建文件。所以我寫了這個函數並在我的目標run_sh中調用它。
define chck
log=$(1)
STAT=`cat $(1) | grep "exit status=0"`
ifneq ($(STAT),"exit status=0")
$(error error in script)
endif
endef
是正確的寫法,因爲我得到錯誤。
makefile應該退出,並且一旦我們沒有來自先前目標的消息「退出狀態= 0」,就不應該執行任何其他目標在日誌文件中運行。 – kunal