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