To ignore errors in a recipe line, write a ' - ' at the beginning of the line's text (after the initial tab). The ' - ' is discarded before the line is passed to the shell for execution.
The make command uses information from a description file, which you create, to build a file containing the completed program, which is then called a target file. The internal rules for the make command are located in a file that looks like a description file.
When you type make or make [target] , the Make will look through your current directory for a Makefile. This file must be called makefile or Makefile . Make will then look for the corresponding target in the makefile. If you don't provide a target, Make will just run the first target it finds.
If you want to inhibit the display of commands during a particular make run, you can use the -s option. If you want to inhibit the display of all command lines in every run, add the special target . SILENT to your makefile .
Try the -i
flag (or --ignore-errors
). The documentation seems to suggest a more robust way to achieve this, by the way:
To ignore errors in a command line, write a
-
at the beginning of the line's text (after the initial tab). The-
is discarded before the command is passed to the shell for execution.For example,
clean: -rm -f *.o
This causes
rm
to continue even if it is unable to remove a file.
All examples are with rm
, but are applicable to any other command you need to ignore errors from (i.e. mkdir
).
make -k
(or --keep-going
on gnumake) will do what you are asking for, I think.
You really ought to find the del or rm line that is failing and add a -f
to it to keep that error from happening to others though.
Return successfully by blocking rm
's returncode behind a pipe with the true
command, which always returns 0
(success)
rm file || true
Change clean to
rm -f .lambda .lambda_t .activity .activity_t_lambda
I.e. don't prompt for remove; don't complain if file doesn't exist.
To get make to actually ignore errors on a single line, you can simply suffix it with ; true
, setting the return value to 0. For example:
rm .lambda .lambda_t .activity .activity_t_lambda 2>/dev/null; true
This will redirect stderr output to null, and follow the command with true (which always returns 0, causing make to believe the command succeeded regardless of what actually happened), allowing program flow to continue.
Put an -f
option in your rm
command.
rm -f .lambda .lambda_t .activity .activity_t_lambda
Change your clean
so rm
will not complain:
clean:
rm -f .lambda .lambda_t .activity .activity_t_lambda
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With