-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (31 loc) · 837 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
OBJECTS=boot.o kmain.o io.o
CC=gcc
CC_FLAGS=-c -m32 -std=c11 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles -nodefaultlibs -Wall -Werror -Wextra
ASM=nasm
ASM_FLAGS=-f elf32
LD=ld
LD_FLAGS=-T src/link.ld -melf_i386
all: kernel isoimage
kernel: ${OBJECTS}
${ASM} ${ASM_FLAGS} src/boot.s -o boot.o
${LD} ${LD_FLAGS} ${OBJECTS} -o bin/kernel.bin
clean:
@rm -f *.o
distclean: clean
@rm -f bin/kernel.bin bin/iso/boot/kernel.bin bin/yamikernel.iso
isoimage: kernel
@cp bin/kernel.bin bin/iso/boot
@genisoimage -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-boot-load-size 4 \
-A YamiKernel \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o bin/yamikernel.iso \
bin/iso
%.o: src/%.c
${CC} ${CC_FLAGS} $< -o $@
%.o: src/%.s
${ASM} ${ASM_FLAGS} $< -o $@