51 lines
880 B
Makefile
51 lines
880 B
Makefile
ARCHDIR=../arch/i686
|
|
|
|
|
|
CFLAGS=-O2 \
|
|
-std=gnu99 \
|
|
-ffreestanding \
|
|
-Wall -Wextra \
|
|
-I $(INCLUDEDIR)
|
|
|
|
|
|
KERNEL_OBJS=kernel.o
|
|
LIB_OBJS=bootstrap.o \
|
|
tty.o\
|
|
strlib.o\
|
|
interrupt.o
|
|
OBJS=$(KERNEL_OBJS) $(LIB_OBJS)
|
|
LDFLAGS=$(OBJS) \
|
|
-ffreestanding \
|
|
-O2 \
|
|
-nostdlib \
|
|
-lgcc
|
|
|
|
|
|
INCLUDEDIR=../include
|
|
|
|
|
|
all:
|
|
mkdir build || true
|
|
cp Makefile build
|
|
$(MAKE) -C build test-kernel-qemu
|
|
|
|
architecture:
|
|
i686-elf-as $(ARCHDIR)/bootstrap.s -o bootstrap.o
|
|
|
|
i686-elf-gcc -c $(ARCHDIR)/tty.c -o tty.o $(CFLAGS)
|
|
i686-elf-gcc -c $(ARCHDIR)/interrupt.c -o interrupt.o $(CFLAGS)
|
|
i686-elf-gcc -c $(ARCHDIR)/strlib.c -o strlib.o $(CFLAGS)
|
|
|
|
kernel:
|
|
i686-elf-gcc -c ../kernel/kernel.c -o kernel.o $(CFLAGS)
|
|
|
|
|
|
myos-bin: architecture kernel
|
|
i686-elf-gcc -T $(ARCHDIR)/linker.ld -o myos.bin $(LDFLAGS)
|
|
|
|
grub-file --is-x86-multiboot myos.bin
|
|
|
|
test-kernel-qemu: myos-bin
|
|
qemu-system-i386 -kernel myos.bin
|
|
|