V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
EchoChan

windows 下 make 命令如何执行多个命令

  •  
  •   EchoChan · Aug 29, 2016 · 4626 views
    This topic created in 3532 days ago, the information mentioned may be changed or developed.

    工具用的是 GnuWin32 的 make 工具。 makefile 如下:

    .PHONY: all
    all:
    	(make css & make js & make server & wait)
    
    .PHONY: css
    css:
    	postcss --watch --use autoprefixer --use postcss-import css/app.css --output bundle/app.css
    
    .PHONY: js
    js:
    	babel --watch js/app.jsx --out-file build/app.js
    
    .PHONY: server
    server:
    	browser-sync start --server --files='index.html,bundle/app.css,build/app.js'
    
    .PHONY: clean
    clean:
    	rm -r bundle build
    

    单独执行 make css 、 make js 、 make server 都没问题。 但执行 make all 就只执行带一条命令 make css 而已,也没有错误提示,求解缘由。

    5 replies    2016-08-29 17:02:37 +08:00
    ik0r
        1
    ik0r  
       Aug 29, 2016
    ```
    all: css js server clean

    css:
    postcss --watch --use autoprefixer --use postcss-import css/app.css --output bundle/app.css

    js:
    babel --watch js/app.jsx --out-file build/app.js

    server:
    browser-sync start --server --files='index.html,bundle/app.css,build/app.js'

    clean:
    rm -r bundle build

    .PHONY: all css js server clean
    ```
    TerrenceSun
        2
    TerrenceSun  
       Aug 29, 2016
    另外,非要在调用一次 make 的话,要用$(make)而不是 make
    TerrenceSun
        3
    TerrenceSun  
       Aug 29, 2016
    还可以试一下 make css js server 会出什么情况
    EchoChan
        4
    EchoChan  
    OP
       Aug 29, 2016
    @Jeremial 同样的问题。

    不知道是不是因为在 windows 上的缘故。
    ik0r
        5
    ik0r  
       Aug 29, 2016
    @EchoChan 问题可能出在 --watch 上.
    看这个选项, 应该是一个监听程序, 所以它不会退出, 后面的程序自然就不会执行了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2572 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 06:09 · PVG 14:09 · LAX 23:09 · JFK 02:09
    ♥ Do have faith in what you're doing.