New upstream version 18.02
[deb_dpdk.git] / doc / guides / sample_app_ug / compiling.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2015 Intel Corporation.
3
4 Compiling the Sample Applications
5 =================================
6
7 This section explains how to compile the DPDK sample applications.
8
9 To compile all the sample applications
10 --------------------------------------
11
12
13 Set the path to DPDK source code if its not set:
14
15     .. code-block:: console
16
17         export RTE_SDK=/path/to/rte_sdk
18
19 Go to DPDK source:
20
21     .. code-block:: console
22
23         cd $RTE_SDK
24
25 Build DPDK:
26
27    .. code-block:: console
28
29         make defconfig
30         make
31
32 Build the sample applications:
33
34    .. code-block:: console
35
36        export RTE_TARGET=build
37        make -C examples
38
39 For other possible ``RTE_TARGET`` values and additional information on
40 compiling see
41 :ref:`Compiling DPDK on Linux <linux_gsg_compiling_dpdk>` or
42 :ref:`Compiling DPDK on FreeBSD <building_from_source>`.
43 Applications are output to: ``$RTE_SDK/examples/app-dir/build`` or
44 ``$RTE_SDK/examples/app-dir/$RTE_TARGET``.
45
46
47 In the example above the compiled application is written to the ``build`` subdirectory.
48 To have the applications written to a different location,
49 the ``O=/path/to/build/directory`` option may be specified in the make command.
50
51     .. code-block:: console
52
53        make O=/tmp
54
55 To build the applications for debugging use the ``DEBUG`` option.
56 This option adds some extra flags, disables compiler optimizations and
57 sets verbose output.
58
59     .. code-block:: console
60
61        make DEBUG=1
62
63
64 To compile a single application
65 -------------------------------
66
67 Set the path to DPDK source code:
68
69     .. code-block:: console
70
71         export RTE_SDK=/path/to/rte_sdk
72
73 Go to DPDK source:
74
75     .. code-block:: console
76
77        cd $RTE_SDK
78
79 Build DPDK:
80
81     .. code-block:: console
82
83         make defconfig
84         make
85
86 Go to the sample application directory. Unless otherwise specified the sample
87 applications are located in ``$RTE_SDK/examples/``.
88
89
90 Build the application:
91
92     .. code-block:: console
93
94         export RTE_TARGET=build
95         make