More complete Makefile.
This commit is contained in:
parent
b8fe2bd8a3
commit
7a2618dd4d
27
Makefile
27
Makefile
@ -6,12 +6,29 @@ CC=gcc
|
|||||||
LD=ld
|
LD=ld
|
||||||
LDFLAGS=-melf_i386 -Ttext 0x1000 --oformat binary
|
LDFLAGS=-melf_i386 -Ttext 0x1000 --oformat binary
|
||||||
|
|
||||||
basicos:
|
all: os-image
|
||||||
|
|
||||||
|
os-image: boot_sect.bin kernel.bin
|
||||||
|
mkdir -p $(BIN)
|
||||||
|
cat $^ > $(BIN)/$@
|
||||||
|
|
||||||
|
# build kernel binary file
|
||||||
|
kernel.bin: kernel_entry.o kernel.o
|
||||||
|
$(LD) $(LDFLAGS) $^ -o $@
|
||||||
|
|
||||||
|
# build kernel object file
|
||||||
|
kernel.o: kernel.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
# build kernel entry object file
|
||||||
|
kernel_entry.o: kernel_entry.asm
|
||||||
|
$(ASM) -f elf $< -o $@
|
||||||
|
|
||||||
|
boot_sect.bin: boot_sect.asm
|
||||||
|
$(ASM) $< $(AFLAGS) -o $@
|
||||||
|
|
||||||
|
basicos: boot_sect.bin kernel.bin
|
||||||
mkdir -p $(BIN)
|
mkdir -p $(BIN)
|
||||||
$(ASM) boot_sect.asm $(AFLAGS) -o boot_sect.bin
|
|
||||||
$(ASM) kernel_entry.asm -f elf -o kernel_entry.o
|
|
||||||
$(CC) $(CFLAGS) -c kernel.c -o kernel.o
|
|
||||||
$(LD) $(LDFLAGS) -o kernel.bin kernel_entry.o kernel.o
|
|
||||||
cat boot_sect.bin kernel.bin > $(BIN)/os-image
|
cat boot_sect.bin kernel.bin > $(BIN)/os-image
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user