For instance, an error L6220E would be generated during the compilation (since I am using the ARM compiler, this error flag means out of internal flash memory). What I want to do is to continue the compilation even though the error was generated. Is there any way I can catch the command error and run other commands? Like,
normal_target:
gcc -o main main.c (this will generate error)
ifeq($(error),L6220E):
gcc -o ...
Is there any way to do so?
You can prefix any command with a -
to indicate to make
that this command is okay to fail:
normal_target:
-gcc -o main main.c
next command here
Another way would be to simply test for failure in the commands:
normal_target:
if gcc -o main main.c; then \
echo succeeded; \
else \
echo compilation failed; \
gcc -o ...; \
fi
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