New upstream version 17.11-rc3
[deb_dpdk.git] / doc / guides / sample_app_ug / compiling.rst
1  ..  BSD LICENSE
2      Copyright(c) 2015 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 Compiling the Sample Applications
32 =================================
33
34 This section explains how to compile the DPDK sample applications.
35
36 To compile all the sample applications
37 --------------------------------------
38
39
40 Set the path to DPDK source code if its not set:
41
42     .. code-block:: console
43
44         export RTE_SDK=/path/to/rte_sdk
45
46 Go to DPDK source:
47
48     .. code-block:: console
49
50         cd $RTE_SDK
51
52 Build DPDK:
53
54    .. code-block:: console
55
56         make defconfig
57         make
58
59 Build the sample applications:
60
61    .. code-block:: console
62
63        export RTE_TARGET=build
64        make -C examples
65
66 For other possible ``RTE_TARGET`` values and additional information on
67 compiling see
68 :ref:`Compiling DPDK on Linux <linux_gsg_compiling_dpdk>` or
69 :ref:`Compiling DPDK on FreeBSD <building_from_source>`.
70 Applications are output to: ``$RTE_SDK/examples/app-dir/build`` or
71 ``$RTE_SDK/examples/app-dir/$RTE_TARGET``.
72
73
74 In the example above the compiled application is written to the ``build`` subdirectory.
75 To have the applications written to a different location,
76 the ``O=/path/to/build/directory`` option may be specified in the make command.
77
78     .. code-block:: console
79
80        make O=/tmp
81
82 To build the applications for debugging use the ``DEBUG`` option.
83 This option adds some extra flags, disables compiler optimizations and
84 sets verbose output.
85
86     .. code-block:: console
87
88        make DEBUG=1
89
90
91 To compile a single application
92 -------------------------------
93
94 Set the path to DPDK source code:
95
96     .. code-block:: console
97
98         export RTE_SDK=/path/to/rte_sdk
99
100 Go to DPDK source:
101
102     .. code-block:: console
103
104        cd $RTE_SDK
105
106 Build DPDK:
107
108     .. code-block:: console
109
110         make defconfig
111         make
112
113 Go to the sample application directory. Unless otherwise specified the sample
114 applications are located in ``$RTE_SDK/examples/``.
115
116
117 Build the application:
118
119     .. code-block:: console
120
121         export RTE_TARGET=build
122         make