Generic makefiles for C/C++ projects.
Author: Michal Wojcikowski <firstname.lastname@example.org>
0. For impatient users
There are short examples, see "examples" directory.
1. Quick installation
Wheater you're installing Kelpie, or you're using it already, there is one
thing in common - you need to define a few environment variables to make it
work in your environment.
But if you accept defaults (/usr/local/lib, etc), when you only want to
compile for your own host, and install to system directories - you can provide
no customization at all - and you can skip the next parts about normal/full
In any way, when compiling ANY project of your own, wheater you'd be using
Kelpie, other makefile set, or rolling out your own, I'd STRONGLY recommend
going with non-root compilation and installation - that means installing NOT
to /usr/..., but to some directory in your $HOME, that you can easily delete
whenever you feel like it.
In all cases, installation is being made with:
> [sudo] make install
2. Basic installation
Cross compilation, or installation on non-root environment will require just
a bit of information to be passed to Kelpie.
"CROSS_ROOT" variable is needed to install Kelpie makefiles.
"kpToolsRoot" variable should be set, but it can also be taken from
customization sub-makefile (see: 5. Customizations). It allows to correctly
install helper scripts that are used by Kelpie.
3. Full installation
You need to provide a sub-makefile, that Kelpie will be including.
The file name and location should be:
You can put all the necessary configuration in that file (see docs/ directory
for what can be configured).
Installation Makefile will use this sub-makefile, and might find out the value
of "kpToolsRoot" that way.
4. Basic usage
When compiling a library or an executable, you need to write your own, short
makefile, set a few variables, and include "kpmake/inc.mk". A standard set of
needed variables is decribed below.
"CROSS_ROOT" variable is needed as before. "TARGET_ROOT" and "kpToolsRoot"
variables may be set. Each one defaults to $(CROSS_ROOT). For more info, see
Next, you need to specify what you want to build
Next, you need to specify where are the sources and headers. For headers, you
can also specify the exact root path, from which the installation should start
recursively (see: docs/kelpieMake-sources.txt).
Next, dependencies are to be specified, direct libraries (-lsomething) and
At the end, you need to include kpmake/inc.mk file:
+ include $(CROSS_ROOT)/usr/local/include/kpmake/inc.mk
After that, you might add anything you want, but some things, like sources,
headers, products, adding new targets (see: docs/kelpieMake-targets.txt),
modifying flags, and the like, you won't be able to change after inclusion
of "inc.mk", so it's safer to specify them at the beginning.
5. Customizations in "external.mk"
This file should provide adaption from you environment/toolchain/etc. to
variables understood by Kelpie, so that you won't have to specify them in
all the makefiles in each of your library/executable.
Most common things are:
You might add some commonly used CPPFLAGS/CFLAGS/CXXFLAGS/LDFLAGS here.
Any other things (e.g. some extra targets) are also allowed, of course.
See "examples" directory for simple to advanced usage.
For reference, see "docs" directory.
If you're having any problems, write to the author :)