1 |
|
---|
2 | kBuild Quick Reference
|
---|
3 | ======================
|
---|
4 |
|
---|
5 | This is an attempt at summarizing the magic of kBuild makefiles.
|
---|
6 |
|
---|
7 |
|
---|
8 | The anatomy of a kBuild Makefile
|
---|
9 | --------------------------------
|
---|
10 |
|
---|
11 | A typical template::
|
---|
12 |
|
---|
13 | # $Id: $
|
---|
14 | ## @file
|
---|
15 | # Makefile descriptions
|
---|
16 | #
|
---|
17 |
|
---|
18 | #
|
---|
19 | # Copyright (c) year
|
---|
20 | # License and other legal stuff.
|
---|
21 | #
|
---|
22 |
|
---|
23 | SUB_DEPTH = ../..
|
---|
24 | include $(KBUILD_PATH)/subheader.kmk
|
---|
25 |
|
---|
26 | #
|
---|
27 | # Global variables (optional).
|
---|
28 | #
|
---|
29 | MYPREFIX_SOMETHING = or another
|
---|
30 |
|
---|
31 | #
|
---|
32 | # Target lists.
|
---|
33 | #
|
---|
34 | DLLS += mydll
|
---|
35 | PROGRAMS += myprogs
|
---|
36 |
|
---|
37 | #
|
---|
38 | # mydll - description.
|
---|
39 | #
|
---|
40 | mydll_TEMPLATE = MYDLL
|
---|
41 | mydll_SOURCES = mydll.c
|
---|
42 | mydll_SOURCES.win = $(mydll_0_OUTDIR)/mydll.def
|
---|
43 |
|
---|
44 | #
|
---|
45 | # myprog - description.
|
---|
46 | #
|
---|
47 | myprog_TEMPLATE = MYPROG
|
---|
48 | myprog_SOURCES = myprog.c
|
---|
49 |
|
---|
50 | #
|
---|
51 | # Custom rules (optional of course).
|
---|
52 | #
|
---|
53 | $$(mydll_0_OUTDIR)/mydll.def:
|
---|
54 | $(APPEND) -t $@ LIBRARY mydll.dll
|
---|
55 | $(APPEND) $@ EXPORTS
|
---|
56 | $(APPEND) $@ ' myfunction'
|
---|
57 |
|
---|
58 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
59 |
|
---|
60 | #
|
---|
61 | # More optional rules.
|
---|
62 | #
|
---|
63 |
|
---|
64 | That's it.
|
---|
65 |
|
---|
66 |
|
---|
67 | Target lists
|
---|
68 | ------------
|
---|
69 |
|
---|
70 | The table gives the target lists in the typical pass order.
|
---|
71 |
|
---|
72 | +----------------------+-------------------------------------------------------+
|
---|
73 | | Name | Description |
|
---|
74 | +======================+=======================================================+
|
---|
75 | | ``BLDPROGS`` | Build programs, targets the host platform. |
|
---|
76 | +----------------------+-------------------------------------------------------+
|
---|
77 | | ``LIBRARIES`` | Libraries (not shared). |
|
---|
78 | +----------------------+-------------------------------------------------------+
|
---|
79 | | ``IMPORT_LIBS`` | Import libraries or stub shared libraries. |
|
---|
80 | +----------------------+-------------------------------------------------------+
|
---|
81 | | ``DLL`` | DLLs, Shared Libraries, DYLIBs, etc. |
|
---|
82 | +----------------------+-------------------------------------------------------+
|
---|
83 | | ``PROGRAMS`` | Executable programs. |
|
---|
84 | +----------------------+-------------------------------------------------------+
|
---|
85 | | ``SYSMODS`` | System modules (kexts, kernel modules, drivers, etc). |
|
---|
86 | +----------------------+-------------------------------------------------------+
|
---|
87 | | ``MISCBINS`` | Miscellanceous binaries like BIOS images and such. |
|
---|
88 | +----------------------+-------------------------------------------------------+
|
---|
89 | | ``OTHERS`` | List of targets made during the others pass. |
|
---|
90 | +----------------------+-------------------------------------------------------+
|
---|
91 | | ``INSTALLS`` | Things to install. [1]_ |
|
---|
92 | +----------------------+-------------------------------------------------------+
|
---|
93 | | ``FETCHES`` | Things to fetch. [1]_ |
|
---|
94 | +----------------------+-------------------------------------------------------+
|
---|
95 |
|
---|
96 |
|
---|
97 |
|
---|
98 | -----
|
---|
99 |
|
---|
100 | .. [1] Normally not one of the default passes.
|
---|
101 |
|
---|
102 | -----
|
---|
103 |
|
---|
104 | :Status: $Id$
|
---|
105 | :Copyright: Copyright (c) 2009 knut st. osmundsen
|
---|
106 |
|
---|