Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. [ ! -f $(LINUX_SRC).patch ] || git apply $(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. install: $(LINUX_KERNEL)
  33. make -C $(LINUX_SRC) install modules_install headers_install
  34. linux-deb:
  35. if [ -f $(LINUX_SRC)/.config ]; then \
  36. cp /boot/config-$(shell uname -r) $(LINUX_SRC)/.config && \
  37. cd $(LINUX_SRC) && make menuconfig; fi
  38. cd $(LINUX_SRC) && \
  39. CONCURRENCY_LEVEL=$(NPROCS) make-kpkg --rootcmd fakeroot \
  40. --append-to-version -graphene --initrd \
  41. kernel-image kernel-headers
  42. else
  43. install:
  44. endif
  45. .PHONY: test
  46. test:
  47. make -C test test
  48. .PHONY: pack
  49. pack:
  50. make -C test pack