Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .PHONY: all clean kernel drivers libraries programs tests generate
  2. TOOLSDIR := tools
  3. TOOLSROOTDIR := root
  4. PROJECT_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
  5. export PATH := $(PROJECT_ROOT)/$(TOOLSDIR)/$(TOOLSROOTDIR)/bin:$(PATH)
  6. GENERATED_SOURCES := sdk/syscall_enum.h kernel/src/syscall_table.inl libraries/mlsys/src/wrappers.c
  7. all: livecd.iso tests
  8. kernel: generate libraries
  9. $(MAKE) -C kernel all
  10. drivers: kernel
  11. $(MAKE) -C drivers all
  12. libraries: generate
  13. $(MAKE) -C libraries all
  14. programs: libraries
  15. $(MAKE) -C programs all
  16. tests:
  17. $(MAKE) -C tests all
  18. generate: $(GENERATED_SOURCES)
  19. sdk/syscall_enum.h: $(wildcard sdk/*.h) syscalls.awk
  20. @echo 'Generating system call sources/headers...'
  21. sort sdk/* | awk -v enum_file=sdk/syscall_enum.h -v table_file=kernel/src/syscall_table.inl -v wrappers_file=libraries/mlsys/src/wrappers.c -f syscalls.awk
  22. kernel/src/syscall_table.inl: sdk/syscall_enum.h
  23. libraries/mlsys/src/wrappers.c: sdk/syscall_enum.h
  24. livecd.iso : kernel drivers libraries programs
  25. mkdir -p livecd/monolithium livecd/boot/grub livecd/monolithium/drivers
  26. cp kernel/monolithium livecd/monolithium/kernel
  27. cp drivers/bin/* livecd/monolithium/drivers/
  28. cp programs/bin/* livecd/monolithium/
  29. cp grub.cfg livecd/boot/grub/grub.cfg
  30. grub-mkrescue -o $@ livecd
  31. clean:
  32. $(MAKE) -C kernel clean
  33. $(MAKE) -C drivers clean
  34. $(MAKE) -C libraries clean
  35. $(MAKE) -C programs clean
  36. $(MAKE) -C tests clean
  37. rm -f $(GENERATED_SOURCES) livecd.iso