Computing Makefile variable on assignment

前端 未结 2 1192
温柔的废话
温柔的废话 2021-02-07 04:30

In a Makefile, I\'m trying to assign the result of a shell command to a variable:

TMP=`mktemp -d /tmp/.XXXXX`

all:
    echo $(TMP)
    echo $(TMP)
2条回答
  •  借酒劲吻你
    2021-02-07 04:58

    If you’re using GNU Make, instead of using backticks, use $(shell ...). For example,

    TMP=$(shell mktemp -d /tmp/.XXXXX)
    

提交回复
热议问题