Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Makefile for OpenWrt
  2. #
  3. # Copyright (C) 2006 OpenWrt.org
  4. # Copyright (C) 2006 by Felix Fietkau <[email protected]>
  5. #
  6. # This is free software, licensed under the GNU General Public License v2.
  7. # See /LICENSE for more information.
  8. #
  9. RELEASE:=Kamikaze
  10. #VERSION:=2.0 # uncomment for final release
  11. #--------------------------------------------------------------
  12. # Just run 'make menuconfig', configure stuff, then run 'make'.
  13. # You shouldn't need to mess with anything beyond this point...
  14. #--------------------------------------------------------------
  15. all: world
  16. SHELL:=/usr/bin/env bash
  17. export LC_ALL=C
  18. export LANG=C
  19. export TOPDIR=${shell pwd}
  20. include $(TOPDIR)/include/verbose.mk
  21. ifeq ($(KBUILD_VERBOSE),99)
  22. MAKE:=3>/dev/null $(MAKE)
  23. endif
  24. OPENWRTVERSION:=$(RELEASE)
  25. ifneq ($(VERSION),)
  26. OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
  27. else
  28. REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
  29. ifneq ($(REV),)
  30. OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
  31. endif
  32. endif
  33. export OPENWRTVERSION
  34. ifneq ($(shell ./scripts/timestamp.pl -p .pkginfo package Makefile),.pkginfo)
  35. .pkginfo .config: FORCE
  36. endif
  37. ifeq ($(FORCE),)
  38. .config scripts/config/conf scripts/config/mconf: .prereq-build
  39. world: .prereq-packages
  40. endif
  41. .pkginfo:
  42. @echo Collecting package info...
  43. @-for dir in package/*/; do \
  44. echo Source-Makefile: $${dir}Makefile; \
  45. $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
  46. done > $@
  47. pkginfo-clean: FORCE
  48. -rm -f .pkginfo .config.in
  49. .config.in: .pkginfo
  50. @./scripts/gen_menuconfig.pl < $< > $@ || rm -f $@
  51. .config: ./scripts/config/conf .config.in
  52. @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
  53. @$< -D .config Config.in &> /dev/null
  54. scripts/config/mconf:
  55. @$(MAKE) -C scripts/config all
  56. scripts/config/conf:
  57. @$(MAKE) -C scripts/config conf
  58. config: scripts/config/conf .config.in FORCE
  59. $< Config.in
  60. config-clean: FORCE
  61. $(NO_TRACE_MAKE) -C scripts/config clean
  62. defconfig: scripts/config/conf .config.in FORCE
  63. touch .config
  64. $< -D .config Config.in
  65. oldconfig: scripts/config/conf .config.in FORCE
  66. $< -o Config.in
  67. menuconfig: scripts/config/mconf .config.in FORCE
  68. $< Config.in
  69. package/%: .pkginfo FORCE
  70. $(MAKE) -C package $(patsubst package/%,%,$@)
  71. target/%: .pkginfo FORCE
  72. $(MAKE) -C target $(patsubst target/%,%,$@)
  73. tools/%: FORCE
  74. $(MAKE) -C tools $(patsubst tools/%,%,$@)
  75. toolchain/%: FORCE
  76. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  77. .prereq-build: include/prereq-build.mk
  78. @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
  79. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  80. rm -rf $(TOPDIR)/tmp; \
  81. false; \
  82. }
  83. @rm -rf $(TOPDIR)/tmp
  84. @touch $@
  85. .prereq-packages: include/prereq.mk .pkginfo .config
  86. @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
  87. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  88. false; \
  89. }
  90. @rm -rf "$(TOPDIR)/tmp"
  91. @touch $@
  92. prereq: .prereq-build .prereq-packages FORCE
  93. download: .config FORCE
  94. $(MAKE) tools/download
  95. $(MAKE) toolchain/download
  96. $(MAKE) package/download
  97. $(MAKE) target/download
  98. world: .config FORCE
  99. $(MAKE) tools/install
  100. $(MAKE) toolchain/install
  101. $(MAKE) target/compile
  102. $(MAKE) package/compile
  103. $(MAKE) package/install
  104. $(MAKE) target/install
  105. $(MAKE) package/index
  106. clean: FORCE
  107. rm -rf build_* bin
  108. dirclean: clean
  109. rm -rf staging_dir_* toolchain_build_* tool_build
  110. distclean: dirclean config-clean
  111. rm -rf dl .*config* .pkg* .prereq
  112. .SILENT: clean dirclean distclean config-clean download world
  113. FORCE: ;
  114. .PHONY: FORCE
  115. %: ;