Makefile 1.3 KB

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