ÕâÊÇ¡¶×Ô¼º¶¯ÊÖд²Ù×÷ϵͳ¡·ÊéÖиø³öµÄ
Ò»¸ö¼òµ¥µÄ²Ù×÷ϵͳÄں˵ÄmakeÎļþmakefile~
######################
# Makefile for Tinix #
######################
# Entry point of Tinix
# It must be as same as KernelEntryPointPhyAddr in load.inc!!!
ENTRYPOINT = 0x30400
# Offset of entry point in kernel file
# It depends on ENTRYPOINT
ENTRYOFFSET = 0x400
# Programs, flags, etc.
ASM = nasm
DASM = ndisasm
CC = gcc
LD = ld
ASMBFLAGS = -I boot/include
ASMKFLAGS = -I include -f elf
CFLAGS = -I include -c -fno-builtin
LDFLAGS = -s -Ttext $(ENTRYPOINT)
DASMFLAGS = -u -o $(ENTRYPOINT) -e $(ENTRYOFFSET)
# This Program
TINIXBOOT = boot/boot.bin boot/loader.bin
TINIXKERNEL = kernel.bin
OBJS = kernel/kernel.o kernel/start.o kernel/i8259.o kernel/global.o
kernel
/protect.o
lib/klib.o lib/klibc.o lib/string.o
DASMOUTPUT = kernel.bin.asm
# All Phony Targets
.PHONY : everything final image clean realclean disasm all buildimg
# Default starting position
everything : $(TINIXBOOT) $(TINIXKERNEL)
all : realclean everything
final : all clean
image : final buildimg
clean :
rm -f $(OBJS)
realclean :
rm -f $(OBJS) $(TINIXBOOT) $(TINIXKERNEL)
disasm :
$(DASM) $(DASMFLAGS) $(TINIXKERNEL) > $(DASMOUTPUT)
# Write "boot.bin" & "loader.bin" into floppy image "TINIX.IMG"
# We assume that "TINIX.IMG" exists in current folder
buildimg :
mount TINIX.IMG /mnt/floppy -o loop
cp -f boot/loader.bin /mnt/floppy/
cp -f kernel.bin /mnt/floppy
umount /mnt/floppy
boot/boot.bin : boot/boot.asm boot/include/load.inc boot/include/fat12hdr.in
c
$(ASM) $(ASMBFLAGS) -o $@ $<
boot/loader.bin : boot/loader.asm boot/include/load.inc boot/include/fat12hd
r.inc boot/include/pm.inc
$(ASM) $(ASMBFLAGS) -o $@ $<
$(TINIXKERNEL) : $(OBJS)
$(LD) $(LDFLAGS) -o $(TINIXKERNEL) $(OBJS)
kernel/kernel.o : kernel/kernel.asm
$(ASM) $(ASMKFLAGS) -o $@ $<
kernel/start.o: kernel/start.c include/type.h include/const.h include/protec
t.h include/proto.h include/string.h include/global.h
$(CC) $(CFLAGS) -o $@ $<
kernel/i8259.o: kernel/i8259.c include/type.h include/const.h include/protec
t.h include/proto.h
$(CC) $(CFLAGS) -o $@ $<
kernel/global.o: kernel/global.c include/type.h include/const.h include/prot
ect.h include/proto.h include/global.h
$(CC) $(CFLAGS) -o $@ $<
kernel/protect.o: kernel/protect.c include/type.h include/const.h include/pr
otect.h include/global.h
$(CC) $(CFLAGS) -o $@ $<
lib/klibc.o: lib/klib.c include/type.h include/const.h include/protect.h inc
lude/proto.h include/string.h include/global.h
$(CC) $(CFLAGS) -o $@ $<
lib/klib.o : lib/klib.asm
$(ASM) $(ASMKFLAGS) -o $@ $<
lib/string.o : lib/string.asm
$(ASM) $(ASMKFLAGS) -o $@ $<
|