Parallel Make Output

后端 未结 6 420
一个人的身影
一个人的身影 2021-01-03 10:35

When running a CMake generated Makefile with multiple processes (make -jN), the output often gets messed up like this:

[  8%] [  8%] [  9%] Buil         


        
6条回答
  •  说谎
    说谎 (楼主)
    2021-01-03 10:50

    Here is a simple working example of using a wrapper for Make. I'm not sure if I'd encourage it's use, but it's an idea.

    # Makefile
    SHELL = /tmp/test/wrapper
    
    test: test1 test2
    
    test1:
        $(eval export TARGET=$@)
        env
    
    test2:
        $(eval export TARGET=$@)
        env
    

    and this:

    #!/usr/bin/env bash
    # wrapper
    bash $@ | sed -e "s/^/${TARGET} /"
    

提交回复
热议问题