1#!/bin/sh
2
3set -e
4
5cd $(dirname $0)
6
7usage()
8{
9	echo "$0 [-c | --codecov] [-f | --force-config]"
10	exit 1
11}
12
13use_lcov=0
14force_config=0
15while [ "$1" != "" ]; do
16	case $1 in
17		-c | --codecov ) shift
18			echo "$0: use code coverage specified"
19			use_lcov=1
20			;;
21		-f | --force-config ) shift
22			force_config=1
23			echo "$0: force copy config specified"
24			;;
25		* ) usage
26	esac
27done
28
29JOBS=`nproc`
30if [ -z "$ABC" ]; then
31    JOBS=8
32fi
33
34echo "Building TNC testing tools"
35cd tnc
36make QUIET=1 -j$JOBS
37
38echo "Building wlantest"
39cd ../../../wlantest
40make QUIET=1 -j$JOBS > /dev/null
41
42echo "Building hs20-osu-client"
43cd ../hs20/client/
44make QUIET=1 CONFIG_NO_BROWSER=1
45
46echo "Building hostapd"
47cd ../../hostapd
48if [ ! -e .config -o $force_config -eq 1 ]; then
49    if ! cmp ../tests/hwsim/example-hostapd.config .config >/dev/null 2>&1 ; then
50      cp ../tests/hwsim/example-hostapd.config .config
51    fi
52fi
53
54if [ $use_lcov -eq 1 ]; then
55    if ! grep -q CONFIG_CODE_COVERAGE .config; then
56	    echo CONFIG_CODE_COVERAGE=y >> .config
57    else
58	    echo "CONFIG_CODE_COVERAGE already exists in hostapd/.config. Ignore"
59    fi
60fi
61
62make QUIET=1 -j$JOBS hostapd hostapd_cli hlr_auc_gw
63
64echo "Building wpa_supplicant"
65cd ../wpa_supplicant
66if [ ! -e .config -o $force_config -eq 1 ]; then
67    if ! cmp ../tests/hwsim/example-wpa_supplicant.config .config >/dev/null 2>&1 ; then
68      cp ../tests/hwsim/example-wpa_supplicant.config .config
69    fi
70fi
71
72if [ $use_lcov -eq 1 ]; then
73    if ! grep -q CONFIG_CODE_COVERAGE .config; then
74	    echo CONFIG_CODE_COVERAGE=y >> .config
75    else
76	    echo "CONFIG_CODE_COVERAGE already exists in wpa_supplicant/.config. Ignore"
77    fi
78fi
79
80if [ -z $FIPSLD_CC ]; then
81export FIPSLD_CC=gcc
82fi
83make QUIET=1 -j$JOBS
84