From 9feb01b48f8c49c53c089abc528f61b692761dba Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 23 Jun 2020 04:30:47 +0200 Subject: Build Process: Added support for asm file compilation Build script now compiles and links *.s files --- src/.build.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/.build.sh b/src/.build.sh index fde3c02..280ae0b 100755 --- a/src/.build.sh +++ b/src/.build.sh @@ -3,15 +3,20 @@ 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 \)) +for f in $(find pOS/ -type f \( -iname \*.cpp -o -iname \*.c -o -iname \*.s \)) do - out_file=$(echo $f | sed 's/pOS/..\/out\/pOS/g' | sed 's/\.cpp/\.o/g' | sed 's/\.c/\.o/g') + out_file=$(echo $f | sed 's/pOS/..\/out\/pOS/g' | sed 's/\.cpp/\.o/g' | sed 's/\.c/\.o/g' | sed 's/\.s/\.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 + if [[ $f == *.s ]] + then + nasm -f elf32 $f -o $out_file + else + i686-elf-g++ $include -g -std=c++11 -c $f -o $out_file -ffreestanding -O2 -Wall -Wextra -fno-exceptions -fno-rtti + fi done mkdir -p ../out/bootloader -nasm -f elf32 bootloader/boot.s -o ../out/bootloader/boot.o +nasm -i "bootloader/" -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 -- cgit 1.4.1