mbr_asm/Makefile
Mathieu Maret 523bff7fce Put 32bits code after 1sector and load it
Use makefile to build
Use ld linker script to create final bin
2017-11-24 22:41:16 +01:00

24 lines
612 B
Makefile

AS=nasm
ASFLAGS += -f elf32
LDFLAGS += -m32 -nostdlib -static -fno-common -fno-use-cxa-atexit -fno-exceptions -fno-non-call-exceptions -fno-weak -fno-rtti
CFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions
CXXFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti
asmsrc=$(wildcard *.asm)
asmobj=$(asmsrc:%.asm=%.o)
csrc=$(wildcard *.c)
cobj=$(csrc:%.c=%.o)
kernel:$(asmobj) $(cobj) linker.ld
$(CXX) $(LDFLAGS) $(cobj) $(asmobj) -o $@ -T linker.ld
%.o:%.asm
$(AS) $(ASFLAGS) -o $@ $<
test:kernel
qemu-system-x86_64 -fda $<
clean:
$(RM) kernel $(asmobj) $(cobj)