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