(debian-policy.info)Error trapping in makefiles


Next: Time Stamps Prev: Copyright debian/copyright Up: Source packages
Enter node , (file) or (file)node

4.6 Error trapping in makefiles
===============================

When ‘make’ invokes a command in a makefile (including your package’s
upstream makefiles and ‘debian/rules’), it does so using ‘sh’.  This
means that ‘sh’’s usual bad error handling properties apply: if you
include a miniature script as one of the commands in your makefile
you’ll find that if you don’t do anything about it then errors are not
detected and ‘make’ will blithely continue after problems.

Every time you put more than one shell command (this includes using a
loop) in a makefile command you must make sure that errors are trapped.
For simple compound commands, such as changing directory and then
running a program, using ‘&&’ rather than semicolon as a command
separator is sufficient.  For more complex commands including most loops
and conditionals you should include a separate ‘set -e’ command at the
start of every makefile command that’s actually one of these miniature
shell scripts.


automatically generated by info2www version 1.2.2.9