Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. include src/Makefile.Host
  2. ifeq ($(OS),Linux)
  3. NPROCS ?= $(shell grep -c ^processor /proc/cpuinfo)
  4. else
  5. NPROCS ?= 1
  6. endif
  7. ifeq ($(OS),Linux)
  8. LINUX_GEN := 3.x
  9. LINUX_SRC := linux-3.19
  10. LINUX_KERNEL := $(LINUX_SRC)/arch/x86/boot/bzImage
  11. endif
  12. DIRS = src test regression
  13. all clean:
  14. for d in $(DIRS); \
  15. do \
  16. $(MAKE) -C $$d $@; \
  17. done
  18. install:
  19. [ -d ../Runtime ] || mkdir -p ../Runtime
  20. [ -f ../Runtime/libpal.so ] || ln -sf ../Pal/src/libpal.so ../Runtime/libpal.so
  21. [ -f ../Runtime/pal ] || ln -sf ../Pal/src/pal ../Runtime/pal
  22. [ -f ../Runtime/pal_sec ] || ln -sf ../Pal/src/pal_sec ../Runtime/pal_sec
  23. .PHONY: linux-kernel
  24. linux-kernel: $(LINUX_KERNEL)
  25. ifneq ($(LINUX_KERNEL),)
  26. $(LINUX_KERNEL): $(LINUX_SRC)/Makefile $(LINUX_SRC)/graphene $(LINUX_SRC)/.config
  27. $(MAKE) -C $(LINUX_SRC) -j$(NPROCS)
  28. $(LINUX_SRC)/Makefile:
  29. [ -f $(LINUX_SRC).tar.gz ] || \
  30. wget https://www.kernel.org/pub/linux/kernel/v$(LINUX_GEN)/$(LINUX_SRC).tar.gz
  31. tar -xzf $(LINUX_SRC).tar.gz
  32. cd $(LINUX_SRC) && patch -p1 < ../$(LINUX_SRC).patch
  33. $(LINUX_SRC)/graphene: linux-kernel/graphene
  34. cd $(LINUX_SRC) && ln -s ../linux-kernel/graphene graphene
  35. $(LINUX_SRC)/.config: $(LINUX_SRC)/Makefile
  36. cd $(LINUX_SRC) && make menuconfig
  37. kernel_install: kernel
  38. $(MAKE) -C $(LINUX_SRC) install modules_install headers_install
  39. linux-deb:
  40. if [ ! -f $(LINUX_SRC)/.config ]; then \
  41. cp /boot/config-$(shell uname -r) $(LINUX_SRC)/.config && \
  42. cd $(LINUX_SRC) && $(MAKE) menuconfig; fi
  43. cd $(LINUX_SRC) && \
  44. CONCURRENCY_LEVEL=$(NPROCS) make-kpkg --rootcmd fakeroot \
  45. --append-to-version -graphene --initrd \
  46. kernel_image kernel_headers $(if $(DEBUG),kernel_debug,)
  47. else
  48. kernel_install:
  49. endif
  50. .PHONY: test
  51. test:
  52. $(MAKE) -C test test
  53. .PHONY: pack
  54. pack:
  55. $(MAKE) -C test pack
  56. $(MAKE) -C regression pack