- #makefile for kernel
- ENTRYPOINT=0x30400
- #Programs,flags,etc
- ASM=nasm
- CC=gcc
- LD=ld
- ASMFLAGS=-f elf
- CFLAGS=-I include/ -c -fno-builtin -fno-stack-protector
- LDFLAGS=-Ttext $(ENTRYPOINT) -s
- #This program
- TARGET=kernel.bin
- OBJS=kernel/kernel.o kernel/global.o kernel/proc.o /
- kernel/init_8259a.o kernel/protect.o kernel/clock.o /
- lib/lib_kernel_in_asm.o lib/lib_kernel_in_c.o /
- kernel/system_call_asm.o kernel/system_call_c.o /
- kernel/init_8253.o kernel/keyboard.o kernel/tty.o /
- kernel/console.o kernel/ipc.o
- #All phony target
- .PHONY:cp everything clean realclean
- cp:everything
- sudo mount -o loop b.img /mnt/floppy/
- sudo cp -fv kernel.bin /mnt/floppy/
- sudo umount /mnt/floppy
- everything:$(TARGET)
- clean:
- sudo rm -f $(OBJS)
- realclean:
- sudo rm -f $(OBJS) $(TARGET)
- $(TARGET):$(OBJS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS)
- kernel/kernel.o:kernel/kernel.asm
- $(ASM) $(ASMFLAGS) -o $@ $<
- lib/lib_kernel_in_asm.o:lib/lib_kernel_in_asm.asm
- $(ASM) $(ASMFLAGS) -o $@ $<
- kernel/system_call_asm.o:kernel/system_call.asm
- $(ASM) $(ASMFLAGS) -o $@ $<
- lib/lib_kernel_in_c.o:lib/lib_kernel_in_c.c include/type.h/
- include/proto.h include/const.h include/protect.h include/proc.h /
- include/global.h include/console.h include/tty.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/global.o:kernel/global.c include/type.h include/const.h /
- include/protect.h include/console.h include/tty.h include/proto.h /
- include/proc.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/init_8259a.o:kernel/init_8259a.c include/type.h /
- include/proto.h include/protect.h include/proc.h include/console.h /
- include/tty.h include/global.h include/const.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/protect.o:kernel/protect.c include/type.h include/const.h /
- include/protect.h include/proc.h include/console.h include/tty.h /
- include/global.h include/proto.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/proc.o:kernel/proc.c include/type.h include/const.h /
- include/proto.h include/protect.h include/proc.h include/console.h /
- include/tty.h include/global.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/clock.o:kernel/clock.c include/type.h include/const.h /
- include/protect.h include/proc.h include/console.h include/tty.h /
- include/global.h include/proto.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/system_call_c.o:kernel/system_call.c include/type.h include/const.h /
- include/proto.h include/protect.h include/proc.h include/console.h include/tty.h /
- include/global.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/init_8253.o:kernel/init_8253.c include/type.h include/console.h include/tty.h /
- include/protect.h include/proc.h include/proto.h include/const.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/keyboard.o:kernel/keyboard.c include/type.h include/const.h /
- include/protect.h include/proc.h include/proto.h include/console.h /
- include/tty.h include/global.h include/keymap.h include/keyboard.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/tty.o:kernel/tty.c include/type.h include/proto.h include/keyboard.h /
- include/const.h include/protect.h include/proc.h include/console.h include/tty.h /
- include/global.h include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/console.o:kernel/console.c include/type.h include/const.h include/protect.h /
- include/proc.h include/console.h include/tty.h include/global.h include/proto.h /
- include/ipc.h
- $(CC) $(CFLAGS) -o $@ $<
- kernel/ipc.o:kernel/ipc.c include/type.h include/const.h include/console.h include/tty.h /
- include/protect.h include/proc.h include/ipc.h include/global.h include/proto.h
- $(CC) $(CFLAGS) -o $@ $<