Skip to content

Commit

Permalink
devel(makefile): helping development (#36)
Browse files Browse the repository at this point in the history
* devel(makefile): helping development

see `makefile` header for more information

* fix(makefile): improve `stop` target compatibility

now should work for `make>=4.2.1`
  • Loading branch information
andros21 authored and Paolo-Azzini committed Jun 25, 2022
1 parent 03eb2e0 commit 7cc8f65
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# makefile
# --------
# makefile for development, rules:
# + `animation` - create simple gif animation, useful to create
# rustracer usage examples (`ffmpeg` needed)
# + `docs` - preview `rustracer` documentation locally
# + `ccov` - preview `rustracer` code-coverage html report locally

animation: examples/demo

examples/demo:
@printf "[info] create demo gif animation ... "
@mkdir -p $@/frames
@for a in `seq 0 359`; do \
rustracer demo --width 320 --height 240 --angle-deg $$a $@/frames/frame-`printf '%03d' $$a`.png; done;
@ffmpeg -loglevel panic -f image2 -framerate 25 -i $@/frames/frame-%03d.png $@/demo.gif
@printf "done\n"

docs: docs.pid
ccov: ccov.pid

docs.pid:
@for f in `ls -1 target/doc/rustracer`; do ln -sf rustracer/$$f target/doc/$$f; done;
@printf "starting http.server ... "
@{ python3 -m http.server -b 127.0.0.1 -d target/doc/ 8080 >/dev/null 2>&1 \
& echo $$! >$@; }
@printf "done\n"
@printf "docs url: http://localhost:8080/\n"

ccov.pid:
@printf "starting http.server ... "
@{ python3 -m http.server -b 127.0.0.1 -d target/llvm-cov/html 8081 >/dev/null 2>&1 \
& echo $$! >$@; }
@printf "done\n"
@printf "ccov url: http://localhost:8081/\n"

stop: *.pid
@printf "stopping http.server ... "
@pkill -F docs.pid 2>/dev/null || exit 0
@pkill -F ccov.pid 2>/dev/null || exit 0
@rm $^
@printf "done\n"

0 comments on commit 7cc8f65

Please sign in to comment.