Makefile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. FILES = ./build/kernel.asm.o ./build/kernel.o ./build/idt/idt.asm.o ./build/idt/idt.o ./build/memory/memory.o ./build/textmode/textmode.o ./build/io/io.asm.o ./build/memory/heap/heap.o ./build/memory/heap/kheap.o ./build/memory/paging/paging.asm.o ./build/memory/paging/paging.o ./build/disk/disk.o ./build/utils/string.o ./build/fs/pathparser.o ./build/disk/diskstream.o ./build/fs/file.o ./build/fs/fat/fat16.o ./build/gdt/gdt.asm.o ./build/gdt/gdt.o ./build/task/tss.asm.o ./build/task/task.o ./build/task/process.o ./build/task/task.asm.o ./build/isr80h/isr80h.o ./build/isr80h/misc.o ./build/keyboard/keyboard.o
  2. INCLUDES = -I./src
  3. FLAGS = -g -ffreestanding -falign-jumps -falign-functions -falign-labels -falign-loops -fstrength-reduce -fomit-frame-pointer -finline-functions -Wno-unused-function -fno-builtin -Werror -Wno-unused-label -Wno-cpp -Wno-unused-parameter -nostdlib -nostartfiles -nodefaultlibs -Wall -O0 -Iinc
  4. all: ./bin/boot.bin ./bin/kernel.bin programs_all
  5. rm -rf ./bin/os.bin
  6. dd if=./bin/boot.bin >> ./bin/os.bin
  7. dd if=./bin/kernel.bin >> ./bin/os.bin
  8. dd if=/dev/zero bs=1048576 count=16 >> ./bin/os.bin
  9. sudo mount -t vfat ./bin/os.bin /mnt/d
  10. sudo cp ./hello.txt /mnt/d/filename.txt
  11. sudo cp ./programs/blank/blank.bin /mnt/d/blank.bin
  12. sudo cp ./programs/hello/hello.bin /mnt/d/hello.bin
  13. sudo umount /mnt/d
  14. ./bin/kernel.bin: $(FILES)
  15. i686-elf-ld -g -relocatable $(FILES) -o ./build/kernelfull.o
  16. i686-elf-gcc $(FLAGS) -T ./src/linker.ld -o ./bin/kernel.bin ./build/kernelfull.o
  17. ./bin/boot.bin: ./src/boot/boot.asm
  18. nasm -f bin ./src/boot/boot.asm -o ./bin/boot.bin
  19. ./build/kernel.asm.o: ./src/kernel.asm
  20. nasm -f elf -g ./src/kernel.asm -o ./build/kernel.asm.o
  21. ./build/idt/idt.asm.o: ./src/idt/idt.asm
  22. nasm -f elf -g ./src/idt/idt.asm -o ./build/idt/idt.asm.o
  23. ./build/io/io.asm.o: ./src/io/io.asm
  24. nasm -f elf -g ./src/io/io.asm -o ./build/io/io.asm.o
  25. ./build/memory/paging/paging.asm.o: ./src/memory/paging/paging.asm
  26. nasm -f elf -g ./src/memory/paging/paging.asm -o ./build/memory/paging/paging.asm.o
  27. ./build/gdt/gdt.asm.o: ./src/gdt/gdt.asm
  28. nasm -f elf -g ./src/gdt/gdt.asm -o ./build/gdt/gdt.asm.o
  29. ./build/task/task.asm.o: ./src/task/task.asm
  30. nasm -f elf -g ./src/task/task.asm -o ./build/task/task.asm.o
  31. ./build/task/tss.asm.o: ./src/task/tss.asm
  32. nasm -f elf -g ./src/task/tss.asm -o ./build/task/tss.asm.o
  33. ./build/kernel.o: ./src/kernel.c
  34. i686-elf-gcc $(INCLUDES) $(FLAGS) -std=gnu99 -c ./src/kernel.c -o ./build/kernel.o
  35. ./build/idt/idt.o: ./src/idt/idt.c
  36. i686-elf-gcc $(INCLUDES) -I./src/idt $(FLAGS) -std=gnu99 -c ./src/idt/idt.c -o ./build/idt/idt.o
  37. ./build/memory/memory.o: ./src/memory/memory.c
  38. i686-elf-gcc $(INCLUDES) -I./src/memory $(FLAGS) -std=gnu99 -c ./src/memory/memory.c -o ./build/memory/memory.o
  39. ./build/textmode/textmode.o: ./src/textmode/textmode.c
  40. i686-elf-gcc $(INCLUDES) -I./src/textmode $(FLAGS) -std=gnu99 -c ./src/textmode/textmode.c -o ./build/textmode/textmode.o
  41. ./build/memory/heap/heap.o: ./src/memory/heap/heap.c
  42. i686-elf-gcc $(INCLUDES) -I./src/memory/heap $(FLAGS) -std=gnu99 -c ./src/memory/heap/heap.c -o ./build/memory/heap/heap.o
  43. ./build/memory/heap/kheap.o: ./src/memory/heap/kheap.c
  44. i686-elf-gcc $(INCLUDES) -I./src/memory/heap $(FLAGS) -std=gnu99 -c ./src/memory/heap/kheap.c -o ./build/memory/heap/kheap.o
  45. ./build/memory/paging/paging.o: ./src/memory/paging/paging.c
  46. i686-elf-gcc $(INCLUDES) -I./src/memory/paging $(FLAGS) -std=gnu99 -c ./src/memory/paging/paging.c -o ./build/memory/paging/paging.o
  47. ./build/disk/disk.o: ./src/disk/disk.c
  48. i686-elf-gcc $(INCLUDES) -I./src/disk $(FLAGS) -std=gnu99 -c ./src/disk/disk.c -o ./build/disk/disk.o
  49. ./build/disk/diskstream.o: ./src/disk/diskstream.c
  50. i686-elf-gcc $(INCLUDES) -I./src/disk $(FLAGS) -std=gnu99 -c ./src/disk/diskstream.c -o ./build/disk/diskstream.o
  51. ./build/utils/string.o: ./src/utils/string.c
  52. i686-elf-gcc $(INCLUDES) -I./src/utils $(FLAGS) -std=gnu99 -c ./src/utils/string.c -o ./build/utils/string.o
  53. ./build/fs/pathparser.o: ./src/fs/pathparser.c
  54. i686-elf-gcc $(INCLUDES) -I./src/fs $(FLAGS) -std=gnu99 -c ./src/fs/pathparser.c -o ./build/fs/pathparser.o
  55. ./build/fs/file.o: ./src/fs/file.c
  56. i686-elf-gcc $(INCLUDES) -I./src/fs $(FLAGS) -std=gnu99 -c ./src/fs/file.c -o ./build/fs/file.o
  57. ./build/fs/fat/fat16.o: ./src/fs/fat/fat16.c
  58. i686-elf-gcc $(INCLUDES) -I./src/fs/fat $(FLAGS) -std=gnu99 -c ./src/fs/fat/fat16.c -o ./build/fs/fat/fat16.o
  59. ./build/gdt/gdt.o: ./src/gdt/gdt.c
  60. i686-elf-gcc $(INCLUDES) -I./src/gdt $(FLAGS) -std=gnu99 -c ./src/gdt/gdt.c -o ./build/gdt/gdt.o
  61. ./build/task/task.o: ./src/task/task.c
  62. i686-elf-gcc $(INCLUDES) -I./src/task $(FLAGS) -std=gnu99 -c ./src/task/task.c -o ./build/task/task.o
  63. ./build/task/process.o: ./src/task/process.c
  64. i686-elf-gcc $(INCLUDES) -I./src/task $(FLAGS) -std=gnu99 -c ./src/task/process.c -o ./build/task/process.o
  65. ./build/isr80h/isr80h.o: ./src/isr80h/isr80h.c
  66. i686-elf-gcc $(INCLUDES) -I./src/isr80h $(FLAGS) -std=gnu99 -c ./src/isr80h/isr80h.c -o ./build/isr80h/isr80h.o
  67. ./build/isr80h/misc.o: ./src/isr80h/misc.c
  68. i686-elf-gcc $(INCLUDES) -I./src/isr80h $(FLAGS) -std=gnu99 -c ./src/isr80h/misc.c -o ./build/isr80h/misc.o
  69. ./build/keyboard/keyboard.o: ./src/keyboard/keyboard.c
  70. i686-elf-gcc $(INCLUDES) -I./src/keyboard $(FLAGS) -std=gnu99 -c ./src/keyboard/keyboard.c -o ./build/keyboard/keyboard.o
  71. programs_all:
  72. cd ./programs/blank && $(MAKE) all
  73. cd ./programs/hello && $(MAKE) all
  74. programs_clean:
  75. cd ./programs/blank && $(MAKE) clean
  76. cd ./programs/hello && $(MAKE) clean
  77. clean: programs_clean
  78. rm -rf ./bin/*.bin
  79. rm -rf ${FILES}
  80. rm -rf ./build/*.o