#!/bin/bash MAKE=make # # Check if a list of deps are installed on the host machine # # $@: 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 } # # Ensure that the build environment is sane # build_check() { if [ -z "${GLOBAL_BUILD_SOURCED}" ] then echo "fatal: Please run '. dev/build.env'" exit 1 fi check_deps \ rdar \ clang \ git \ make } # # Build a directory # # $1: Directory to build # $2: Subsystem name # build_dir() { pushd $1 echo "[*] Building $2..." $MAKE popd } # # Kick off the entire build proccess # build() { mkdir -p artifacts/ build_dir \ boot \ "bootloader" } build_check build