criu/scripts/nmk/Documentation/nmk.txt
Cyrill Gorcunov d7016f1475 build: nmk -- Initial import
This is initial import of NMK engine which we gonna use for
CRIU and related tools building.

It's very tiny and while here we merge it as is in future
it gonna be rather a submodule from

	https://github.com/cyrillos/nmk

An idea is to have unified build engine for most tools
we're gonna use.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-15 15:32:20 +03:00

70 lines
1.8 KiB
Text

nmk(8)
======
NAME
----
nmk - a framework to minimize Makefile code needed for simple projects
SYNOPSIS
--------
*make* -f main.mk makefile=Makefile obj=<dir>
OVERVIEW
--------
Most of projects have similar source code structure:
* Toplevel 'Makefile'
* Source code itself in directory '<src>'
* Headers are gathered into directory '<include>'
so that building procedure is invoking *make* to read toplevel 'Makefile',
compile sources and link a final executable program. Taking this into account
*nmk* is trying to minimize efforts needed to write 'Makefile'.
USAGE
-----
First of all the *nmk* scripts are to be placed into some known place so the
*make* would be able to read them from a command line. Internally *nmk* uses
*__nmk_dir* variable to find own sources. Thus one can export
----------
export __nmk_dir=<directory>/
----------
in a makefile or do it via environment variables. Note the ending slash is mandatory.
As been mentioned earlier source code tree should include toplevel 'Makefile'
and source code in '<src>' directory. Source code '<src>' should provide own
'Makefile' (secondlevel) where files to be compiled are enumerated.
A typical source code tree will look like
----------
Makefile # toplevel Makefile
<scripts> # directory with nmk scripts
<src> # source code directory
Makefile # secondlevel Makefile
src1.c # source code
src2.c
...
----------
In toplevel 'Makefile' we should plug in *nmk* itself
----------
export __nmk_dir=scripts/
include $(__nmk_dir)include.mk
----------
In secondlevel 'Makefile' we should enumerate files to be compiled.
----------
obj-y += src1.o
obj-y += src2.o
...
----------
That is basically all one need to build a program.