MAKEALL 2.27 KB
Newer Older
1 2 3 4 5 6
#!/bin/sh

# This trivially compiles all known-good configurations

build_one () {
    make -s clean
7 8
    echo "###### Build for " "$1"
    make -s -j3 CC="$CC" LD="$LD" -k $2 2>&1 | grep -v ar:.creating
9 10 11 12
    test -f ppsi.o && size ppsi.o
    if $SHOW_UNDEF; then
	nm -u ppsi.o
    fi
13
    test -f ppsi && size ppsi | tail -n 1
14 15 16
}

build_diags () {
17
    msg="arch \"$ARCH\", ext \"$PROTO_EXT\""
18 19
    # only build xint, we know pp_printf works
    unset USER_CFLAGS
20
    build_one "$msg, printf xint" CONFIG_PRINTF_XINT=y
21 22 23
    # then build with all diagnostics, and default printf
    export USER_CFLAGS="-DVERB_LOG_MSGS -DCONFIG_PPSI_RUNTIME_VERBOSITY"
    build_one "$msg, all messages"
24 25 26 27 28
}

build_ext () {
    unset PROTO_EXT
    build_diags
29
    if [ "$ARCH" = "wrpc" ]; then
30 31 32 33 34 35 36 37 38
	export PROTO_EXT=whiterabbit
	build_diags
    fi
}

for var in HAS_DIAG HAS_FULL_DIAG CROSS_COMPILE ARCH CC LD; do
    unset $var
done

39 40 41 42 43
# Build tools first, we must be sure they work
echo "###### Build ./tools"
make -s -C tools clean; make -s -C tools
make -s -C tools/mtp clean; make -s -C tools/mtp

44
# Variables to set up proper stuff for the various architectures
45
PREFIX_unix=""
46
PREFIX_bare_i386=""
47
PREFIX_bare_x86_64=""
48
PREFIX_wrpc="/opt/gcc-lm32/bin/lm32-elf-"
49

50
CC_unix="gcc"
51
CC_bare_i386="gcc -m32"
52
CC_bare_x86_64="gcc -m64"
53
CC_wrpc="${PREFIX_wrpc}gcc"
54

55
LD_unix="ld"
56
LD_bare_i386="ld -m elf_i386"
57
LD_bare_x86_64="ld -m elf_x86_64"
58
LD_wrpc="${PREFIX_wrpc}ld"
59

60 61 62
# Defaults, overridden by command line, later
SHOW_UNDEF=false

63
ARCHS="unix bare-i386 bare-x86-64"
64
if [ "x${WRPCSW_ROOT}" != "x" ]; then
65
    ARCHS="$ARCHS wrpc"
66 67
fi

68 69 70
# Parse command line, so we can limit the archs we build for
while [ $# -gt 0 ]; do
    case $1 in
71 72 73
	gnu-linux) # The previous name we used
	    ARCHS="unix";;
	unix)
74 75 76 77 78
	    ARCHS="$1";;
	bare-i386)
	    ARCHS="$1";;
	bare-x86-64)
	    ARCHS="$1";;
79
	wrpc)
80 81 82 83 84 85 86 87 88 89 90 91 92 93
	    ARCHS="$1";;
	bare)
	    ARCHS="bare-i386 bare-x86-64";;
	*=*)
	    eval export $1;;
	-u)
	    SHOW_UNDEF=true;;
	*)
	    echo "$0: Unknown argument \"$1\"" >&2
	    exit 1;;
	esac
    shift
done

94
# And finally build
95
for a in $ARCHS; do
96 97
    export ARCH=$a
    eval export CROSS_COMPILE="\${PREFIX_$(echo $ARCH | sed 's/-/_/g')}"
98 99
    eval export CC=\""\${CC_$(echo $ARCH | sed 's/-/_/g')}"\"
    eval export LD=\""\${LD_$(echo $ARCH | sed 's/-/_/g')}"\"
100 101
    build_ext
done