2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2015 6WIND S.A.
8 # - ARMV8_CRYPTO_LIB_PATH
9 # - DPDK_BUILD_TEST_CONFIGS (defconfig1+option1+option2 defconfig2)
12 # - DPDK_DEP_ELF (y/[n])
13 # - DPDK_DEP_ISAL (y/[n])
14 # - DPDK_DEP_JSON (y/[n])
16 # - DPDK_DEP_MLX (y/[n])
17 # - DPDK_DEP_NUMA ([y]/n)
18 # - DPDK_DEP_PCAP (y/[n])
19 # - DPDK_DEP_SSL (y/[n])
20 # - DPDK_DEP_IPSEC_MB (y/[n])
21 # - DPDK_DEP_SZE (y/[n])
22 # - DPDK_DEP_NFB (y/[n])
23 # - DPDK_DEP_ZLIB (y/[n])
24 # - DPDK_MAKE_JOBS (int)
25 # - DPDK_NOTIFY (notify-send)
28 # - LIBSSO_SNOW3G_PATH
29 # - LIBSSO_KASUMI_PATH
31 . $(dirname $(readlink -f $0))/load-devel-config
34 echo "usage: $(basename $0) [-h] [-jX] [-s] [config1 [config2] ...]]"
38 echo 'Test building several targets with different options'
45 -jX use X parallel jobs in "make"
46 -s short test only first config without tests|examples|doc
49 config: defconfig[[~][+]option1[[~][+]option2...]]
50 Example: x86_64-native-linux-gcc+debug~RXTX_CALLBACKS
51 The lowercase options are defined inside $(basename $0).
52 The uppercase options can be the end of a defconfig option
53 to enable if prefixed with '+' or to disable if prefixed with '~'.
54 Default is to automatically enable most of the options.
55 The external dependencies are setup with DPDK_DEP_* variables.
56 If no config on command line, DPDK_BUILD_TEST_CONFIGS is used.
60 [ -z $MAKE ] && command -v gmake > /dev/null && MAKE=gmake
61 [ -z $MAKE ] && command -v make > /dev/null && MAKE=make
62 [ -z $MAKE ] && echo "Cannot find make or gmake" && exit 1
68 while getopts hj:sv ARG ; do
73 h ) print_help ; exit 0 ;;
74 ? ) print_usage ; exit 1 ;;
77 shift $(($OPTIND - 1))
78 configs=${*:-$DPDK_BUILD_TEST_CONFIGS}
84 [ "$DPDK_NOTIFY" != notify-send ] || \
85 notify-send -u low --icon=dialog-information 'DPDK build' 'finished'
86 elif [ -z "$signal" ] ; then
87 [ -z "$dir" ] || echo "failed to build $dir" >&2
88 [ "$DPDK_NOTIFY" != notify-send ] || \
89 notify-send -u low --icon=dialog-error 'DPDK build' 'failed'
92 # catch manual interrupt to ignore notification
93 trap "signal=INT ; trap - INT ; kill -INT $$" INT
94 # notify result on exit
97 cd $(dirname $(readlink -f $0))/..
101 export PATH=$default_path
103 unset DPDK_DEP_ARCHIVE
104 unset DPDK_DEP_CFLAGS
108 unset DPDK_DEP_LDFLAGS
113 unset DPDK_DEP_IPSEC_MB
116 unset ARMV8_CRYPTO_LIB_PATH
119 unset LIBSSO_SNOW3G_PATH
120 unset LIBSSO_KASUMI_PATH
121 unset LIBSSO_ZUC_PATH
122 unset PQOS_INSTALL_PATH
125 config () # <directory> <target> <options>
128 if git rev-parse 2>&- && [ -n "$(git diff HEAD~ -- config)" ] ; then
129 echo 'Default config may have changed'
132 if [ ! -e $1/.config ] || $reconfig ; then
133 echo "================== Configure $1"
134 ${MAKE} T=$2 O=$1 config
136 echo 'Customize configuration'
137 # Built-in options (lowercase)
138 ! echo $3 | grep -q '+default' || \
139 sed -ri="" 's,(RTE_MACHINE=")native,\1default,' $1/.config
140 echo $3 | grep -q '+next' || \
141 sed -ri="" 's,(NEXT_ABI=)y,\1n,' $1/.config
142 ! echo $3 | grep -q '+shared' || \
143 sed -ri="" 's,(SHARED_LIB=)n,\1y,' $1/.config
144 ! echo $3 | grep -q '+debug' || ( \
145 sed -ri="" 's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
146 sed -ri="" 's,(_DEBUG.*=)n,\1y,' $1/.config
147 sed -ri="" 's,(_STAT.*=)n,\1y,' $1/.config
148 sed -ri="" 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
150 # Automatic configuration
151 test "$DPDK_DEP_NUMA" != n || \
152 sed -ri="" 's,(NUMA.*=)y,\1n,' $1/.config
153 sed -ri="" 's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
154 sed -ri="" 's,(BYPASS=)n,\1y,' $1/.config
155 test "$DPDK_DEP_ARCHIVE" != y || \
156 sed -ri="" 's,(RESOURCE_TAR=)n,\1y,' $1/.config
157 test "$DPDK_DEP_ISAL" != y || \
158 sed -ri="" 's,(PMD_ISAL=)n,\1y,' $1/.config
159 test "$DPDK_DEP_MLX" != y || \
160 sed -ri="" 's,(MLX._PMD=)n,\1y,' $1/.config
161 test "$DPDK_DEP_SZE" != y || \
162 sed -ri="" 's,(PMD_SZEDATA2=)n,\1y,' $1/.config
163 test "$DPDK_DEP_ZLIB" != y || \
164 sed -ri="" 's,(BNX2X_PMD=)n,\1y,' $1/.config
165 test "$DPDK_DEP_ZLIB" != y || \
166 sed -ri="" 's,(PMD_ZLIB=)n,\1y,' $1/.config
167 test "$DPDK_DEP_ZLIB" != y || \
168 sed -ri="" 's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
169 test "$DPDK_DEP_PCAP" != y || \
170 sed -ri="" 's,(PCAP=)n,\1y,' $1/.config
171 test -z "$ARMV8_CRYPTO_LIB_PATH" || \
172 sed -ri="" 's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
173 test "$DPDK_DEP_IPSEC_MB" != y || \
174 sed -ri="" 's,(PMD_AESNI_MB=)n,\1y,' $1/.config
175 test "$DPDK_DEP_IPSEC_MB" != y || \
176 sed -ri="" 's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
177 test -z "$LIBSSO_SNOW3G_PATH" || \
178 sed -ri="" 's,(PMD_SNOW3G=)n,\1y,' $1/.config
179 test -z "$LIBSSO_KASUMI_PATH" || \
180 sed -ri="" 's,(PMD_KASUMI=)n,\1y,' $1/.config
181 test -z "$LIBSSO_ZUC_PATH" || \
182 sed -ri="" 's,(PMD_ZUC=)n,\1y,' $1/.config
183 test "$DPDK_DEP_SSL" != y || \
184 sed -ri="" 's,(PMD_CCP=)n,\1y,' $1/.config
185 test "$DPDK_DEP_SSL" != y || \
186 sed -ri="" 's,(PMD_OPENSSL=)n,\1y,' $1/.config
187 test "$DPDK_DEP_SSL" != y || \
188 sed -ri="" 's,(QAT_SYM=)n,\1y,' $1/.config
189 test -z "$FLEXRAN_SDK" || \
190 sed -ri="" 's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
191 sed -ri="" 's,(SCHED_.*=)n,\1y,' $1/.config
192 test -z "$LIBMUSDK_PATH" || \
193 sed -ri="" 's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
194 test -z "$LIBMUSDK_PATH" || \
195 sed -ri="" 's,(MVPP2_PMD=)n,\1y,' $1/.config
196 test -z "$LIBMUSDK_PATH" || \
197 sed -ri="" 's,(MVNETA_PMD=)n,\1y,' $1/.config
198 test "$DPDK_DEP_ELF" != y || \
199 sed -ri="" 's,(BPF_ELF=)n,\1y,' $1/.config
200 test "$DPDK_DEP_JSON" != y || \
201 sed -ri="" 's,(TELEMETRY=)n,\1y,' $1/.config
202 build_config_hook $1 $2 $3
204 # Explicit enabler/disabler (uppercase)
205 for option in $(echo $3 | sed 's,[~+], &,g') ; do
206 pattern=$(echo $option | cut -c2-)
207 if echo $option | grep -q '^~' ; then
208 sed -ri="" "s,($pattern=)y,\1n," $1/.config
209 elif echo $option | grep -q '^+' ; then
210 sed -ri="" "s,($pattern=)n,\1y," $1/.config
216 # default empty hook to override in devel config
217 build_config_hook () # <directory> <target> <options>
222 for conf in $configs ; do
223 target=$(echo $conf | sed 's,[~+].*,,')
224 # reload config with DPDK_TARGET set
227 . $(dirname $(readlink -f $0))/load-devel-config
229 options=$(echo $conf | sed 's,[^~+]*,,')
231 config $dir $target $options
233 echo "================== Build $dir"
234 ${MAKE} -j$J EXTRA_CFLAGS="$maxerr $DPDK_DEP_CFLAGS" \
235 EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir
237 echo "================== Build examples for $dir"
238 export RTE_SDK=$(pwd)
239 export RTE_TARGET=$dir
240 ${MAKE} -j$J -sC examples \
241 EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
242 O=$(readlink -f $dir)/examples
244 echo "################## $dir done."
250 echo "================== Build doxygen HTML API"
251 ${MAKE} doc-api-html >/dev/null 2>.check/doc.txt
252 echo "================== Build sphinx HTML guides"
253 ${MAKE} doc-guides-html >/dev/null 2>>.check/doc.txt
254 echo "================== Check docs"
255 diff -u /dev/null .check/doc.txt