Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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=${CURDIR}
  20. export IS_TTY=$(shell tty -s && echo 1 || echo 0)
  21. include $(TOPDIR)/include/verbose.mk
  22. OPENWRTVERSION:=$(RELEASE)
  23. ifneq ($(VERSION),)
  24. OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
  25. else
  26. REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
  27. ifneq ($(REV),)
  28. OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
  29. endif
  30. endif
  31. export OPENWRTVERSION
  32. ifeq ($(FORCE),)
  33. .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
  34. world: tmp/.prereq-package tmp/.prereq-target
  35. endif
  36. package/%/Makefile: ;
  37. target/%/Makefile: ;
  38. tmp/.packageinfo tmp/.targetinfo: FORCE
  39. mkdir -p tmp/info
  40. $(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="" SCAN_TARGET_DEPS="$(wildcard target/*/Makefile include/kernel*.mk)" SCAN_EXTRA=""
  41. $(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(wildcard package/*/Makefile include/package*.mk include/kernel.mk)" SCAN_EXTRA=""
  42. tmpinfo-clean: FORCE
  43. -rm -rf tmp/.*info
  44. tmp/.config-%.in: tmp/.%info scripts/metadata.pl
  45. ./scripts/metadata.pl $*_config < $< > $@ || rm -f $@
  46. .config: ./scripts/config/conf tmp/.config-target.in tmp/.config-package.in
  47. if [ \! -f .config ]; then \
  48. [ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
  49. $(NO_TRACE_MAKE) menuconfig; \
  50. fi
  51. $< -D .config Config.in &> /dev/null
  52. scripts/config/mconf:
  53. $(MAKE) -C scripts/config all
  54. scripts/config/conf:
  55. $(MAKE) -C scripts/config conf
  56. config: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
  57. $< Config.in
  58. config-clean: FORCE
  59. $(NO_TRACE_MAKE) -C scripts/config clean
  60. defconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
  61. touch .config
  62. $< -D .config Config.in
  63. oldconfig: scripts/config/conf tmp/.config-target.in tmp/.config-package.in FORCE
  64. $< -o Config.in
  65. menuconfig: scripts/config/mconf tmp/.config-target.in tmp/.config-package.in FORCE
  66. if [ \! -f .config -a -e $(HOME)/.openwrt/defconfig ]; then \
  67. cp $(HOME)/.openwrt/defconfig .config; \
  68. fi
  69. $< Config.in
  70. kernel_menuconfig: .config FORCE
  71. -$(MAKE) target/linux-prepare
  72. $(NO_TRACE_MAKE) -C target/linux menuconfig
  73. package/% target/%: tmp/.packageinfo
  74. toolchain/% package/% target/%: tmp/.targetinfo
  75. package/% target/% tools/% toolchain/%: FORCE
  76. $(MAKE) -C $(patsubst %/$*,%,$@) $*
  77. tmp/.prereq-build: include/prereq-build.mk
  78. mkdir -p tmp
  79. rm -f tmp/.host.mk
  80. $(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
  81. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  82. false; \
  83. }
  84. touch $@
  85. tmp/.prereq-%: include/prereq.mk tmp/.%info .config
  86. mkdir -p tmp
  87. rm -f tmp/.host.mk
  88. $(NO_TRACE_MAKE) -s -C $* prereq 2>/dev/null || { \
  89. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  90. false; \
  91. }
  92. touch $@
  93. prereq: tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target FORCE
  94. download: .config FORCE
  95. $(MAKE) tools/download
  96. $(MAKE) toolchain/download
  97. $(MAKE) package/download
  98. $(MAKE) target/download
  99. world: .config FORCE
  100. $(MAKE) tools/install
  101. $(MAKE) toolchain/install
  102. $(MAKE) target/compile
  103. $(MAKE) package/compile
  104. $(MAKE) package/install
  105. $(MAKE) target/install
  106. $(MAKE) package/index
  107. clean: FORCE
  108. rm -rf build_* bin tmp
  109. dirclean: clean
  110. rm -rf staging_dir_* toolchain_build_* tool_build
  111. distclean: dirclean config-clean symlinkclean docclean
  112. rm -rf dl
  113. help:
  114. cat README
  115. doc:
  116. $(MAKE) -C docs/ openwrt.pdf
  117. docclean:
  118. $(MAKE) -C docs/ clean
  119. symlinkclean:
  120. -find package -type l | xargs rm -f
  121. rm -rf tmp
  122. .SILENT: clean dirclean distclean symlinkclean config-clean download world help tmp/.packageinfo tmp/.targetinfo tmpinfo-clean tmp/.config-package.in tmp/.config-target.in .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package tmp/.prereq-target
  123. FORCE: ;
  124. .PHONY: FORCE help