6910b74ca533b3eeec06b12c4825b16bb0fbe06e
[dpdk.git] / doc / guides / prog_guide / dev_kit_root_make_help.rst
1 ..  BSD LICENSE
2     Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
3     All rights reserved.
4
5     Redistribution and use in source and binary forms, with or without
6     modification, are permitted provided that the following conditions
7     are met:
8
9     * Redistributions of source code must retain the above copyright
10     notice, this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright
12     notice, this list of conditions and the following disclaimer in
13     the documentation and/or other materials provided with the
14     distribution.
15     * Neither the name of Intel Corporation nor the names of its
16     contributors may be used to endorse or promote products derived
17     from this software without specific prior written permission.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 .. _Development_Kit_Root_Makefile_Help:
32
33 Development Kit Root Makefile Help
34 ==================================
35
36 The DPDK provides a root level Makefile with targets for configuration, building, cleaning, testing, installation and others.
37 These targets are explained in the following sections.
38
39 Configuration Targets
40 ---------------------
41
42 The configuration target requires the name of the target, which is specified using T=mytarget and it is mandatory.
43 The list of available targets are in $(RTE_SDK)/config (remove the defconfig _ prefix).
44
45 Configuration targets also support the specification of the name of the output directory, using O=mybuilddir.
46 This is an optional parameter, the default output directory is build.
47
48 *   Config
49
50     This will create a build directory, and generates a configuration from a template.
51     A Makefile is also created in the new build directory.
52
53     Example:
54
55     .. code-block:: console
56
57         make config O=mybuild T=x86_64-native-linuxapp-gcc
58
59 Build Targets
60 -------------
61
62 Build targets support the optional specification of the name of the output directory, using O=mybuilddir.
63 The default output directory is build.
64
65 *   all, build or just make
66
67     Build the DPDK in the output directory previously created by a make config.
68
69     Example:
70
71     .. code-block:: console
72
73         make O=mybuild
74
75 *   clean
76
77     Clean all objects created using make build.
78
79     Example:
80
81     .. code-block:: console
82
83         make clean O=mybuild
84
85 *   %_sub
86
87     Build a subdirectory only, without managing dependencies on other directories.
88
89     Example:
90
91     .. code-block:: console
92
93         make lib/librte_eal_sub O=mybuild
94
95 *   %_clean
96
97     Clean a subdirectory only.
98
99     Example:
100
101     .. code-block:: console
102
103         make lib/librte_eal_clean O=mybuild
104
105 Install Targets
106 ---------------
107
108 *   Install
109
110     Build the DPDK binary.
111     The name of the target to install is specified using T=mytarget.
112     The list of available targets are in $(RTE_SDK)/config (remove the defconfig\_ prefix).
113
114     Example:
115
116     .. code-block:: console
117
118         make install T=x86_64-native-linuxapp-gcc
119
120 Test Targets
121 ------------
122
123 *   test
124
125     Launch automatic tests for a build directory specified using O=mybuilddir.
126     It is optional, the default output directory is build.
127
128     Example:
129
130     .. code-block:: console
131
132         make test O=mybuild
133
134 Documentation Targets
135 ---------------------
136
137 *   doc
138
139     Generate the Doxygen documentation (API, html and pdf).
140
141 *   doc-api-html
142
143     Generate the Doxygen API documentation in html.
144
145 *   doc-guides-html
146
147     Generate the guides documentation in html.
148
149 *   doc-guides-pdf
150
151     Generate the guides documentation in pdf.
152
153
154 Deps Targets
155 ------------
156
157 *   depdirs
158
159     This target is implicitly called by make config.
160     Typically, there is no need for a user to call it,
161     except if DEPDIRS-y variables have been updated in Makefiles.
162     It will generate the file  $(RTE_OUTPUT)/.depdirs.
163
164     Example:
165
166     .. code-block:: console
167
168         make depdirs O=mybuild
169
170 *   depgraph
171
172     This command generates a dot graph of dependencies.
173     It can be displayed to debug circular dependency issues, or just to understand the dependencies.
174
175     Example:
176
177     .. code-block:: console
178
179         make depgraph O=mybuild > /tmp/graph.dot && dotty /tmp/ graph.dot
180
181 Misc Targets
182 ------------
183
184 *   help
185
186     Show this help.
187
188 Other Useful Command-line Variables
189 -----------------------------------
190
191 The following variables can be specified on the command line:
192
193 *   V=
194
195     Enable verbose build (show full compilation command line, and some intermediate commands).
196
197 *   D=
198
199     Enable dependency debugging. This provides some useful information about why a target is built or not.
200
201 *   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
202
203     Append specific compilation, link or asm flags.
204
205 *   CROSS=
206
207     Specify a cross toolchain header that will prefix all gcc/binutils applications. This only works when using gcc.
208
209 Make in a Build Directory
210 -------------------------
211
212 All targets described above are called from the SDK root $(RTE_SDK).
213 It is possible to run the same Makefile targets inside the build directory.
214 For instance, the following command:
215
216 .. code-block:: console
217
218     cd $(RTE_SDK)
219     make config O=mybuild T=x86_64-native-linuxapp-gcc
220     make O=mybuild
221
222 is equivalent to:
223
224 .. code-block:: console
225
226     cd $(RTE_SDK)
227     make config O=mybuild T=x86_64-native-linuxapp-gcc
228     cd mybuild
229
230     # no need to specify O= now
231     make
232
233 Compiling for Debug
234 -------------------
235
236 To compile the DPDK and sample applications with debugging information included and the optimization level set to 0,
237 the EXTRA_CFLAGS environment variable should be set before compiling as follows:
238
239 .. code-block:: console
240
241     export EXTRA_CFLAGS='-O0 -g'
242
243 The DPDK and any user or sample applications can then be compiled in the usual way.
244 For example:
245
246 .. code-block:: console
247
248     make install T=x86_64-native-linuxapp-gcc make -C examples/<theapp>