我想設置基於是否不平行版本是使一些變量,所以我嘗試這樣做:我能否告訴如果在Makefile中使用了--jobs?
jobs:
»·echo "executing jobs job"
ifneq (,$(findstring -j,$(MAKEFLAGS)))
»·$(warning "parallel!")
else
»·$(warning "not parallel!")
endif
這是發生了什麼:
$ make -j2
Makefile:2: "not parallel!"
echo "executing jobs job"
executing jobs job
我也試過測試$(JOBS)
,但沒有運氣。
有沒有辦法讓我告訴Makefile裏面的--jobs參數被使用?
附加信息:
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
出於好奇,你爲什麼想要知道這一點? –
構建當前做了一些漂亮的調試日誌記錄,並行執行時會中斷。我想根據構建是否並行完成來啓用/禁用此調試信息。例如。而不是'$(warning)',我會設置'enable-debug = 1'或'enable-debug = 0'。 – onionjake
現在我很好奇你的漂亮調試日誌以及它如何中斷。另外如果你已經看到了make 3.82和4.0中的新輸出同步的東西。 –