how to ask Make to only run one target after the end of another when using multicore

Asked

Viewed 18 times

0

UPDATED

When running make with the -j option to use multicore, that is to put each requesting target on a core, it does not respect the order and runs both simultaneously.

For example

make Object1 Object2 -j4

He will execute the Objeto1 and targets associated with it simultaneously Objeto2 and the targets associated with it, if for some reason one of the targets interferes with the product that will be used by the others in execution I will have a conflict.

At the moment what I have had as problem is connected to target clean, which sometimes wipes an object that was created.

The use of so-called sequences like make Objeto1 && make Objeto2 won’t let me take advantage of the feature for use of multiple processor colors, which would be the same thing as calling the make command without the key -j4, that would be the same as calling make Objeto1 Objeto2

1 answer

0

Run the make sequentially:

make -j4 clean; make -j4 all

Update:

You can do something like that:

all: clean real_all
    @echo ended all

clean:
    @echo cleaning...

real_all: target1 target2 ...
    @echo ended real_all

target1: ...
    ...
    @echo ended target1

target2: ...
    ...
    @echo ended target2

I think this gambiarra, I think better run sequentially as shown above.

  • Well maybe I wasn’t happy in the example, but the idea is that it’s just typing a make and internally managing the dependencies. I’ll elaborate on the question.

  • X, I tried to improve the explanation of the problem, Your proposal still does not solve my situation. I already have a target clean_all that cleans and compiles next.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.