运行多个进程(多个监视命令)

时间:2012-08-20 23:15:03

标签: makefile

我正在尝试创建一个执行多个命令的Makefile。例如:

script:
  cat scripts/*.js > public/scripts/scripts.js

vendor:
  cat vendor/*.js > public/scripts/vendor.js

watchStyles:
  stylus -w -u nib styles/styles.styl -o public/styles

watchScripts:
  watchr -e "watch('scripts/.*\.js') {system 'make scripts'}"

watchVendor:
  watchr -e "watch('vendor/.*\.js') {system 'make vendor'}"

现在我必须打开3个终端,这很烦人。如何通过make watch只运行一个?

watch: watchStyles watchScripts watchVendor

1 个答案:

答案 0 :(得分:7)

如果你正在使用GNU make,那么-j option allows it to build targets in parallel,例如:

make -j4 watchStyles watchScripts watchVendor