Make “make” default to “make -j 8”

前端 未结 8 1076
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 20:00

Is there a way that I can make

$ make

default to:

$ make -j 8

?

相关标签:
8条回答
  • 2020-12-28 20:29

    If you are using the command line you can do:

    alias make='make -j 8'
    

    This will be temporary, to make it permanent you need to add it to .bashrc

    Read here: http://www.linfo.org/make_alias_permanent.html

    0 讨论(0)
  • 2020-12-28 20:33

    If you're using GNU make:

    $ make --version
    GNU Make 4.2.1
    Built for x86_64-alpine-linux-musl
    

    ...then I found that GNUMAKEFLAGS seems to work:

    export GNUMAKEFLAGS=-j8
    make
    

    Disclaimer, I'm a n00b with the C toolchain so sorry if this isn't portable. It's working on Alpine Linux 3.8 (in Docker) though.

    0 讨论(0)
提交回复
热议问题