about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-23 04:30:47 +0200
committerYour Name <you@example.com>2020-06-23 04:30:47 +0200
commit9feb01b48f8c49c53c089abc528f61b692761dba (patch)
treec2e690f64749a0c6c79427e63366302f5461032e
parentBase: Added very basic driver support (diff)
downloadpOS-9feb01b48f8c49c53c089abc528f61b692761dba.tar.gz
pOS-9feb01b48f8c49c53c089abc528f61b692761dba.tar.bz2
pOS-9feb01b48f8c49c53c089abc528f61b692761dba.zip
Build Process: Added support for asm file compilation
Build script now compiles and links *.s files
-rwxr-xr-xsrc/.build.sh13
1 files 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