Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. .PHONY: all clean
  14. all clean:
  15. for d in $(DIRS); \
  16. do \
  17. $(MAKE) -C $$d $@; \
  18. done
  19. .PHONY: linux-kernel
  20. linux-kernel: $(LINUX_KERNEL)
  21. ifneq ($(LINUX_KERNEL),)
  22. $(LINUX_KERNEL): $(LINUX_SRC)/Makefile $(LINUX_SRC)/graphene $(LINUX_SRC)/.config
  23. $(MAKE) -C $(LINUX_SRC) -j$(NPROCS)
  24. $(LINUX_SRC)/Makefile:
  25. [ -f $(LINUX_SRC).tar.gz ] || \
  26. wget https://www.kernel.org/pub/linux/kernel/v$(LINUX_GEN)/$(LINUX_SRC).tar.gz
  27. tar -xzf $(LINUX_SRC).tar.gz
  28. cd $(LINUX_SRC) && patch -p1 < ../$(LINUX_SRC).patch
  29. $(LINUX_SRC)/graphene: linux-kernel/graphene
  30. cd $(LINUX_SRC) && ln -s ../linux-kernel/graphene graphene
  31. $(LINUX_SRC)/.config: $(LINUX_SRC)/Makefile
  32. cd $(LINUX_SRC) && make menuconfig
  33. kernel_install: kernel
  34. $(MAKE) -C $(LINUX_SRC) install modules_install headers_install
  35. linux-deb:
  36. if [ ! -f $(LINUX_SRC)/.config ]; then \
  37. cp /boot/config-$(shell uname -r) $(LINUX_SRC)/.config && \
  38. cd $(LINUX_SRC) && $(MAKE) menuconfig; fi
  39. cd $(LINUX_SRC) && \
  40. CONCURRENCY_LEVEL=$(NPROCS) make-kpkg --rootcmd fakeroot \
  41. --append-to-version -graphene --initrd \
  42. kernel_image kernel_headers $(if $(DEBUG),kernel_debug,)
  43. else
  44. kernel_install:
  45. endif
  46. .PHONY: test
  47. test:
  48. $(MAKE) -C test test
  49. .PHONY: pack
  50. pack:
  51. $(MAKE) -C test pack
  52. $(MAKE) -C regression pack