3 ms·
I like your watch target. I implemented something similar [0] with watch (bash builtin or GNU watch) & time. start_ci: watch time -p make clean all & e
by oso2k 12y ago
I like your watch target. I implemented something similar [0] with watch (bash builtin or GNU watch) & time.
start_ci:
watch time -p make clean all & echo $$! > tmp.ci.pid
stop_ci:
kill -9 `cat tmp.ci.pid`
Then you can start continuous integration by doing
make start_ci
Then you can stop continuous integration by doing
make stop_ci
Obviously, this is inspired by rc.d scripts.
[0] https://github.com/lpsantil/rt0/blob/master/Makefile#L117 https://github.com/lpsantil/rt0/blob/master/Makefile#L117
- harry8 12y agoaside: Please no `backticks` $(cat tmp.ci.pid) is standard and never worse than backticks. Indifferent in your example but frequently it's vastly safer. backticks need to be deprecated.
- shabble 12y agowhilst this is good advice for shell scripting, are you sure it applies as worded to the snippet you're replying to, given how Make uses $() itself for variable referencing?[1] $$() might work, but untested. [1] https://www.gnu.org/software/make/manual/html_node/Reference.html#Reference https://www.gnu.org/software/make/manual/html_node/Reference...
- harry8 12y agoyes, absolutely $$() works in a makefile. Backticks just need to die.
- untothebreach 12y agoyea, at least with GNU Make it is probably best to use $(shell cat tmp.ci.pid)
- oso2k 12y agoHaha. Good catch, I actually use $(shell cat tmp.ci.pid) to capture the PID in a var $(TMPCI) if you look at the actual Makefile I linked.