summaryrefslogtreecommitdiff
path: root/build.sh
blob: 839b1389193613d521a9cef1359bbf18f52b36ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Copyright (c) 2026, Apollo Telephone Laboratories.
# Provided under the BSD-3 clause.
#

MAKE=make

#
# Check if a list of deps are installed on the host system
#
# $@:  Dep list to check
#
check_deps() {
    for dep in $@
    do
        printf "Checking if $dep is installed... "
        which $dep &>/dev/null
        if [ $? -ne 0 ]
        then
            echo "no"
            echo "fatal: Please install '$dep'!"
            exit 1
        fi
        echo "yes"
    done
}

build_prepare() {
    check_deps      \
        rsync       \
        make        \
        clang       \
        rdar

    source dev/build.env
}

#
# Build a directory with MAKE
#
# $1:  Directory to build
# $2:  Target name
#
build_dir() {
    pushd $1
        echo "[*] Building $1..."
        $MAKE
    popd
}

#
# Begin the actual build process
#
build() {
    mkdir -p out

    build_dir           \
        boot            \
        "bootloader"
}

build_prepare
build