Replace build.sh with a Makefile

This commit is contained in:
jn 2023-01-20 14:39:58 +01:00
parent aad731da31
commit b9fc96b161
4 changed files with 55 additions and 42 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
**/bg.inc **/bg.inc
**/bg.raw **/bg.raw
**/fox32os.img **/fox32os.img
**/fox32os.img.tmp

48
Makefile Normal file
View File

@ -0,0 +1,48 @@
RYFS := $(CURDIR)/meta/ryfs/ryfs.py
FOX32ASM := ../fox32asm/target/release/fox32asm
GFX2INC := ../tools/gfx2inc/target/release/gfx2inc
IMAGE_SIZE := 16777216
BOOTLOADER := bootloader/bootloader.bin
all: fox32os.img
base_image:
mkdir -p base_image
base_image/kernel.fxf: kernel/main.asm
$(FOX32ASM) $< $@
base_image/barclock.fxf: applications/barclock/main.asm
$(FOX32ASM) $< $@
base_image/terminal.fxf: applications/terminal/main.asm
$(FOX32ASM) $< $@
base_image/foxpaint.fxf: applications/foxpaint/main.asm
$(FOX32ASM) $< $@
base_image/bg.fxf: applications/bg/main.asm
$(FOX32ASM) $< $@
base_image/bg.raw: applications/bg/bg.inc
$(FOX32ASM) $< $@
applications/bg/bg.inc: applications/bg/bg.png
$(GFX2INC) 640 480 $< $@
bootloader/bootloader.bin: bootloader/main.asm
$(FOX32ASM) $< $@
FILES = \
base_image/kernel.fxf \
base_image/barclock.fxf \
base_image/terminal.fxf \
base_image/foxpaint.fxf \
base_image/bg.fxf \
base_image/bg.raw
fox32os.img: $(BOOTLOADER) $(FILES)
$(RYFS) -s $(IMAGE_SIZE) -l fox32os -b $(BOOTLOADER) create fox32os.img.tmp
cd base_image; for file in *; do $(RYFS) add ../fox32os.img.tmp $$file; done
cp fox32os.img.tmp fox32os.img

View File

@ -8,5 +8,11 @@
Stable releases are available on the [Releases page](https://github.com/fox32-arch/fox32os/releases). Stable releases are available on the [Releases page](https://github.com/fox32-arch/fox32os/releases).
## How to build
- Download [tools](https://github.com/fox32-arch/tools) and [fox32asm](https://github.com/fox32-arch/fox32asm).
Either use the pre-built binaries or build them.
- Run `make`
## License ## License
This project is licensed under the [MIT license](LICENSE). This project is licensed under the [MIT license](LICENSE).

View File

@ -1,42 +0,0 @@
#!/usr/bin/env bash
set -e
mkdir -p base_image
# if fox32os.img doesn't exist, then create it
if [ ! -f fox32os.img ]; then
echo "fox32os.img not found, creating it"
echo "assembling bootloader"
../fox32asm/target/release/fox32asm bootloader/main.asm bootloader/bootloader.bin
meta/ryfs/ryfs.py -s 16777216 -l fox32os -b bootloader/bootloader.bin create fox32os.img
rm bootloader/bootloader.bin
fi
echo "assembling kernel"
../fox32asm/target/release/fox32asm kernel/main.asm base_image/kernel.fxf
echo "assembling barclock"
../fox32asm/target/release/fox32asm applications/barclock/main.asm base_image/barclock.fxf
echo "assembling terminal"
../fox32asm/target/release/fox32asm applications/terminal/main.asm base_image/terminal.fxf
echo "assembling foxpaint"
../fox32asm/target/release/fox32asm applications/foxpaint/main.asm base_image/foxpaint.fxf
echo "assembling bg"
../fox32asm/target/release/fox32asm applications/bg/main.asm base_image/bg.fxf
echo "creating bg.raw"
../tools/gfx2inc/target/release/gfx2inc 640 480 applications/bg/bg.png applications/bg/bg.inc
../fox32asm/target/release/fox32asm applications/bg/bg.inc base_image/bg.raw
echo "adding files to fox32os.img"
cd base_image
for file in ./*; do
../meta/ryfs/ryfs.py add ../fox32os.img $file
done