我希望修改这个 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
致:
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
很遗憾第二个方法无效(节点进程仍然使用默认的 NODE_ENV
)。
我错过了什么?
Makefile
变量之间的误解。证明环境变量已设置的最佳方法是在另一个make
将调用的程序中查询此环境变量。仅执行echo $(BLAH)
只是在Makefile内部评估Makefile的键/值机制。在Python中,您可以使用print(os.getenv("MURDOC"))
来真正查询环境变量。 - daparic