tags:

views:

83

answers:

5

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
+4  A: 

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.

Brian Carlton
+6  A: 

Try the -i flag (a.k.a. --ignore_errors). Documentation here. 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)

Eli Bendersky
+1 -- the leading dash is what he seems to really want.
Jerry Coffin
A: 

Change your clean so rm will not complain:

clean:
    rm -f .lambda .lambda_t .activity .activity_t_lambda
Oded
A: 

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.

T.E.D.
A down vote with no comment? Classy.
Onion-Knight
I didn't want to say anything, but I was wondering what their thinking was too. If there's some reason I don't see why that flag would not be appropriate, it would be a good thing to bring up.
T.E.D.
A: 

Put a -f tag in you rm line.

rm -f .lambda .lambda_t .activity .activity_t_lambda
NebuSoft