Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. ifeq ($(KBUILD_VERBOSE),99)
  21. MAKE:=3>/dev/null $(MAKE)
  22. endif
  23. export IS_TTY=$(shell tty -s && echo 1 || echo 0)
  24. include $(TOPDIR)/include/verbose.mk
  25. OPENWRTVERSION:=$(RELEASE)
  26. ifneq ($(VERSION),)
  27. OPENWRTVERSION:=$(VERSION) ($(OPENWRTVERSION))
  28. else
  29. REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' )
  30. ifneq ($(REV),)
  31. OPENWRTVERSION:=$(OPENWRTVERSION)/r$(REV)
  32. endif
  33. endif
  34. export OPENWRTVERSION
  35. ifneq ($(shell ./scripts/timestamp.pl -p tmp/.pkginfo package scripts include),tmp/.pkginfo)
  36. tmp/.pkginfo: FORCE
  37. endif
  38. ifneq ($(shell ./scripts/timestamp.pl -p tmp/.targetinfo target/linux scripts include),tmp/.targetinfo)
  39. tmp/.targetinfo: FORCE
  40. endif
  41. ifeq ($(FORCE),)
  42. .config scripts/config/conf scripts/config/mconf: tmp/.prereq-build
  43. world: tmp/.prereq-packages
  44. endif
  45. tmp/.pkginfo:
  46. @mkdir -p tmp
  47. @echo Collecting package info...
  48. @-for dir in package/*/; do \
  49. [ -f "$${dir}/Makefile" ] || continue; \
  50. echo Source-Makefile: $${dir}Makefile; \
  51. $(NO_TRACE_MAKE) --no-print-dir DUMP=1 -C $$dir 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2; \
  52. echo; \
  53. done > $@
  54. tmp/.targetinfo:
  55. @mkdir -p tmp
  56. @echo Collecting target info...
  57. @-for dir in target/linux/*/; do \
  58. [ -f "$${dir}/Makefile" ] || continue; \
  59. ( cd "$$dir"; $(NO_TRACE_MAKE) --no-print-dir DUMP=1 3>/dev/null || echo "ERROR: please fix $${dir}Makefile" >&2 ); \
  60. echo; \
  61. done > $@
  62. tmpinfo-clean: FORCE
  63. @-rm -rf tmp/.pkginfo tmp/.targetinfo
  64. tmp/.config.in: tmp/.pkginfo
  65. @./scripts/gen_package_config.pl < $< > $@ || rm -f $@
  66. tmp/.config-target.in: tmp/.targetinfo
  67. @./scripts/gen_target_config.pl < $< > $@ || rm -f $@
  68. .config: ./scripts/config/conf tmp/.config.in tmp/.config-target.in
  69. @[ -f .config ] || $(NO_TRACE_MAKE) menuconfig
  70. @$< -D .config Config.in &> /dev/null
  71. scripts/config/mconf:
  72. @$(MAKE) -C scripts/config all
  73. scripts/config/conf:
  74. @$(MAKE) -C scripts/config conf
  75. config: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
  76. $< Config.in
  77. config-clean: FORCE
  78. $(NO_TRACE_MAKE) -C scripts/config clean
  79. defconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
  80. touch .config
  81. $< -D .config Config.in
  82. oldconfig: scripts/config/conf tmp/.config.in tmp/.config-target.in FORCE
  83. $< -o Config.in
  84. menuconfig: scripts/config/mconf tmp/.config.in tmp/.config-target.in FORCE
  85. $< Config.in
  86. package/%: tmp/.pkginfo tmp/.targetinfo FORCE
  87. $(MAKE) -C package $(patsubst package/%,%,$@)
  88. target/%: tmp/.pkginfo tmp/.targetinfo FORCE
  89. $(MAKE) -C target $(patsubst target/%,%,$@)
  90. tools/%: FORCE
  91. $(MAKE) -C tools $(patsubst tools/%,%,$@)
  92. toolchain/%: tmp/.targetinfo FORCE
  93. $(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
  94. tmp/.prereq-build: include/prereq-build.mk
  95. @mkdir -p tmp
  96. @$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
  97. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  98. false; \
  99. }
  100. @touch $@
  101. tmp/.prereq-packages: include/prereq.mk tmp/.pkginfo .config
  102. @mkdir -p tmp
  103. @$(NO_TRACE_MAKE) -s -C package prereq 2>/dev/null || { \
  104. echo "Prerequisite check failed. Use FORCE=1 to override."; \
  105. false; \
  106. }
  107. @touch $@
  108. prereq: tmp/.prereq-build tmp/.prereq-packages FORCE
  109. download: .config FORCE
  110. $(MAKE) tools/download
  111. $(MAKE) toolchain/download
  112. $(MAKE) package/download
  113. $(MAKE) target/download
  114. world: .config FORCE
  115. $(MAKE) tools/install
  116. $(MAKE) toolchain/install
  117. $(MAKE) target/compile
  118. $(MAKE) package/compile
  119. $(MAKE) package/install
  120. $(MAKE) target/install
  121. $(MAKE) package/index
  122. clean: FORCE
  123. rm -rf build_* bin tmp
  124. dirclean: clean
  125. rm -rf staging_dir_* toolchain_build_* tool_build
  126. distclean: dirclean config-clean
  127. rm -rf dl
  128. .SILENT: clean dirclean distclean config-clean download world
  129. FORCE: ;
  130. .PHONY: FORCE
  131. %: ;