Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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=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. $(SUBMAKE) target/linux/clean
  46. dirclean: clean
  47. rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST)
  48. rm -rf $(TMP_DIR)
  49. # check prerequisites before starting to build
  50. prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
  51. prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
  52. world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
  53. $(SUBMAKE) package/index
  54. # update all feeds, re-create index files, install symlinks
  55. package/symlinks:
  56. $(SCRIPT_DIR)/feeds update -a
  57. $(SCRIPT_DIR)/feeds install -a
  58. # re-create index files, install symlinks
  59. package/symlinks-install:
  60. $(SCRIPT_DIR)/feeds update -i
  61. $(SCRIPT_DIR)/feeds install -a
  62. # remove all symlinks, don't touch ./feeds
  63. package/symlinks-clean:
  64. $(SCRIPT_DIR)/feeds uninstall -a
  65. .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean
  66. endif