How to print out a variable in makefile

后端 未结 15 1059
臣服心动
臣服心动 2020-12-07 06:51

In my makefile, I have a variable \'NDK_PROJECT_PATH\', my question is how can I print it out when it compiles?

I read Make file echo displaying "$PATH" st

15条回答
  •  攒了一身酷
    2020-12-07 07:13

    If you don't want to modify the Makefile itself, you can use --eval to add a new target, and then execute the new target, e.g.

    make --eval='print-tests: @echo TESTS $(TESTS) ' print-tests

    You can insert the required TAB character in the command line using CTRL-V, TAB

    example Makefile from above:

    all: do-something
    
    TESTS=
    TESTS+='a'
    TESTS+='b'
    TESTS+='c'
    
    do-something:
            @echo "doing something"
            @echo "running tests $(TESTS)"
            @exit 1
    

提交回复
热议问题