📄 makefile
字号:
#MINIOS MAKEFILE
#
#author:
#
#Because of I'm a senior,I can't write it more excellent,However,if you only want to
#finish your homework using it,it's enough,just I think so....
#
AS =as
LD =ld
#we must locate the system at 0x9000,0x0000~0x8fff
#is the page directory table and the page tables
LDFLAGS = -Ttext 0x9000 -e _sysEntry
CC = gcc
CFLAGS = -Wall -O2
CPP = cpp -nostdinc -Iinclude
.c.s:
$(CC) $(CFLAGS) -nostdinc -Iinclude -S -o $*.s $< #get .s from .c
.s.o:
$(AS) -o $*.o $< #compile without link
.c.o:
$(CC) $(CFALGS) -nostdinc -Iinclude -c -o $*.o $< #compile .c file without link
all:boot.bin setup.bin system.bin
#make boot.bin
boot.bin:boot/boot.asm
nasm -o boot.bin boot/boot.asm
#make setup.bin
setup.bin:boot/setup.asm
nasmw -o setup.bin boot/setup.asm
#make system.bin
system.bin:builder.exe sys
builder sys system.bin
#we must make the builder tool at the first
builder.exe:builder/builder.c
gcc -o builder.exe builder/builder.c
source.txt:sys
objdump -d sys >>source.txt
#make sys
sys:main/main.o lib/klib.o lib/lib.o system.o sched/sys_call.o kernel/con_drv.o sched/schedule.o kernel/console.o
$(LD) $(LDFLAGS) -o sys system.o sched/sys_call.o kernel/con_drv.o main/main.o sched/schedule.o lib/klib.o lib/lib.o kernel/console.o
#################################################################
system.o:boot/system.asm
nasmw -fcoff -o system.o boot/system.asm
# main.o
main/main.o:main/main.s
$(AS) -o main/main.o main/main.s
main/main.s:main/main.c
$(CC) -nostdinc -Iinclude -o main/main.s -S main/main.c
# lib.o
lib/lib.o:lib/iolib.s
$(AS) -o lib/lib.o lib/iolib.s
lib/iolib.s:lib/iolib.c
$(CC) -nostdinc -Iinclude -o lib/iolib.s -S lib/iolib.c
# klib.o
lib/klib.o:lib/klib.s
$(AS) -o lib/klib.o lib/klib.s
lib/klib.s:lib/klib.c
$(CC) -nostdinc -Iinclude -o lib/klib.s -S lib/klib.c
# sys_call.o
sched/sys_call.o:sched/system_call.s
$(AS) -o sched/sys_call.o sched/system_call.s
sched/system_call.s:sched/system_call.c
$(CC) -nostdinc -Iinclude -o sched/system_call.s -S sched/system_call.c
# schedule.o
sched/schedule.o:sched/schedule.s
$(AS) -o sched/schedule.o sched/schedule.s
sched/schedule.s:sched/schedule.c
$(CC) -nostdinc -Iinclude -o sched/schedule.s -S sched/schedule.c
# con_drv.o
kernel/con_drv.o:kernel/con_drv.s
$(AS) -o kernel/con_drv.o kernel/con_drv.s
kernel/con_drv.s:kernel/con_drv/con_drv.c
$(CC) -nostdinc -Iinclude -o kernel/con_drv.s -S kernel/con_drv/con_drv.c
# console.o
kernel/console.o:kernel/console.s
$(AS) -o kernel/console.o kernel/console.s
kernel/console.s:kernel/con_drv/console.c
$(CC) -nostdinc -Iinclude -o kernel/console.s -S kernel/con_drv/console.c
#################################################
clean:
rm -f */*.s *.s
rm -f */*.o *.o
rm -f *.bin
rm -f sys
rm -f source.txt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -