I want to run diff in a makefile and catch the output,
test:
diff a b > tmp
but diff returns non-zero if it catches any differences.
Make interprets the non-zero return code as an error, and even if I ignore the error using -diff, it still prints a warning.
makefile:7: recipe for target 'test' failed
make: [test] Error 1 (ignored)
Can I make it shut up?
You need to make sure your recipe returns 0 (success) even if the diff command doesn't. Something like:
test:
diff a b > tmp || true
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