Makefile 2.8 KB

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