Since Sierra is not fully self-hosted, in order to build the kernel you must cross compile it. To do so you first need to grab and build the toolchain for your system, you can do so here.
Sierra Kernel can only be built on Linux or FreeBSD. macOS is untested, and it might be possible if you port some tools but still it is a lot of struggle. If you are using macOS use a virtual box.
Dependencies:
If you are using Ubuntu you can grab all the dependencies (and build the toolchain) with the following commands:
sudo update grub
sudo apt-get install qemu
sudo apt-get install make
sudo apt-get install wget
sudo apt-get install git
sudo apt-get update make
sudo apt-get update git
git clone https://github.com/sofferjacob/sierra-toolchain.git
cd sierra-toolchain
./build.sh
Grabbing the Source
To grab the source just run the following command in terminal:
git clone https://github.com/sofferjacob/Sierra-Kernel.git
Sierra uses a system root while building. When you compile a local program for your OS, your system locates headers and libraries in some specific directories. But since this files are not usable for Sierra, Sierra installs its headers, libk, kernel and other files into a system root.
Sierra uses a Makefile with Shell Scripts for high level build processes. Specific arch make configurations are available as make.config in the arch directories.
To clean the sourcetree run:
./clean.sh
To install all the system headers without relying on the compiler run:
./headers.sh
To build a bootable ISO image you can use on a real machine or a virtual box run:
./iso.sh
To test the kernel:
./quemu.sh
To just build the kernel run:
./build.sh