Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. OS ?= $(shell uname -s)
  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.14
  10. LINUX_KERNEL := $(LINUX_SRC)/arch/x86/boot/bzImage
  11. endif
  12. DIRS = src test regression
  13. all debug clean:
  14. for d in $(DIRS); \
  15. do \
  16. $(MAKE) -C $$d $@; \
  17. done
  18. .PHONY: kernel
  19. kernel: $(LINUX_KERNEL)
  20. ifneq ($(LINUX_KERNEL),)
  21. $(LINUX_KERNEL): $(LINUX_SRC)/Makefile $(LINUX_SRC)/graphene $(LINUX_SRC)/.config
  22. $(MAKE) -C $(LINUX_SRC) -j$(NPROCS)
  23. $(LINUX_SRC)/Makefile:
  24. [ -f $(LINUX_SRC).tar.gz ] || \
  25. wget https://www.kernel.org/pub/linux/kernel/v$(LINUX_GEN)/$(LINUX_SRC).tar.gz
  26. tar -xzf $(LINUX_SRC).tar.gz
  27. cd $(LINUX_SRC) && patch -p1 < ../$(LINUX_SRC).patch
  28. $(LINUX_SRC)/graphene: linux-kernel/graphene
  29. cd $(LINUX_SRC) && ln -s ../linux-kernel/graphene graphene
  30. $(LINUX_SRC)/.config: $(LINUX_SRC)/Makefile
  31. cd $(LINUX_SRC) && make menuconfig
  32. kernel_install: $(LINUX_KERNEL)
  33. $(MAKE) -C $(LINUX_SRC) install modules_install headers_install
  34. install:
  35. [ -d ../Runtime ] || mkdir -p ../Runtime
  36. [ -f ../Runtime/libpal.so ] || ln -sf ../Pal/src/libpal.so ../Runtime/libpal.so
  37. [ -f ../Runtime/pal ] || ln -sf ../Pal/src/pal ../Runtime/pal
  38. [ -f ../Runtime/pal_sec ] || ln -sf ../Pal/src/pal_sec ../Runtime/pal_sec
  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_debug kernel_headers
  47. else
  48. 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