Cleanup gitignore.
[Qnixx.git] / Makefile.in
blob408ec07a3f4959f158f79733aad4346069bfe039
1 QEMU_ARGS = -cpu qemu64 -M q35 -m 3G -cdrom Qnixx.iso -boot d -smp 4 -rtc base=localtime -audiodev pa,id=audio0 -machine pcspk-audiodev=audio0
2 LOCAL_IP = @LOCAL_IP@
3 CFLAGS = @KERNEL_CFLAGS@
4 CC = cross/bin/x86_64-elf-gcc
5 LD = cross/bin/x86_64-elf-ld
6 OBJDIR = obj
7 SRCDIR = sys/src/
9 rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
10 OBJDIR = obj
11 SRCDIR = sys/src
12 SRC = $(call rwildcard,$(SRCDIR),*.c)
13 OBJS = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRC))
15 .PHONY: all
16 all: $(OBJS) asmfiles limine link iso
18 .PHONY: iso
19 iso:
20 @echo "Generating ISO..."
21 @mkdir -p iso_root
22 @mkdir -p iso_root/boot
23 @cp meta/limine.cfg \
24 limine/limine.sys limine/limine-cd.bin limine/limine-cd-efi.bin iso_root/
25 @cp sys/kernel.sys meta/*.bmp meta/termfont.F16 iso_root/boot/
26 @xorriso -as mkisofs -b limine-cd.bin \
27 -no-emul-boot -boot-load-size 4 -boot-info-table \
28 --efi-boot limine-cd-efi.bin \
29 -efi-boot-part --efi-boot-image --protective-msdos-label \
30 iso_root -o Qnixx.iso
31 @echo "Deploying Limine..."
32 @limine/limine-deploy Qnixx.iso
33 @rm -rf iso_root
35 limine:
36 @echo "Fetching Limine binaries..."
37 @git clone https://github.com/limine-bootloader/limine.git --branch=v4.0-binary --depth=1
38 @make -C limine
40 $(OBJDIR)/%.o: $(SRCDIR)/%.c
41 mkdir -p $(shell dirname $@)
42 $(CC) $(CFLAGS) -c $^ -o $@
44 .PHONY: asmfiles
45 asmfiles:
46 @echo "Compiling assembly sources..."
47 @for source in $$(find sys/src/ -name "*.asm"); do nasm -felf64 $$source; done
49 .PHONY: link
50 link:
51 mkdir -p asmobj/
52 @mv $(shell find sys/src/ -name "*.o") asmobj/
53 @echo "Linking object files..."
54 @$(LD) $(shell find obj/ -name "*.o") asmobj/* -nostdlib -zmax-page-size=0x1000 -static -Tsys/link.ld -o sys/kernel.sys
56 .PHONY: run
57 run:
58 qemu-system-x86_64 --enable-kvm $(QEMU_ARGS) -serial stdio
60 .PHONY: clean
61 clean:
62 rm -rf obj
64 .PHONY: clean_all
65 clean_all:
66 rm -rf configure autom4te.cache config.status config.log install-sh Makefile