Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. GREP_OPTIONS=
  23. export GREP_OPTIONS
  24. include $(TOPDIR)/include/debug.mk
  25. include $(TOPDIR)/include/depends.mk
  26. include $(TOPDIR)/include/toplevel.mk
  27. else
  28. include rules.mk
  29. include $(INCLUDE_DIR)/depends.mk
  30. include $(INCLUDE_DIR)/subdir.mk
  31. include target/Makefile
  32. include package/Makefile
  33. include tools/Makefile
  34. include toolchain/Makefile
  35. $(toolchain/stamp-install): $(tools/stamp-install)
  36. $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared
  37. $(package/stamp-cleanup): $(target/stamp-compile)
  38. $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
  39. $(package/stamp-install): $(package/stamp-compile)
  40. $(package/stamp-rootfs-prepare): $(package/stamp-install)
  41. $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare)
  42. printdb:
  43. @true
  44. prepare: $(target/stamp-compile)
  45. clean: FORCE
  46. $(_SINGLE)$(SUBMAKE) target/linux/clean
  47. rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
  48. dirclean: clean
  49. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  50. rm -rf $(TMP_DIR)
  51. ifndef DUMP_TARGET_DB
  52. $(BUILD_DIR)/.prepared: Makefile
  53. @mkdir -p $$(dirname $@)
  54. @touch $@
  55. tmp/.prereq_packages: .config
  56. unset ERROR; \
  57. for package in $(sort $(prereq-y) $(prereq-m)); do \
  58. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  59. done; \
  60. if [ -n "$$ERROR" ]; then \
  61. echo "Package prerequisite check failed."; \
  62. false; \
  63. fi
  64. touch $@
  65. endif
  66. # check prerequisites before starting to build
  67. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  68. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  69. world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
  70. $(_SINGLE)$(SUBMAKE) -r package/index
  71. # update all feeds, re-create index files, install symlinks
  72. package/symlinks:
  73. $(SCRIPT_DIR)/feeds update -a
  74. $(SCRIPT_DIR)/feeds install -a
  75. # re-create index files, install symlinks
  76. package/symlinks-install:
  77. $(SCRIPT_DIR)/feeds update -i
  78. $(SCRIPT_DIR)/feeds install -a
  79. # remove all symlinks, don't touch ./feeds
  80. package/symlinks-clean:
  81. $(SCRIPT_DIR)/feeds uninstall -a
  82. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  83. endif