misc: Disentangle Makefiles so it builds fine with -j
This commit is contained in:
parent
a8626d6fdd
commit
db20cc7580
10
Makefile
10
Makefile
@ -89,7 +89,7 @@ test.hdd:
|
|||||||
parted -s test.hdd mklabel gpt
|
parted -s test.hdd mklabel gpt
|
||||||
parted -s test.hdd mkpart primary 2048s 100%
|
parted -s test.hdd mkpart primary 2048s 100%
|
||||||
|
|
||||||
echfs-test: | test-clean test.hdd bootloader all
|
echfs-test: | test-clean test.hdd limine-bios
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
echfs-utils -g -p0 test.hdd quick-format 512 > part_guid
|
echfs-utils -g -p0 test.hdd quick-format 512 > part_guid
|
||||||
sed "s/@GUID@/`cat part_guid`/g" < test/limine.cfg > limine.cfg.tmp
|
sed "s/@GUID@/`cat part_guid`/g" < test/limine.cfg > limine.cfg.tmp
|
||||||
@ -101,7 +101,7 @@ echfs-test: | test-clean test.hdd bootloader all
|
|||||||
bin/limine-install test.hdd
|
bin/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
ext2-test: | test-clean test.hdd bootloader all
|
ext2-test: | test-clean test.hdd limine-bios
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
@ -118,7 +118,7 @@ ext2-test: | test-clean test.hdd bootloader all
|
|||||||
bin/limine-install test.hdd
|
bin/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
fat32-test: | test-clean test.hdd bootloader all
|
fat32-test: | test-clean test.hdd limine-bios
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
@ -135,7 +135,7 @@ fat32-test: | test-clean test.hdd bootloader all
|
|||||||
bin/limine-install test.hdd
|
bin/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -enable-kvm -cpu host -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
iso9660-test: | test-clean test.hdd bootloader
|
iso9660-test: | test-clean test.hdd limine-bios
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir -p test_image/boot
|
mkdir -p test_image/boot
|
||||||
@ -143,7 +143,7 @@ iso9660-test: | test-clean test.hdd bootloader
|
|||||||
genisoimage -no-emul-boot -b boot/limine-cd.bin -boot-load-size 4 -boot-info-table -o test.iso test_image/
|
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
|
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
|
uefi-test: ovmf | test-clean test.hdd limine-uefi
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
CC = i386-elf-gcc
|
CC = i386-elf-gcc
|
||||||
LD = i386-elf-gcc
|
LD = i386-elf-gcc
|
||||||
OBJCOPY = i386-elf-objcopy
|
OBJCOPY = i386-elf-objcopy
|
||||||
BUILDDIR = .
|
BUILDDIR =
|
||||||
|
|
||||||
|
ifeq ($(BUILDDIR), )
|
||||||
|
$(error BUILDDIR not specified)
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS = -flto -Os -pipe -Wall -Wextra -Werror
|
CFLAGS = -flto -Os -pipe -Wall -Wextra -Werror
|
||||||
|
|
||||||
@ -28,14 +32,16 @@ INTERNAL_LDFLAGS = \
|
|||||||
-static \
|
-static \
|
||||||
-Tlinker.ld
|
-Tlinker.ld
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean builddir
|
||||||
|
|
||||||
C_FILES := $(shell find -L ./ -type f -name '*.c' | sort)
|
C_FILES := $(shell find -L ./ -type f -name '*.c' | sort)
|
||||||
ASM_FILES := $(shell find -L ./ -type f -name '*.asm' | sort)
|
ASM_FILES := $(shell find -L ./ -type f -name '*.asm' | sort)
|
||||||
OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o))
|
OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o))
|
||||||
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
|
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
|
||||||
|
|
||||||
all: | builddir $(BUILDDIR)/decompressor.bin
|
all:
|
||||||
|
$(MAKE) builddir
|
||||||
|
$(MAKE) $(BUILDDIR)/decompressor.bin
|
||||||
|
|
||||||
builddir:
|
builddir:
|
||||||
for i in $(OBJ); do mkdir -p `dirname $$i`; done
|
for i in $(OBJ); do mkdir -p `dirname $$i`; done
|
||||||
@ -46,10 +52,10 @@ $(BUILDDIR)/decompressor.bin: $(OBJ)
|
|||||||
|
|
||||||
-include $(HEADER_DEPS)
|
-include $(HEADER_DEPS)
|
||||||
|
|
||||||
$(addprefix $(BUILDDIR)/, %.o): %.c
|
$(BUILDDIR)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(addprefix $(BUILDDIR)/, %.o): %.asm
|
$(BUILDDIR)/%.o: %.asm
|
||||||
nasm $< -f elf32 -o $@
|
nasm $< -f elf32 -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
TARGET = bios
|
TARGET =
|
||||||
BUILDDIR = .
|
BUILDDIR =
|
||||||
|
|
||||||
|
ifeq ($(BUILDDIR), )
|
||||||
|
$(error BUILDDIR not specified)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), bios)
|
ifeq ($(TARGET), bios)
|
||||||
TOOLCHAIN=i386-elf
|
TOOLCHAIN=i386-elf
|
||||||
@ -86,11 +90,13 @@ OBJ := $(addprefix $(BUILDDIR)/, $(ASM_FILES:.asm=.o) $(C_FILES:.c=.o))
|
|||||||
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
|
HEADER_DEPS := $(addprefix $(BUILDDIR)/, $(C_FILES:.c=.d))
|
||||||
|
|
||||||
ifeq ($(TARGET), bios)
|
ifeq ($(TARGET), bios)
|
||||||
all: | builddir everything
|
all:
|
||||||
.PHONY: everything
|
$(MAKE) builddir
|
||||||
everything: $(BUILDDIR)/limine_dbg.elf $(BUILDDIR)/limine.sys $(BUILDDIR)/stage2.bin $(BUILDDIR)/stage2.bin.gz
|
$(MAKE) $(BUILDDIR)/limine_dbg.elf $(BUILDDIR)/limine.sys $(BUILDDIR)/stage2.bin $(BUILDDIR)/stage2.bin.gz
|
||||||
else ifeq ($(TARGET), uefi)
|
else ifeq ($(TARGET), uefi)
|
||||||
all: | builddir $(BUILDDIR)/BOOTX64.EFI
|
all:
|
||||||
|
$(MAKE) builddir
|
||||||
|
$(MAKE) $(BUILDDIR)/BOOTX64.EFI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
builddir:
|
builddir:
|
||||||
@ -154,27 +160,27 @@ endif
|
|||||||
|
|
||||||
-include $(HEADER_DEPS)
|
-include $(HEADER_DEPS)
|
||||||
|
|
||||||
$(addprefix $(BUILDDIR)/, %.o): %.c
|
$(BUILDDIR)/%.o: %.c
|
||||||
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
ifeq ($(TARGET), bios)
|
ifeq ($(TARGET), bios)
|
||||||
$(addprefix $(BUILDDIR)/, %.s2.o): %.s2.c
|
$(BUILDDIR)/%.s2.o: %.s2.c
|
||||||
$(CC) $(S2CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
$(CC) $(S2CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), uefi)
|
ifeq ($(TARGET), uefi)
|
||||||
$(addprefix $(BUILDDIR)/, %.32.o): %.32.c
|
$(BUILDDIR)/%.32.o: %.32.c
|
||||||
$(CC32) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@.32
|
$(CC32) $(CFLAGS) $(INTERNAL_CFLAGS) -c $< -o $@.32
|
||||||
$(OBJCOPY) -I elf32-i386 -O elf64-x86-64 $@.32 $@
|
$(OBJCOPY) -I elf32-i386 -O elf64-x86-64 $@.32 $@
|
||||||
rm $@.32
|
rm $@.32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET), bios)
|
ifeq ($(TARGET), bios)
|
||||||
$(addprefix $(BUILDDIR)/, %.o): %.asm
|
$(BUILDDIR)/%.o: %.asm
|
||||||
nasm $< -F dwarf -g -f elf32 -o $@
|
nasm $< -F dwarf -g -f elf32 -o $@
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET), uefi)
|
ifeq ($(TARGET), uefi)
|
||||||
$(addprefix $(BUILDDIR)/, %.o): %.asm
|
$(BUILDDIR)/%.o: %.asm
|
||||||
nasm $< -F dwarf -g -f elf64 -o $@
|
nasm $< -F dwarf -g -f elf64 -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user