makefile - Make doesn't finish when run with entr -
i'm trying use entr recompile change c file following command:
$ echo ex8.c | entr make ex8 && ./ex8
when run cc
output nothing happends
$ echo ex8.c | entr make ex8 && ./ex8 cc -wall -g ex8.c -o ex8
if write manually works great
$ make ex8 && ./ex8
how should write entr work?
the man page wasn't quite detailed enough, installed , tried it. note command 3 distinct shell commands: echo ex8.c
, entr make ex8
, , ./ex8
. these connected pipe (the first two) , &&
operator (the final two). 2 commands in pipeline both started in parallel. final command not invoked until pipeline completes, if exit code success run.
this means final command ./ex8
not started until after entr make ex8
command finishes. but, entr
not exit after runs make 1 time: entire point continue watch source file , run make every time changes. that's why final command never invoked: entr
never exits.
there multiple ways fix simplest way add rule makefile build and run command, call make; add makefile:
.phony: run-ex8 run-ex8: ex8 ./$<
now use entr
this:
echo ex8.c | entr make run-ex8
Comments
Post a Comment