Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Makefile for OpenWrt
  2. #
  3. # Copyright (C) 2007 OpenWrt.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. TOPDIR:=${CURDIR}
  9. LC_ALL:=C
  10. LANG:=C
  11. export TOPDIR LC_ALL LANG
  12. world:
  13. include $(TOPDIR)/include/host.mk
  14. ifneq ($(OPENWRT_BUILD),1)
  15. # XXX: these three lines are normally defined by rules.mk
  16. # but we can't include that file in this context
  17. empty:=
  18. space:= $(empty) $(empty)
  19. _SINGLE=export MAKEFLAGS=$(space);
  20. override OPENWRT_BUILD=1
  21. export OPENWRT_BUILD
  22. include $(TOPDIR)/include/debug.mk
  23. include $(TOPDIR)/include/depends.mk
  24. include $(TOPDIR)/include/toplevel.mk
  25. else
  26. include rules.mk
  27. include $(INCLUDE_DIR)/depends.mk
  28. include $(INCLUDE_DIR)/subdir.mk
  29. include target/Makefile
  30. include package/Makefile
  31. include tools/Makefile
  32. include toolchain/Makefile
  33. $(toolchain/stamp-install): $(tools/stamp-install)
  34. $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
  35. $(package/stamp-cleanup): $(target/stamp-compile)
  36. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  37. $(package/stamp-install): $(package/stamp-compile)
  38. $(package/stamp-rootfs-prepare): $(package/stamp-install)
  39. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
  40. $(BUILD_DIR)/.prepared: Makefile
  41. @mkdir -p $$(dirname $@)
  42. @touch $@
  43. clean: FORCE
  44. rm -rf $(BUILD_DIR) $(BIN_DIR)
  45. $(_SINGLE)$(SUBMAKE) target/linux/clean
  46. dirclean: clean
  47. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  48. rm -rf $(TMP_DIR)
  49. tmp/.prereq_packages: .config
  50. unset ERROR; \
  51. for package in $(sort $(prereq-y) $(prereq-m)); do \
  52. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  53. done; \
  54. if [ -n "$$ERROR" ]; then \
  55. echo "Package prerequisite check failed."; \
  56. false; \
  57. fi
  58. touch $@
  59. # check prerequisites before starting to build
  60. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  61. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  62. world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
  63. $(_SINGLE)$(SUBMAKE) -r package/index
  64. # update all feeds, re-create index files, install symlinks
  65. package/symlinks:
  66. $(SCRIPT_DIR)/feeds update -a
  67. $(SCRIPT_DIR)/feeds install -a
  68. # re-create index files, install symlinks
  69. package/symlinks-install:
  70. $(SCRIPT_DIR)/feeds update -i
  71. $(SCRIPT_DIR)/feeds install -a
  72. # remove all symlinks, don't touch ./feeds
  73. package/symlinks-clean:
  74. $(SCRIPT_DIR)/feeds uninstall -a
  75. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  76. endif