ankit
ankit

Reputation: 77

use of PARALLEL in make

I have been working on makefiles and trying to reduce their compilation time. The structure of the my code consists of various sub directories each having its own makefile. The subdirectories in the main directory seem to be independent as whenever i run make in any of the subdirectories, it runs perfectly fine and shows no error. Thus, i want to run the sub-make for all subdirectories in parallel. Is it possible> and if yes, how?

Thank you in advance

Upvotes: 0

Views: 565

Answers (1)

Beta
Beta

Reputation: 99172

Here is a crude but effective method:

SUBDIRS = /something /something/else /another

.PHONY: $(SUBDIRS) all

all: $(SUBDIRS)

$(SUBDIRS):
    @$(MAKE) -s -C $@

Run this with make -j.

Upvotes: 2

Related Questions