Makefile fixes

This commit is contained in:
mintsuki 2021-03-04 05:30:31 +01:00
parent 746d9146c6
commit 1be84baf84
3 changed files with 24 additions and 8 deletions

View File

@ -138,10 +138,28 @@ else ifeq ($(TARGET), uefi)
qemu-system-x86_64 -L ovmf -bios ovmf/OVMF.fd -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
endif
iso9660-test: | test-clean test.hdd bootloader all
iso9660-test: | test-clean test.hdd bootloader
$(MAKE) -C test
rm -rf test_image/
mkdir -p test_image/boot
cp -rv bin/* test/* test_image/boot/
genisoimage -no-emul-boot -b boot/limine-cd.bin -boot-load-size 4 -boot-info-table -o test.iso test_image/
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -cdrom test.iso -debugcon stdio
uefi-test: ovmf | test-clean test.hdd bootloader
$(MAKE) -C test
rm -rf test_image/
mkdir test_image
sudo losetup -Pf --show test.hdd > loopback_dev
sudo partprobe `cat loopback_dev`
sudo mkfs.fat -F 32 `cat loopback_dev`p1
sudo mount `cat loopback_dev`p1 test_image
sudo mkdir test_image/boot
sudo cp -rv bin/* test/* test_image/boot/
sudo mkdir -p test_image/EFI/BOOT
sudo cp bin/BOOTX64.EFI test_image/EFI/BOOT/
sync
sudo umount test_image/
sudo losetup -d `cat loopback_dev`
rm -rf test_image loopback_dev
qemu-system-x86_64 -L ovmf -bios ovmf/OVMF.fd -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio

View File

@ -84,8 +84,8 @@ else ifeq ($(TARGET), uefi)
all: BOOTX64.EFI
endif
BOOTX64.EFI: limine-efi.elf
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-x86_64 --subsystem=10 limine-efi.elf $@
BOOTX64.EFI: limine_efi.elf
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .reloc --target efi-app-x86_64 --subsystem=10 limine_efi.elf $@
stage2.bin.gz: stage2.bin
gzip -n -9 < stage2.bin > stage2.bin.gz
@ -120,7 +120,7 @@ font.o: font.bin
limine.elf: $(OBJ) font.o sys/smp_trampoline.o limine.map.o
$(CC) $(OBJ) font.o sys/smp_trampoline.o limine.map.o $(LDFLAGS) $(INTERNAL_LDFLAGS) -Tlinker.ld -o $@
limine-efi.elf: $(OBJ) font.o sys/smp_trampoline.o
limine_efi.elf: $(OBJ) font.o sys/smp_trampoline.o
$(LD) -shared -Bsymbolic \
-T../gnu-efi/gnuefi/elf_x86_64_efi.lds \
../gnu-efi/x86_64/gnuefi/crt0-efi-x86_64.o \
@ -131,11 +131,9 @@ limine-efi.elf: $(OBJ) font.o sys/smp_trampoline.o
%.o: %.c
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
%.o: %.S
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
%.o: %.asm
nasm $< -F dwarf -g -f elf32 -o $@
clean:
rm -f limine.elf limine_nomap.elf limine_stage2only.elf font.o limine.map.o limine.sys stage2.bin stage2.bin.gz BOOTX64.EFI sys/smp_trampoline.bin sys/smp_trampoline.o $(OBJ) $(HEADER_DEPS)
rm -f limine.elf limine_efi.elf limine_dbg.elf limine_nomap.elf limine_stage2only.elf font.o limine.map.o limine.sys stage2.bin stage2.bin.gz BOOTX64.EFI sys/smp_trampoline.bin sys/smp_trampoline.o $(OBJ) $(HEADER_DEPS)

View File

@ -17,4 +17,4 @@ test.elf: stivale.o stivale2.o e9print.o
$(CC) $(CFLAGS) $(INTERNALCFLAGS) -c $< -o $@
clean:
rm -rf $(TARGET) stivale.o stivale2.o e9print.o
rm -rf test.elf stivale.o stivale2.o e9print.o