aboutsummaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
Diffstat (limited to 'run')
-rwxr-xr-xrun37
1 files changed, 15 insertions, 22 deletions
diff --git a/run b/run
index 1b00a23..060c049 100755
--- a/run
+++ b/run
@@ -62,27 +62,17 @@ make_cross() {
}
make_build() {
- rm -rf disk/bin/ disk/ build/disk.img
- mkdir -p build/ disk/bin/ disk/
+ mkdir -p build/
+ rm -rf build/*
echo "Building..."
- cd build/
- cmake .. >/dev/null
make
- cd ..
-
- # Assemble bootloader
- nasm src/entry.asm -f bin -o disk/boot.bin
-
- # Make kernel binary
- objcopy -O binary build/melvix.o build/melvix.bin
- cp build/melvix.bin disk/
# Create disk image
dd if=/dev/zero of=build/disk.img bs=1k count=16k
sudo mke2fs build/disk.img >/dev/null
- dd if=disk/boot.bin of=build/disk.img conv=notrunc
- ./ext2util/ext2util -x build/disk.img -wf disk/melvix.bin -i 5 >/dev/null
+ dd if=build/boot.bin of=build/disk.img conv=notrunc
+ ./ext2util/ext2util -x build/disk.img -wf build/kernel.bin -i 5 >/dev/null
printf "Build finshed successfully!\n\n"
}
@@ -96,17 +86,18 @@ make_debug() {
}
make_disasm() {
- objdump -drwC -Mintel build/kernel.bin --visualize-jumps=color | less -R
+ objdump -drwC -Mintel build/melvix.bin --visualize-jumps=color | less -R
+ #hexdump -C build/melvix.bin | less -R
}
make_sync() {
- #rm tags compile_commands.json
ctags -R --exclude=.git --exclude=build --exclude=iso --exclude=cross .
- mkdir -p build
- cd build
- cmake .. >/dev/null
- mv compile_commands.json ..
- cd ..
+
+ make --always-make --dry-run |
+ grep -wE 'gcc|g++' |
+ grep -w '\-c' |
+ jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$").string[1:]}]' \
+ >compile_commands.json
}
make_tidy() {
@@ -117,7 +108,7 @@ make_tidy() {
}
make_clean() {
- rm -rf ./disk/bin/ ./disk/boot/ ./build/
+ rm -rf ./build/
}
if [ "${mode}" = "cross" ]; then
@@ -130,6 +121,7 @@ elif [ "${mode}" = "clean" ]; then
make_clean
elif [ "${mode}" = "test" ]; then
make_cross
+ make_clean
make_build
make_sync &
make_test
@@ -150,6 +142,7 @@ elif [ "${mode}" = "tidy" ]; then
make_tidy
elif [ "${mode}" = "" ]; then # TODO: Prevent code duplication in build script via functions?
make_cross
+ make_clean
make_build
make_sync &
make_test