How to assign the output of a command to a Makefile variable

后端 未结 7 1146
生来不讨喜
生来不讨喜 2020-12-02 05:11

I need to execute some make rules conditionally, only if the Python installed is greater than a certain version (say 2.5).

I thought I could do something like execut

7条回答
  •  误落风尘
    2020-12-02 05:37

    Use the Make shell builtin like in MY_VAR=$(shell echo whatever)

    me@Zack:~$make
    MY_VAR IS whatever
    

    me@Zack:~$ cat Makefile 
    MY_VAR := $(shell echo whatever)
    
    all:
        @echo MY_VAR IS $(MY_VAR)
    

提交回复
热议问题