# __ __ _ ____ _ __ __
# | \/ | __ _| | _____ / ___|| |_ _ _ / _|/ _|
# | |\/| |/ _` | |/ / _ \ \___ \| __| | | | |_| |_
# | | | | (_| | < __/ ___) | |_| |_| | _| _|
# |_| |_|\__,_|_|\_\___| |____/ \__|\__,_|_| |_|
#
I could, and probably should, take the time to share a some historical information regarding how what is
generally referred to as “the build system” came into existence. Why it came into the sequence in which it
is, how it became adopted, and how it became nearly universal. I am sure, one way or another, Dennis Ritchie
had something to do with it when he ported his new language, C++
, to unix. Instead, we are going to just
dive into it.
The standard make system has three main parts.
Sometimes, one must preconfigure before one can configuring, and often one wants to clean up after installation.
make
and it’s cousin, gnu make
, both accept a ridiculously plentiful amount of different flags. Way too
many flags than to even begin listing here. But there are a few you might want to be familiar with, as they
are used fairly often.
-k
= Tells make
to continue on with the build as long as the encountered error does not affect the
resulting target.-j(N)
= This one is almost always added. N represents the number of threads the user would like to use for
the build. This came into play after the creation of multi-core processors. Most often the flag is
represented like the following. make -j$(procnum)
Which tells make to use the same number of threads as
there are processors available.make
also accepts commands. Of these commands, install
and clean
are the standard for use.
make install
is used after make -j$(procnum)
, and tells make to install the target it just built.make clean
is used after make install
, and tells make to cleanup the build dir after the target is installed.make
good. You make, I make, we all CMAKE...
Yes, I know these jokes are terrible, but anyways… Cmake is a software development platform that provides several tools to aid developers in the building, testing, and automation of software. What is important to remember is that cmake is not a build system itself, it is a generator for build files and configurations that are then used by other build systems. Cmake is cross-platform and compiler independent. So, if you want to dumb all the above down to the intellectual level of a potato, CMAKE makes building easier and faster.
If you were to perform a standard build without the employment of cmake, because you wanted or needed to set local
system specific variables to be configured for the build or for the target. You would pass most of these variables to
the ./configure
command during the configuration process, but there are also circumstances when these
variables can be set during the make
process. Now, if you were to employ cmake, they are required to be
passed during the execution of the cmake
command. Like so:
cmake -DCMAKE_CXX_COMPILER="clang++" -DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_INSTALL_SYSCONFDIR="/etc" -DCMAKE_CXX_FLAGS="-I/usr/local/include" -DCMAKE_CXX_FLAGS="-I/usr/local/include/inotify" .
-
, and then the capital letter D
. No, I have no idea in this
world why each flags starts this way. What is important is knowing that it does.=
, and then the value contained in
matching double quotes "..."
.-I
represents.