mbr_asm/Makefile

24 lines
612 B
Makefile
Raw Normal View History

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)