File: nmk.txt

package info (click to toggle)
criu 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,500 kB
  • sloc: ansic: 139,280; python: 7,484; sh: 3,824; java: 2,799; makefile: 2,659; asm: 1,137; perl: 206; xml: 117; exp: 45
file content (70 lines) | stat: -rw-r--r-- 1,811 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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.