source: trunk/kBuild/doc/QuickReference-kBuild.txt@ 3325

Last change on this file since 3325 was 2345, checked in by bird, 16 years ago

hacking property tables.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.9 KB
Line 
1
2kBuild Quick Reference
3======================
4
5This is an attempt at summarizing the magic of kBuild makefiles.
6
7
8The anatomy of a kBuild Makefile
9--------------------------------
10
11A typical makefile::
12
13 # $Id: QuickReference-kBuild.txt 2345 2009-04-19 23:47:42Z bird $
14 ## @file
15 # Makefile description.
16 #
17
18 #
19 # Copyright (c) year name
20 # License, disclaimer and other legal text.
21 #
22
23 SUB_DEPTH = ../..
24 include $(KBUILD_PATH)/subheader.kmk
25
26 #
27 # Include sub-makefiles.
28 #
29 include $(PATH_CURRENT)/subdir1/Makefile.kmk
30 include $(PATH_CURRENT)/subdir2/Makefile.kmk
31
32 #
33 # Global variables.
34 #
35 MYPREFIX_SOMETHING = or another
36
37 #
38 # Target lists.
39 #
40 DLLS += mydll
41 PROGRAMS += myprogs
42
43 #
44 # mydll - description.
45 #
46 mydll_TEMPLATE = MYDLL
47 mydll_SOURCES = mydll.c
48 mydll_SOURCES.win = $(mydll_0_OUTDIR)/mydll.def
49
50 #
51 # myprog - description.
52 #
53 myprog_TEMPLATE = MYPROG
54 myprog_SOURCES = myprog.c
55
56 #
57 # Custom rules (optional of course).
58 #
59 $$(mydll_0_OUTDIR)/mydll.def:
60 $(APPEND) -t $@ LIBRARY mydll.dll
61 $(APPEND) $@ EXPORTS
62 $(APPEND) $@ ' myfunction'
63
64 include $(FILE_KBUILD_SUB_FOOTER)
65
66
67Target lists
68------------
69
70+-+-------------------+-------------------------------------------------------+
71|#| Name | Description |
72+=+===================+=======================================================+
73|1| ``BLDPROGS`` | Build programs, targets the host platform. |
74+-+-------------------+-------------------------------------------------------+
75|2| ``LIBRARIES`` | Libraries (not shared). |
76+-+-------------------+-------------------------------------------------------+
77|3| ``IMPORT_LIBS`` | Import libraries or stub shared libraries. |
78+-+-------------------+-------------------------------------------------------+
79|4| ``DLLS`` | DLLs, Shared Libraries, DYLIBs, etc. |
80+-+-------------------+-------------------------------------------------------+
81|5| ``PROGRAMS`` | Executable programs. |
82+-+-------------------+-------------------------------------------------------+
83|6| ``SYSMODS`` | System modules (kexts, kernel modules, drivers, etc). |
84+-+-------------------+-------------------------------------------------------+
85|7| ``MISCBINS`` | Miscellanceous binaries like BIOS images and such. |
86+-+-------------------+-------------------------------------------------------+
87|8| ``INSTALLS`` | Things to install. [1]_ |
88+-+-------------------+-------------------------------------------------------+
89|9| ``FETCHES`` | Things to fetch. [1]_ |
90+-+-------------------+-------------------------------------------------------+
91|a| ``OTHERS`` | List of targets made during the others pass. |
92+-+-------------------+-------------------------------------------------------+
93
94
95Target properties
96-----------------
97
98The first column indicates the kind of property, S=Single, D=Deferred,
99Ar=Accumlate-Right and Al=Accumulate-Left.
100
101The third column should be cross referenced with the first column in the
102target list table above.
103
104+--+-------------------+-------+----------------------------------------------+
105|K | Name | Which | Description |
106+==+===================+=======+==============================================+
107|S | ``ARLIBSUFF`` | 2 | |
108+--+-------------------+-------+----------------------------------------------+
109|S | ``ARTOOL`` | 2 | |
110+--+-------------------+-------+----------------------------------------------+
111|S | ``ASOBJSUFF`` | 1-7 | |
112+--+-------------------+-------+----------------------------------------------+
113|S | ``ASTOOL`` | 1-7 | |
114+--+-------------------+-------+----------------------------------------------+
115|S | ``BINSUFF`` | 7 | |
116+--+-------------------+-------+----------------------------------------------+
117|S | ``BLD_TRG`` | 1-7 | |
118+--+-------------------+-------+----------------------------------------------+
119|S | ``BLD_TRG_ARCH`` | 1-7 | |
120+--+-------------------+-------+----------------------------------------------+
121|S | ``BLD_TRG_CPU`` | 1-7 | |
122+--+-------------------+-------+----------------------------------------------+
123|S | ``BLD_TYPE`` | 1-7 | |
124+--+-------------------+-------+----------------------------------------------+
125|S | ``COBJSUFF`` | 1-7 | |
126+--+-------------------+-------+----------------------------------------------+
127|S | ``CTOOL`` | 1-7 | |
128+--+-------------------+-------+----------------------------------------------+
129|S | ``CXXOBJSUFF`` | 1-7 | |
130+--+-------------------+-------+----------------------------------------------+
131|S | ``CXXTOOL`` | 1-7 | |
132+--+-------------------+-------+----------------------------------------------+
133|S | ``DLLSUFF`` | 34 | |
134+--+-------------------+-------+----------------------------------------------+
135|S | ``EXESUFF`` | 15 | |
136+--+-------------------+-------+----------------------------------------------+
137|S | ``FETCHDIR`` | 9 | |
138+--+-------------------+-------+----------------------------------------------+
139|S | ``FETCHTOOL`` | 9 | |
140+--+-------------------+-------+----------------------------------------------+
141|S | ``GID`` | 1-7 | |
142+--+-------------------+-------+----------------------------------------------+
143|S | ``INST`` | 1-9 | |
144+--+-------------------+-------+----------------------------------------------+
145|S | ``LDTOOL`` | 13-7 | |
146+--+-------------------+-------+----------------------------------------------+
147|S | ``LIBSUFF`` | 234 | |
148+--+-------------------+-------+----------------------------------------------+
149|S | ``MODE`` | 1-7 | |
150+--+-------------------+-------+----------------------------------------------+
151|S | ``NOINST`` | 1-8 | |
152+--+-------------------+-------+----------------------------------------------+
153|S | ``OBJCOBJSUFF`` | 1-7 | |
154+--+-------------------+-------+----------------------------------------------+
155|S | ``OBJCTOOL`` | 1-7 | |
156+--+-------------------+-------+----------------------------------------------+
157|S | ``OBJSUFF`` | 1-7 | |
158+--+-------------------+-------+----------------------------------------------+
159|S | ``PATCHTOOL`` | 9 | |
160+--+-------------------+-------+----------------------------------------------+
161|S | ``RCOBJSUFF`` | 1-7 | |
162+--+-------------------+-------+----------------------------------------------+
163|S | ``RCTOOL`` | 1-7 | |
164+--+-------------------+-------+----------------------------------------------+
165|S | ``SYSSUFF`` | 6 | |
166+--+-------------------+-------+----------------------------------------------+
167|S | ``TEMPLATE`` | 1-9 | |
168+--+-------------------+-------+----------------------------------------------+
169|S | ``TOOL`` | 1-9 | |
170+--+-------------------+-------+----------------------------------------------+
171|S | ``UID`` | 1-7 | |
172+--+-------------------+-------+----------------------------------------------+
173|S | ``UNPACKTOOL`` | 9 | |
174+--+-------------------+-------+----------------------------------------------+
175|D | ``INSTALLER`` | 1-8 | |
176+--+-------------------+-------+----------------------------------------------+
177|D | ``INSTFUN`` | 1-8 | |
178+--+-------------------+-------+----------------------------------------------+
179|D | ``NAME`` | 1-7 | |
180+--+-------------------+-------+----------------------------------------------+
181|D | ``POST_CMDS`` | 1-7 | |
182+--+-------------------+-------+----------------------------------------------+
183|D | ``PRE_CMDS`` | 1-7 | |
184+--+-------------------+-------+----------------------------------------------+
185|D | ``SONAME`` | 13-7 | |
186+--+-------------------+-------+----------------------------------------------+
187|Ar| ``ARFLAGS`` | 2 | |
188+--+-------------------+-------+----------------------------------------------+
189|Ar| ``ASDEFS`` | 1-7 | |
190+--+-------------------+-------+----------------------------------------------+
191|Ar| ``ASFLAGS`` | 1-7 | |
192+--+-------------------+-------+----------------------------------------------+
193|Ar| ``CDEFS`` | 1-7 | |
194+--+-------------------+-------+----------------------------------------------+
195|Ar| ``CFLAGS`` | 1-7 | |
196+--+-------------------+-------+----------------------------------------------+
197|Ar| ``CXXDEFS`` | 1-7 | |
198+--+-------------------+-------+----------------------------------------------+
199|Ar| ``CXXFLAGS`` | 1-7 | |
200+--+-------------------+-------+----------------------------------------------+
201|Ar| ``DEFS`` | 1-7 | |
202+--+-------------------+-------+----------------------------------------------+
203|Ar| ``DEPS`` | 1-8 | |
204+--+-------------------+-------+----------------------------------------------+
205|Ar| ``FETCHFLAGS`` | 9 | |
206+--+-------------------+-------+----------------------------------------------+
207|Ar| ``IDFLAGS`` | 1-7 | |
208+--+-------------------+-------+----------------------------------------------+
209|Ar| ``IFDLAGS`` | 1-7 | |
210+--+-------------------+-------+----------------------------------------------+
211|Ar| ``ISFLAGS`` | 1-7 | |
212+--+-------------------+-------+----------------------------------------------+
213|Ar| ``LDFLAGS`` | 13-7 | |
214+--+-------------------+-------+----------------------------------------------+
215|Ar| ``LNK_DEPS`` | 1-7 | |
216+--+-------------------+-------+----------------------------------------------+
217|Ar| ``LNK_ORDERDEPS`` | 1-7 | |
218+--+-------------------+-------+----------------------------------------------+
219|Ar| ``OBJCDEFS`` | 1-7 | |
220+--+-------------------+-------+----------------------------------------------+
221|Ar| ``OBJCFLAGS`` | 1-7 | |
222+--+-------------------+-------+----------------------------------------------+
223|Ar| ``ORDERDEPS`` | 1-8 | |
224+--+-------------------+-------+----------------------------------------------+
225|Ar| ``PATCHFLAGS`` | 9 | |
226+--+-------------------+-------+----------------------------------------------+
227|Ar| ``RCDEFS`` | 1-7 | |
228+--+-------------------+-------+----------------------------------------------+
229|Ar| ``RCFLAGS`` | 1-7 | |
230+--+-------------------+-------+----------------------------------------------+
231|Ar| ``UNPACKFLAGS`` | 9 | |
232+--+-------------------+-------+----------------------------------------------+
233|Al| ``ASINCS`` | 1-7 | |
234+--+-------------------+-------+----------------------------------------------+
235|Al| ``BLDDIRS`` | 1-7 | |
236+--+-------------------+-------+----------------------------------------------+
237|Al| ``CINCS`` | 1-7 | |
238+--+-------------------+-------+----------------------------------------------+
239|Al| ``CLEAN`` | 1-9 | |
240+--+-------------------+-------+----------------------------------------------+
241|Al| ``CXXINCS`` | 1-7 | |
242+--+-------------------+-------+----------------------------------------------+
243|Al| ``DIRS`` | 8 | |
244+--+-------------------+-------+----------------------------------------------+
245|Al| ``INCS`` | 1-7 | |
246+--+-------------------+-------+----------------------------------------------+
247|Al| ``INTERMEDIATES`` | 1-7 | |
248+--+-------------------+-------+----------------------------------------------+
249|Al| ``LIBPATH`` | 13-7 | |
250+--+-------------------+-------+----------------------------------------------+
251|Al| ``LIBS`` | 13-7 | |
252+--+-------------------+-------+----------------------------------------------+
253|Al| ``OBJCINCS`` | 1-7 | |
254+--+-------------------+-------+----------------------------------------------+
255|Al| ``RCINCS`` | 1-7 | |
256+--+-------------------+-------+----------------------------------------------+
257|Al| ``SDKS`` | 1-7 | |
258+--+-------------------+-------+----------------------------------------------+
259|Al| ``SOURCES`` | 1-9 | |
260+--+-------------------+-------+----------------------------------------------+
261|Al| ``SRC_HANDLERS`` | 1-7 | |
262+--+-------------------+-------+----------------------------------------------+
263|Al| ``USES`` | 1-7 | |
264+--+-------------------+-------+----------------------------------------------+
265
266
267-----
268
269.. [1] Normally not one of the default passes.
270
271-----
272
273:Status: $Id: QuickReference-kBuild.txt 2345 2009-04-19 23:47:42Z bird $
274:Copyright: Copyright (c) 2009 knut st. osmundsen
275
276
Note: See TracBrowser for help on using the repository browser.