Makefile 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. CC = gcc -O0 -m32 -fno-builtin -fno-stack-protector -nostdinc -nostdlib
  2. LD = ld -melf_i386 -nostdlib
  3. all: rtthread rtsym exe dll floppy.img
  4. @mkdir -p tmp
  5. @sudo mount -t vfat floppy.img tmp -o loop
  6. @sudo cp -fv rtthread.elf tmp/boot/oskernel
  7. @sudo rm tmp/bin/* -fr
  8. @sudo cp out/* tmp/bin/ -fv
  9. @sudo umount tmp
  10. rtthread:
  11. @scons
  12. rtsym:
  13. @./src/extract.sh ./rtthread-ia32.map ./src/rt_thread_sym.h
  14. obj:
  15. mkdir -p obj
  16. out:
  17. mkdir -p out
  18. dll: obj out
  19. $(CC) -shared -s -fPIC -e main -Isrc src/hello.c -o out/hello.mo
  20. disasm: obj out
  21. $(CC) -shared -S -fPIC -Isrc src/hello.c -o obj/hello.s
  22. cat obj/hello.s
  23. objdump --disassemble out/hello.mo
  24. exe: obj out
  25. clean:
  26. scons -c clean
  27. rm -fr build rtthread* out obj
  28. floppy.img:
  29. wget https://github.com/bajdcc/tinix/raw/master/floppy.img
  30. # https://en.wikibooks.org/wiki/QEMU/Devices/Network
  31. run:
  32. qemu-system-i386 -fda floppy.img -boot a -m 64M -serial stdio -net nic,model=ne2k_pci