Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU make's -j option

Tags:

gnu-make

Ever since I learned about -j I've used -j8 blithely. The other day I was compiling an atlas installation and the make failed. Eventually I tracked it down to things being made out of order - and it worked fine once I went back to singlethreaded make. This makes me nervous. What sort of conditions do I need to watch for when writing my own make files to avoid doing something unexpected with make -j?

like image 737
pythonic metaphor Avatar asked Oct 14 '09 04:10

pythonic metaphor


People also ask

What is option in makefile?

Options include control over which components get generated, assigning customized names to makefiles, and others.

What is $( make in makefile?

And in your scenario, $MAKE is used in commands part (recipe) of makefile. It means whenever there is a change in dependency, make executes the command make --no-print-directory post-build in whichever directory you are on.


1 Answers

I think make -j will respect the dependencies you specify in your Makefile; i.e. if you specify that objA depends on objB and objC, then make won't start working on objA until objB and objC are complete.

Most likely your Makefile isn't specifying the necessary order of operations strictly enough, and it's just luck that it happens to work for you in the single-threaded case.

like image 184
Jeremy Friesner Avatar answered Sep 19 '22 14:09

Jeremy Friesner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!