-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (32 loc) · 1.11 KB
/
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
39
40
OBJECTS = loader.o kmain.o io.o fb.o serial.o log.o string.o segmentation.o gdt.o interrupts.o interrupts_asm.o pic8259.o keyboard.o paging.o paging_asm.o stdio.o
CC = gcc
CFLAGS = -c -m32 -nostdlib -fno-stack-protector -std=gnu99 -ffreestanding -Wall -Wextra -Werror
LDFLAGS = -T link.ld -melf_i386
AS = nasm
ASFLAGS = -f elf32
all: kernel.elf program.flat
kernel.elf: $(OBJECTS) link.ld
ld $(LDFLAGS) $(OBJECTS) -o kernel.elf
jos.iso: kernel.elf program.flat
cp kernel.elf iso/boot/kernel.elf
cp program.flat iso/modules/program.flat
genisoimage -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-boot-load-size 4 \
-A jos \
-input-charset utf8 \
-quiet \
-boot-info-table \
-o jos.iso \
iso
run: jos.iso
bochs -f bochsrc.txt -q
%.flat: %.s
$(AS) -f bin $< -o $@
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
clean:
rm -rf *.o kernel.elf jos.iso