#!/bin/sh
set -xe

NCPU=12
[ x"$1" == x"-1" ] && NCPU=1

cd /usr/src
if [ x"$1" == x"-c" ];
then
    doas make build
else
    doas make -j $(( NCPU ))
fi
doas make install

cd /usr/xenocara
doas rm /usr/xobj/xorg-config.cache.amd64
doas make bootstrap
doas make obj
if [ x"$1" == x"-c" ];
then
    doas make -j $(( NCPU )) build
else
    doas make -j $(( NCPU ))
fi
