Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # Makefile for FunKey-OS
  2. #
  3. # Copyright (C) 2020 by Michel Stempin <michel.stempin@funkey-project.com>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. BRMAKE = buildroot/utils/brmake -C buildroot
  20. BR = make -C buildroot
  21. # Strip quotes and then whitespaces
  22. qstrip = $(strip $(subst ",,$(1)))
  23. #"))
  24. # MESSAGE Macro -- display a message in bold type
  25. MESSAGE = echo "$(shell date +%Y-%m-%dT%H:%M:%S) $(TERM_BOLD)\#\#\# $(call qstrip,$(1))$(TERM_RESET)"
  26. TERM_BOLD := $(shell tput smso 2>/dev/null)
  27. TERM_RESET := $(shell tput rmso 2>/dev/null)
  28. .PHONY: fun source image defconfig clean distclean
  29. .IGNORE: _Makefile_
  30. %/Makefile:
  31. @:
  32. all: buildroot/Makefile fun image
  33. @:
  34. buildroot/README:
  35. @$(call MESSAGE,"Getting buildroot")
  36. git submodule init
  37. git submodule update
  38. fun: Recovery/output/.config FunKey/output/.config
  39. @$(call MESSAGE,"Making fun")
  40. @$(call MESSAGE,"Making fun in Recovery")
  41. @$(BRMAKE) BR2_EXTERNAL=../Recovery O=../Recovery/output
  42. @$(call MESSAGE,"Making fun in FunKey")
  43. @$(BRMAKE) BR2_EXTERNAL=../FunKey O=../FunKey/output
  44. FunKey/%: FunKey/output/.config
  45. @$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
  46. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $(notdir $@)
  47. Recovery/%: Recovery/output/.config
  48. @$(call MESSAGE,"Making $(notdir $@) in $(subst /,,$(dir $@))")
  49. @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output $(notdir $@)
  50. %: FunKey/output/.config
  51. @$(call MESSAGE,"Making $@ in FunKey")
  52. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output $@
  53. source:
  54. @$(call MESSAGE,"Getting sources")
  55. @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output source
  56. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output source
  57. image:
  58. @$(call MESSAGE,"Creating disk image")
  59. mkdir -p root tmp
  60. ./Recovery/output/host/bin/genimage --inputpath .
  61. rm -rf root tmp
  62. defconfig:
  63. @$(call MESSAGE,"Updating default configs")
  64. @$(call MESSAGE,"Updating default configs in Recovery")
  65. @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
  66. @$(call MESSAGE,"Updating default configs in FunKey")
  67. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
  68. clean:
  69. @$(call MESSAGE,"Clean everything")
  70. @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output distclean
  71. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output distclean
  72. distclean: clean
  73. @$(call MESSAGE,"Really clean everything")
  74. rm -rf download images
  75. FunKey/output/.config:
  76. @$(call MESSAGE,"Configure FunKey")
  77. mkdir -p FunKey/board/funkey/patches
  78. @$(BR) BR2_EXTERNAL=../FunKey O=../FunKey/output funkey_defconfig
  79. Recovery/output/.config:
  80. @$(call MESSAGE,"Configure Recovery")
  81. mkdir -p Recovery/board/funkey/patches
  82. @$(BR) BR2_EXTERNAL=../Recovery O=../Recovery/output recovery_defconfig