A poorly written OS for the x86 arch. (WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eOS/Makefile

57 lines
1.2 KiB

3 years ago
# Compiler/assembler settings
CC = gcc
3 years ago
CFLAGS = -fno-pie -m32 -Os -ffreestanding -g3
AA = nasm
AFLAGS =
LD = gcc
LDFLAGS = -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32
3 years ago
# VM/Debug settings
VM = qemu-system-x86_64
3 years ago
VMFLAGS = -serial stdio -no-reboot -no-shutdown #-d int
# Do not touch these.
C_SOURCES = $(wildcard kernel/*.c drivers/*.c lib/*.c)
3 years ago
ASM_SOURCES = $(wildcard kernel/*.asm drivers/*.asm lib/*.asm)
HEADERS = $(wildcard kernel/*.h drivers/*.h lib/*.h)
OBJ = $(C_SOURCES:.c=.o)
3 years ago
AOBJ = $(ASM_SOURCES:.asm=.o)
3 years ago
all: eos.iso
3 years ago
run: all
$(VM) $(VMFLAGS) eos.iso
3 years ago
drun: clean run
3 years ago
grub: eos_grub.iso
$(VM) $(VMFLAGS) eos_grub.iso
3 years ago
eos_grub.iso : kernel.bin grub/grub.cfg
mkdir -p boot/grub
cp $< boot/eOS.bin
cp grub/grub.cfg boot/grub/grub.cfg
3 years ago
grub-mkrescue -o eos_grub.iso ./
3 years ago
eos.iso: bootloader/bootloader.bin kernel.bin
cat $^ > eos.iso
3 years ago
3 years ago
kernel.bin: kernel/kernel_entry.o $(OBJ) $(AOBJ)
$(LD) -o $@ $^ $(LDFLAGS)
3 years ago
%.o : %.c ${HEADERS}
$(CC) $(CFLAGS) -c $< -o $@
3 years ago
3 years ago
%.o : %.asm
$(AA) $< -f elf -o $@ $(AFLAGS)
3 years ago
3 years ago
%.bin : %.asm
$(AA) $< -f bin -o $@ $(AFLAGS)
3 years ago
clean:
3 years ago
rm -fr *.bin *.dis *.o eos.iso *.map boot/ *.iso
3 years ago
rm -fr kernel/*.o bootloader/*.bin drivers/*.o