makefile

what does "make check" do?


I wonder in the installation process of configure, make, make check and make install, what does make check do? Thanks!


Solution

  • Strictly speaking, it doesn't necessarily do anything.

    If a Makefile has a target named check, then make check will "build" that target. It's typically a phony target, meaning that it is a make-scripted command rather than a file named "check" that gets created.

    The gnu project advises that all GNU software should include a set of 20 standard targets (source: https://www.gnu.org/software/make/manual/html_node/Standard-Targets.html).

    The check target (which is run by typing make check) is one of those standard targets and is in the above source defined as:

    check Perform self-tests (if any). The user must build the program before running the tests, but need not install the program; you should write the self-tests so that they work when the program is built but not installed.

    Other projects (not part of GNU) will sometimes follow this convention as well, or at least implement a subset of these targets.