-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (42 loc) · 1.78 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ISO := os-goddard.iso
OUTPUT := kernel.sys
SOURCES_INIT := src/init/boot.o src/init/main.o
#src/init/descriptor_tables.o src/init/gdt.o \
# src/init/interrupt.o src/init/isr.o
SOURCES_LIB := src/lib/io.o src/lib/iostream.o
#src/lib/stdlib.o src/lib/string.o
SOURCES_DRIVERS := src/drivers/console.o
SOURCES := $(SOURCES_INIT) $(SOURCES_LIB) $(SOURCES_DRIVERS)
#CPPFLAGS=-ffreestanding -m64 -mcmodel=kernel -mno-red-zone -nostdlib -fno-builtin -fno-stack-protector -std=c++11 -ggdb -O2 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-main -I src/lib/include -I src/drivers/include -I src/include
#
CPPFLAGS=-ffreestanding -nostartfiles -m64 -mcmodel=kernel -mno-red-zone -std=c++11 -ggdb -O2 -mno-mmx \
-mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -I src/lib/include -I src/drivers/include -I src/include
LDFLAGS=-Tsrc/link.ld
ASFLAGS=-felf64
;CRTI_OBJ=src/init/crti.o
;CRTBEGIN_OBJ:=$(shell x86_64-elf-g++ $(CPPFLAGS) -print-file-name=crtbegin.o)
;CRTEND_OBJ:=$(shell x86_64-elf-g++ $(CPPFLAGS) -print-file-name=crtend.o)
;CRTN_OBJ=src/init/crtn.o
;OBJ_LINK_LIST:=$(CRTI_OBJ) $(CRTBEGIN_OBJ) $(SOURCES) $(CRTEND_OBJ) $(CRTN_OBJ)
;INTERNAL_OBJS:=$(CRTI_OBJ) $(CRTN_OBJ)
all: $(ISO)
$(ISO): $(OUTPUT)
cp $(OUTPUT) iso/boot
#mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o os-goddard.iso iso
#sudo losetup /dev/loop0 floppy.img
#sudo mount /dev/loop0 /mnt
#sudo cp $(OUTPUT) /mnt/kernel
#sudo umount /dev/loop0
#sudo losetup -d /dev/loop0
grub-mkrescue -o $(ISO) iso
#;cp $(OUTPUT) iso/boot
# grub-mkrescue -o $(ISO) iso
$(OUTPUT): $(SOURCES) link
clean:
@rm -f $(SOURCES) $(OUTPUT)
link:
ld -nodefaultlibs $(LDFLAGS) -o $(OUTPUT) $(SOURCES)
.cpp.o:
x86_64-elf-g++ $(CPPFLAGS) -c $< -o $@
.s.o:
nasm $(ASFLAGS) $<