-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·45 lines (36 loc) · 1 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
CFLAGS="-Wall -Wextra -m32 -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -nostdlib -nostartfiles -nodefaultlibs -I../src/sys -I../src/libc -I../src/kernel -I../src/drivers" # -Werror
# params
CC="gcc"
set -e
cd bin
echo [Compiling]
for filename in ../src/*/*.s
do
echo Compiling $filename ...
file=`basename $filename .s`
nasm -f elf -o $file.s.o $filename
done;
for filename in ../src/*/*.c
do
echo Compiling $filename ...
file=`basename $filename .c`
$CC $CFLAGS -o $file.c.o -c $filename
done;
for filename in ../src/scripts/*.lua
do
echo Including $filename ...
file=`basename $filename .lua`
pushd `dirname $filename`
objcopy -I binary -O elf32-i386 --binary-architecture i386 $file.lua ../../bin/$file.lua.o
popd
done;
echo
echo [Linking]
mv loader.s.o loader.me
ld -melf_i386 -T ../assets/linker.ld -o kernel.bin loader.me *.s.o *.c.o *.lua.o ../lua-5.1/src/*.o
echo
echo [Concat]
cat ../assets/stage1 ../assets/stage2 ../assets/pad kernel.bin > floppy.img
echo
echo Done.
cd ..