I had to kick myself for writing this bug into a Makefile today. I am writing it down so that I remember to use &&
, and not ;
next time.
The Makefile had this target in it:
|
|
The problem here is that the statement cd folder; make clean
counts as one “line”, and make
won’t notice a problem (and stop) until that line has executed and returns non-zero.
Unfortunately, in the case that the directory does not exist, this script had a chance to call make clean
without changing directory. It then calls itself and becoming stuck in an infinite loop.
So lesson learned, this is why Makefiles should be littered with the “and” operator.
|
|