The command $ make all
gives errors such as rm: cannot remove '.lambda': No such file or directory
so it stops. I want it to ignore the rm-not-found-errors. How can I force-make?
Makefile
all:
make clean
make .lambda
make .lambda_t
make .activity
make .activity_t_lambda
clean:
rm .lambda .lambda_t .activity .activity_t_lambda
.lambda:
awk '{printf "%.4f \n", log(2)/log(2.71828183)/$$1}' t_year > .lambda
.lambda_t:
paste .lambda t_year > .lambda_t
.activity:
awk '{printf "%.4f \n", $$1*2.71828183^(-$$1*$$2)}' .lambda_t > .activity
.activity_t_lambda:
paste .activity t_year .lambda | sed -e 's@\t@\t\&\t@g' -e 's@$$@\t\\\\@g' | tee > .activity_t_lambda > ../RESULTS/currentActivity.tex
This question is related to
makefile
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.
Put an -f
option in your rm
command.
rm -f .lambda .lambda_t .activity .activity_t_lambda
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.
Change your clean
so rm
will not complain:
clean:
rm -f .lambda .lambda_t .activity .activity_t_lambda
Return successfully by blocking rm
's returncode behind a pipe with the true
command, which always returns 0
(success)
rm file | true
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.
Source: Stackoverflow.com