what does “make check” do?

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 make … Read more

why “make” before “make install”

When you run make, you’re instructing it to essentially follow a set of build steps for a particular target. When make is called with no parameters, it runs the first target, which usually simply compiles the project. make install maps to the install target, which usually does nothing more than copy binaries into their destinations. … Read more

Common GNU makefile directory path

You should be able to use the MAKEFILE_LIST variable, like this: # This must be the first line in Makefile.common TOP := $(dir $(firstword $(MAKEFILE_LIST))) From the documentation: As make reads various makefiles, including any obtained from the MAKEFILES variable, the command line, the default files, or from include directives, their names will be automatically … Read more

makefile: how to add a prefix to the basename?

Look at Make’s addsuffix function. Here is an example we use with `addsuffix` to place obj files one directory below the source. SOURCE += MainThread.cpp SOURCE += Blah.cpp OBJ=$(join $(addsuffix ../obj/, $(dir $(SOURCE))), $(notdir $(SOURCE:.cpp=.o))) From the make manual: $(addprefix prefix,names…) The argument names is regarded as a series of names, separated by whitespace; prefix … Read more