about summary refs log tree commit diff
path: root/src/.build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/.build.sh')
-rwxr-xr-xsrc/.build.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/.build.sh b/src/.build.sh
new file mode 100755
index 0000000..fde3c02
--- /dev/null
+++ b/src/.build.sh
@@ -0,0 +1,17 @@
+out_dir="..\/out"
+include="-I pOS/include -I pOS/include/libc"
+
+mkdir $out_dir 2> /dev/null
+
+for f in $(find pOS/ -type f \( -iname \*.cpp -o -iname \*.c \))
+do
+	out_file=$(echo $f | sed 's/pOS/..\/out\/pOS/g' | sed 's/\.cpp/\.o/g' | sed 's/\.c/\.o/g')
+	mkdir -p $(dirname $out_file)
+	i686-elf-g++ $include -g -std=c++11 -c $f -o $out_file -ffreestanding -O2 -Wall -Wextra -fno-exceptions -fno-rtti
+done
+
+mkdir -p ../out/bootloader
+
+nasm -f elf32 bootloader/boot.s -o ../out/bootloader/boot.o
+
+i686-elf-g++ -T linker.ld -o ../out/pOS.bin -ffreestanding -O2 -nostdlib $(find ../out -type f -name "*.o") -lgcc