GNU Make: Difference between revisions
No edit summary |
fix link to bash |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 19: | Line 19: | ||
** If <tt>svn:ignore</tt> is properly used, the following rule suffices as a project-independent <tt>clean</tt> target, assuming the presence of [[xmlstarlet]]:<pre>svn --xml --no-ignore status | xmlstarlet sel -t -m //entry -i "wc-status[@item='ignored']" -v @path -n | xargs rm -rf</pre> | ** If <tt>svn:ignore</tt> is properly used, the following rule suffices as a project-independent <tt>clean</tt> target, assuming the presence of [[xmlstarlet]]:<pre>svn --xml --no-ignore status | xmlstarlet sel -t -m //entry -i "wc-status[@item='ignored']" -v @path -n | xargs rm -rf</pre> | ||
==[[ | ==[[bash]] interactions== | ||
* [http://www.gnu.org/s/hello/manual/make/Choosing-the-Shell.html The shell to use] can be specified via $(SHELL). By default, <tt>/bin/sh</tt> is used | * [http://www.gnu.org/s/hello/manual/make/Choosing-the-Shell.html The shell to use] can be specified via $(SHELL). By default, <tt>/bin/sh</tt> is used | ||
** Unlike most variables, it cannot be inherited from the environment (except on Windows, where it is) | ** Unlike most variables, it cannot be inherited from the environment (except on Windows, where it is) | ||
| Line 25: | Line 25: | ||
* Arguments to the shell can be specified via <tt>.SHELLFLAGS</tt> | * Arguments to the shell can be specified via <tt>.SHELLFLAGS</tt> | ||
** By default, it's <tt>-c</tt>, or <tt>-ec</tt> in POSIX mode | ** By default, it's <tt>-c</tt>, or <tt>-ec</tt> in POSIX mode | ||
* Remember that errors in the body of a shell loop don't set the overall return value | * Remember that errors in the body of a shell loop don't set the overall return value: | ||
target: | <pre>target: | ||
while true ; do false ; done</pre> | |||
This recipe cannot be successfully completed! You can use<pre>target: | |||
set -e ; while true ; do false ; done</pre>or <pre>target: | |||
while true ; do false || exit ; done</pre> | |||
The former is probably nicer, since you can then use ; in the place of &&, but it deviates from expected gmake semantics. In general, you don't want to be doing this kind of thing anyway; it's useful for cases like running unit testing on a set of inputs, where outputs won't be generated. | |||