相关疑难解决方法(0)

如何在Makefile中设置子进程的环境变量

我想更改这个Makefile:

SHELL := /bin/bash
PATH  := node_modules/.bin:$(PATH)

boot:
    @supervisor         \
      --harmony         \
      --watch etc,lib       \
      --extensions js,json      \
      --no-restart-on error     \
        lib

test:
    NODE_ENV=test mocha         \
      --harmony             \
      --reporter spec       \
        test

clean:
    @rm -rf node_modules

.PHONY: test clean
Run Code Online (Sandbox Code Playgroud)

至:

SHELL := /bin/bash
PATH  := node_modules/.bin:$(PATH)

boot:
    @supervisor         \
      --harmony         \
      --watch etc,lib       \
      --extensions js,json      \
      --no-restart-on error     \
        lib

test: NODE_ENV=test
test:
    mocha                   \
      --harmony             \
      --reporter spec       \
        test

clean:
    @rm -rf node_modules

.PHONY: test clean
Run Code Online (Sandbox Code Playgroud)

不幸的是,第二个不起作用(节点进程仍以默认值运行) …

shell makefile environment-variables target

109
推荐指数
3
解决办法
15万
查看次数

标签 统计

environment-variables ×1

makefile ×1

shell ×1

target ×1