I've a make file which runs several of targets , now I want to add new target that will run after some timeout, how can I do it ?
e.g.
execbin: build start run
This is running ok, however I want to add new target called test which will run after two seconds (some timeout) , how can I do that ?
execbin: build start run test
test should execute after the run has finished and also wait 2 seconds before it start , is it possible ?
The lazy solution would be to add a new target called 'sleep-2', and a pattern rule do:
execbin: build start run sleep-2 test
sleep-%:
sleep $(@:sleep-%=%)
This creates a pattern rule that takes the value after the hyphen in a sleep-<> target, and uses it as the amount of time to sleep.
I will echo @MadScientists's answer that this probably will not work if you do
make -j, which really does require changing the targets to depend on each other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With