Makefile 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. $(BUILD_DIR)/.prepared: Makefile
  43. @mkdir -p $$(dirname $@)
  44. @touch $@
  45. prepare: $(target/stamp-compile)
  46. clean: FORCE
  47. $(_SINGLE)$(SUBMAKE) target/linux/clean
  48. rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR)
  49. dirclean: clean
  50. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN)
  51. rm -rf $(TMP_DIR)
  52. tmp/.prereq_packages: .config
  53. unset ERROR; \
  54. for package in $(sort $(prereq-y) $(prereq-m)); do \
  55. $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
  56. done; \
  57. if [ -n "$$ERROR" ]; then \
  58. echo "Package prerequisite check failed."; \
  59. false; \
  60. fi
  61. touch $@
  62. # check prerequisites before starting to build
  63. prereq: $(target/stamp-prereq) tmp/.prereq_packages
  64. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  65. world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
  66. $(_SINGLE)$(SUBMAKE) -r package/index
  67. # update all feeds, re-create index files, install symlinks
  68. package/symlinks:
  69. $(SCRIPT_DIR)/feeds update -a
  70. $(SCRIPT_DIR)/feeds install -a
  71. # re-create index files, install symlinks
  72. package/symlinks-install:
  73. $(SCRIPT_DIR)/feeds update -i
  74. $(SCRIPT_DIR)/feeds install -a
  75. # remove all symlinks, don't touch ./feeds
  76. package/symlinks-clean:
  77. $(SCRIPT_DIR)/feeds uninstall -a
  78. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  79. endif