How to catch and handle errors in Make?

I am using GNU Make 3.80.

In my Makefile_1, I call Makefile_2. In certain circumstances, Makefile_2 throws an error.

Is there a way for me to “catch” and “process” (inside Makefile_1) the error that Makefile_2 can make?

+3
source share
1 answer

You have all the shell features:

target1:
    ${MAKE} -f Makefile_2 target2; \
    case "$$?" in \
    ... \
    esac;
+5
source

Source: https://habr.com/ru/post/1785521/


All Articles