Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. all:
  2. LC_ALL:=C
  3. LANG:=C
  4. export LC_ALL LANG
  5. empty:=
  6. space:= $(empty) $(empty)
  7. ifneq ($(GLUON_BUILD),1)
  8. override GLUON_BUILD=1
  9. export GLUON_BUILD
  10. TARGETS := all prepare images
  11. SUBMAKE := $(MAKE) --no-print-directory
  12. FORCE: ;
  13. $(TARGETS): FORCE
  14. +@$(SUBMAKE) $@
  15. image/%:: FORCE
  16. +@$(SUBMAKE) $@
  17. clean: FORCE
  18. +@$(SUBMAKE) clean-gluon
  19. cleanall: FORCE
  20. +@$(SUBMAKE) clean
  21. .PHONY: FORCE
  22. else
  23. GLUONMAKE = $(SUBMAKE) -C $(GLUON_OPENWRTDIR) -f $(GLUONDIR)/Makefile
  24. ifneq ($(OPENWRT_BUILD),1)
  25. GLUONDIR:=${CURDIR}
  26. include $(GLUONDIR)/builder/gluon.mk
  27. TOPDIR:=$(GLUON_OPENWRTDIR)
  28. export TOPDIR
  29. include $(TOPDIR)/include/host.mk
  30. _SINGLE=export MAKEFLAGS=$(space);
  31. override OPENWRT_BUILD=1
  32. override REVISION:=$(shell $(GLUON_BUILDERDIR)/openwrt_rev.sh $(GLUONDIR))
  33. GREP_OPTIONS=
  34. export OPENWRT_BUILD GREP_OPTIONS REVISION
  35. include $(TOPDIR)/include/debug.mk
  36. include $(TOPDIR)/include/depends.mk
  37. include $(TOPDIR)/include/toplevel.mk
  38. all: FORCE
  39. +@$(GLUONMAKE) prepare
  40. +@$(GLUONMAKE) images
  41. prepare: FORCE
  42. +@$(GLUONMAKE) prepare
  43. images: FORCE
  44. +@$(GLUONMAKE) images
  45. image/%:: FORCE
  46. +@$(GLUONMAKE) $@
  47. clean: clean-gluon
  48. clean-gluon:
  49. rm -rf $(GLUON_BUILDDIR)
  50. else
  51. include $(GLUONDIR)/builder/gluon.mk
  52. include $(TOPDIR)/include/host.mk
  53. include rules.mk
  54. include $(INCLUDE_DIR)/depends.mk
  55. include $(INCLUDE_DIR)/subdir.mk
  56. include $(INCLUDE_DIR)/kernel.mk
  57. include package/Makefile
  58. include tools/Makefile
  59. include toolchain/Makefile
  60. BOARD := ar71xx
  61. PROFILES :=
  62. PROFILE_PACKAGES :=
  63. gluon_prepared_stamp := $(GLUON_BUILDDIR)/$(BOARD)/prepared
  64. define GluonProfile
  65. image/$(1): $(gluon_prepared_stamp)
  66. $(NO_TRACE_MAKE) -C $(GLUON_BUILDERDIR) image PROFILE="$(1)"
  67. PROFILES += $(1)
  68. PROFILE_PACKAGES += $(filter-out -%,$(2) $(GLUON_$(1)_SITE_PACKAGES))
  69. endef
  70. include $(GLUONDIR)/profiles.mk
  71. $(BUILD_DIR)/.prepared: Makefile
  72. @mkdir -p $$(dirname $@)
  73. @touch $@
  74. $(toolchain/stamp-install): $(tools/stamp-install)
  75. $(package/stamp-compile): $(package/stamp-cleanup)
  76. feeds: FORCE
  77. ln -sf $(GLUON_BUILDERDIR)/feeds.conf feeds.conf
  78. scripts/feeds uninstall -a
  79. scripts/feeds update -a
  80. scripts/feeds install -a
  81. rm -f $(TMP_DIR)/info/.files-packageinfo-$(SCAN_COOKIE)
  82. $(SUBMAKE) prepare-tmpinfo OPENWRT_BUILD=0
  83. config: FORCE
  84. echo -e 'CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${space},\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' > .config
  85. $(SUBMAKE) defconfig OPENWRT_BUILD=0
  86. toolchain: $(toolchain/stamp-install) $(tools/stamp-install)
  87. kernel: FORCE
  88. $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.image TARGET_BUILD=1
  89. $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUON_BUILDERDIR)/Makefile.target $(LINUX_DIR)/.modules TARGET_BUILD=1
  90. packages: $(package/stamp-compile)
  91. $(_SINGLE)$(SUBMAKE) -r package/index
  92. prepare-image: FORCE
  93. rm -rf $(BOARD_KDIR)
  94. mkdir -p $(BOARD_KDIR)
  95. cp $(KERNEL_BUILD_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf $(BOARD_KDIR)/
  96. $(SUBMAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image -f $(GLUON_BUILDERDIR)/Makefile.image prepare KDIR="$(BOARD_KDIR)"
  97. prepare: FORCE
  98. mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR)/$(BOARD)
  99. echo 'src packages file:../openwrt/bin/$(BOARD)/packages' > $(GLUON_BUILDDIR)/$(BOARD)/opkg.conf
  100. $(GLUONMAKE) feeds
  101. $(GLUONMAKE) config
  102. $(GLUONMAKE) toolchain
  103. $(GLUONMAKE) kernel
  104. $(GLUONMAKE) packages
  105. $(GLUONMAKE) prepare-image
  106. touch $(gluon_prepared_stamp)
  107. $(gluon_prepared_stamp):
  108. $(GLUONMAKE) prepare
  109. call_image/%: FORCE
  110. $(GLUONMAKE) $(patsubst call_image/%,image/%,$@)
  111. images: $(patsubst %,call_image/%,$(PROFILES)) ;
  112. .PHONY: all images prepare clean cleanall
  113. endif
  114. endif