Makefile 935 B

123456789101112131415161718192021222324252627282930313233343536
  1. OBJS = boot/bootsect
  2. KOBJS = init/head.o init/main.o modules/tty.o kernel/tty.o kernel/int.o kernel/trap.o
  3. KSRCS = init/head.S init/main.c modules/tty.c kernel/tty.S kernel/int.c kernel/trap.S
  4. all: Makefile
  5. make -C boot/
  6. make -C init/
  7. make -C modules/
  8. make -C kernel/
  9. make xnix.img
  10. kbinary: $(KSRCS) boot/bootsect Makefile
  11. ld -b elf64-x86-64 -o kernel.o $(KOBJS) -T kernel.lds
  12. objcopy -I elf64-x86-64 -S -R ".comment" -R ".eh_frame" -O binary kernel.o kbinary
  13. xnix.img: boot/bootsect $(KSRCS) Makefile kbinary
  14. dd if=/dev/zero of=xnix.img bs=1024 count=1440
  15. dd if=boot/bootsect of=xnix.img conv=notrunc seek=0
  16. dd if=kbinary of=xnix.img conv=notrunc bs=512 seek=2
  17. lines: Makefile
  18. wc -l `find ./ -name *.asm -o -name *.c -o -name *.h -o -name *.S -o -name *.s`
  19. clear: Makefile
  20. make -C boot/ clear
  21. make -C init/ clear
  22. make -C modules/ clear
  23. make -C kernel/ clear
  24. rm boot/bootsect
  25. rm xnix.img kbinary kernel.o