makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # This file is part of PrawnOS (https://www.prawnos.com)
  2. # Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
  3. # PrawnOS is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License version 2
  5. # as published by the Free Software Foundation.
  6. # PrawnOS is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. # You should have received a copy of the GNU General Public License
  11. # along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
  12. .DEFAULT_GOAL := image
  13. PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
  14. include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
  15. include $(PRAWNOS_ROOT)/initramfs/makefile
  16. include $(PRAWNOS_ROOT)/kernel/makefile
  17. #Usage:
  18. #run make image
  19. #this will generate two images named PRAWNOS_IMAGE and PRAWNOS_IMAGE-BASE
  20. #-BASE is only the filesystem with no kernel.
  21. #if you make any changes to the kernel or kernel config with make kernel_config
  22. #run kernel_inject
  23. #:::::::::::::::::::::::::::::: cleaning ::::::::::::::::::::::::::::::
  24. .PHONY: clean
  25. clean:
  26. @echo "Enter one of:"
  27. #TODO
  28. .PHONY: clean_image
  29. clean_img:
  30. rm -f $(PRAWNOS_IMAGE)
  31. .PHONY: clean_basefs
  32. clean_basefs:
  33. rm -f $(PRAWNOS_IMAGE_BASE)
  34. .PHONY: clean_pbuilder
  35. clean_pbuilder:
  36. rm -r build/prawnos-pbuilder-armhf-base.tgz
  37. .PHONY: clean_all
  38. clean_all: clean_kernel clean_initramfs clean_ath9k clean_image clean_basefs clean_pbuilder
  39. #:::::::::::::::::::::::::::::: premake prep ::::::::::::::::::::::::::::::
  40. .PHONY: build_dirs
  41. build_dirs: $(PRAWNOS_BUILD)
  42. #:::::::::::::::::::::::::::::: kernel ::::::::::::::::::::::::::::::::::::
  43. #included from kernel/makefile
  44. #:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
  45. #included from initramfs/makefile
  46. #:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
  47. #makes the base filesystem image without kernel. Only make a new one if the base image isnt present
  48. .PHONY: filesystem
  49. filesystem:
  50. $(MAKE) build_dirs
  51. rm -rf build/logs/fs-log.txt
  52. $(MAKE) pbuilder_create
  53. $(MAKE) filesystem_packages
  54. [ -f $(PRAWNOS_IMAGE_BASE) ] || $(PRAWNOS_FILESYSTEM_SCRIPTS_BUILD) $(KVER) $(DEBIAN_SUITE) $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_ROOT) $(PRAWNOS_SHARED_SCRIPTS) 2>&1 | tee build/logs/fs-log.txt
  55. #:::::::::::::::::::::::::::::: packages ::::::::::::::::::::::::::::::::
  56. .PHONY: filesystem_packages
  57. filesystem_packages:
  58. $(MAKE) filesystem_packages -C packages
  59. .PHONY: filesystem_packages_install
  60. filesystem_packages_install:
  61. ifndef INSTALL_TARGET
  62. $(error INSTALL_TARGET is not set)
  63. endif
  64. $(MAKE) filesystem_packages_install INSTALL_TARGET=$(INSTALL_TARGET) -C filesystem
  65. #:::::::::::::::::::::::::::::: image management ::::::::::::::::::::::::::
  66. .PHONY: kernel_install
  67. kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
  68. $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(PRAWNOS_IMAGE)
  69. .PHONY: kernel_update
  70. kernel_update:
  71. $(MAKE) clean_img
  72. $(MAKE) initramfs
  73. $(MAKE) kernel
  74. cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
  75. $(MAKE) kernel_install
  76. .PHONY: image
  77. image:
  78. $(MAKE) clean_img
  79. $(MAKE) filesystem
  80. $(MAKE) initramfs
  81. $(MAKE) kernel
  82. cp $(PRAWNOS_IMAGE_BASE) $(PRAWNOS_IMAGE)
  83. $(MAKE) kernel_install
  84. #:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
  85. .PHONY: pbuilder_create
  86. pbuilder_create:
  87. $(MAKE) $(PBUILDER_CHROOT)
  88. $(PBUILDER_CHROOT):
  89. pbuilder create --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)
  90. #TODO: should only update if not updated for a day
  91. .PHONY: pbuilder_update
  92. pbuilder_update:
  93. pbuilder update --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC)