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

后端 未结 7 1136
生来不讨喜
生来不讨喜 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:41

    In the below example, I have stored the Makefile folder path to LOCAL_PKG_DIR and then use LOCAL_PKG_DIR variable in targets.

    Makefile:

    LOCAL_PKG_DIR := $(shell eval pwd)
    
    .PHONY: print
    print:
        @echo $(LOCAL_PKG_DIR)
    

    Terminal output:

    $ make print
    /home/amrit/folder
    

提交回复
热议问题