1

I have something like the following: 3 libs (libA, libB, libC), libB and libC depends on libA.

Is there anyway to parallel build libB and libC once libA finish building using make ?

John Sami
  • 13
  • 3
  • Possible duplicate of [make: Run several tasks in parallel and wait for completion](https://stackoverflow.com/questions/41452476/make-run-several-tasks-in-parallel-and-wait-for-completion) – FiringSquadWitness Jul 01 '19 at 00:54
  • Have a look at https://github.com/igagis/prorab . If you make your build system using `prorab` it will build `libB` and `libC` in parallel while those libs will still have their own independent `makefile`s. – igagis Jul 02 '19 at 14:39

1 Answers1

0

If your makefile looks like this:

all: libA libC libC

libA:
    ...

libB: libA
    ...

libC: libA
    ...

then just running make -j 4 will cause make to parallelize what it can across 4 processes.

you can even parallelize by default by doing this:

all:
    $(MAKE) -j $$(nproc) libA libB libC

libA:
    ...

libB: libA
    ...

libC: libA
    ...
root
  • 5,528
  • 1
  • 7
  • 15