How do I write the 'cd' command in a makefile?

后端 未结 6 442
时光取名叫无心
时光取名叫无心 2020-11-29 14:53

For example, I have something like this in my makefile:

all:
     cd some_directory

But when I typed make I saw only \'cd some

6条回答
  •  一整个雨季
    2020-11-29 15:02

    What do you want it to do once it gets there? Each command is executed in a subshell, so the subshell changes directory, but the end result is that the next command is still in the current directory.

    With GNU make, you can do something like:

    BIN=/bin
    foo:
        $(shell cd $(BIN); ls)
    

提交回复
热议问题