Suppose you have a Makefile somewhere; when you run make, you see some error message poping up so it stops. Now you are stuck in the middle of a make process, which means you have some environment set up but not destroyed properly (e.g., you have an image mounted but not unmounted since your makefile stopped in the middle). What should you do in this case?
I have made a dummy Makefile to mimic this scenario. In the following Makefile, the normal target is the process users want to build. Whenever the normal target has failed, the error target will be built.
Also notice that we have used --no-print-directory option to hide some directory details. The result looks like the following. Notice that the error target has been referenced since the normal target has failed.
If we comment out the line
#cd folder_not_exist && cd ..
We will see the following result. Note that the error target has not been built in this case.