Makefile 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. _UNLIMIT= __limit=$$(ulimit -dH 2>/dev/null); \
  4. test -n "$$__limit" && ulimit -Sd $$__limit; ulimit -n 1024;
  5. all: .prereq_done checkreloc
  6. @${_UNLIMIT} ${GMAKE_INV} all
  7. v: .prereq_done
  8. @(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C date)"; \
  9. set -x; ${_UNLIMIT} ${GMAKE_FMK} VERBOSE=1 all) 2>&1 | tee -a make.log
  10. help:
  11. @echo 'Configuration targets:'
  12. @echo ' config - Update current config utilising a line-oriented program'
  13. @echo ' menuconfig - Update current config utilising a menu based program'
  14. @echo ' (default when .config does not exist)'
  15. @echo ' oldconfig - Update current config utilising a provided .configs base'
  16. @echo ' allmodconfig - New config selecting all packages as modules when possible'
  17. @echo ' allconfig - New config selecting all packages when possible'
  18. @echo ' allnoconfig - New config where all options are answered with no'
  19. @echo ''
  20. @echo 'Help targets:'
  21. @echo ' help - Print this help text'
  22. @echo ' pkg-help - Print help about selectively compiling single packages'
  23. @echo ' dev-help - Print help for developers / package maintainers'
  24. @echo ''
  25. @echo 'Common targets:'
  26. @echo ' download - fetches all needed distfiles'
  27. @echo ' kernelconfig - view the target kernel configuration'
  28. @echo ''
  29. @echo 'Cleaning targets:'
  30. @echo ' clean - Remove firmware and build directories'
  31. @echo ' cleandir - Same as "clean", but also remove all built toolchains'
  32. @echo ' cleansystem - Same as "cleandir", but only remove active system'
  33. @echo ' cleankernel - Remove kernel dir, useful if you changed any kernel patches'
  34. @echo ' distclean - Same as "cleandir", but also remove downloaded'
  35. @echo ' distfiles and .config'
  36. @echo ''
  37. @echo 'Other generic targets:'
  38. @echo ' all - Build everything as specified in .config'
  39. @echo ' (default if .config exists)'
  40. @echo ' v - Same as "all" but with logging to make.log enabled'
  41. pkg-help:
  42. @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
  43. @echo ' fetch - Download the necessary distfile'
  44. @echo ' extract - Same as "fetch", but also extract the distfile'
  45. @echo ' patch - Same as "extract", but also patch the source'
  46. @echo ' build - Same as "patch", but also build the binaries'
  47. @echo ' fake - Same as "build", but also install the binaries'
  48. @echo ' package - Same as "fake", but also create the package'
  49. @echo ' clean - Deinstall and remove the build area'
  50. @echo ' distclean - Same as "clean", but also remove the distfiles'
  51. @echo ''
  52. @echo 'Short package rebuilding guide:'
  53. @echo ' run "make package=<pkgname> clean" to remove all generated binaries'
  54. @echo ' run "make package=<pkgname> package" to build everything and create the package(s)'
  55. @echo ''
  56. @echo 'This does not automatically resolve package dependencies!'
  57. dev-help:
  58. @echo 'Fast way of updating package patches:'
  59. @echo ' run "make package=<pkgname> clean" to start with a good base'
  60. @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
  61. @echo ' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
  62. @echo ' run "make package=<pkgname> update-patches" to regenerate patch files'
  63. @echo ''
  64. @echo 'All changed patches will be opened with your $$EDITOR,'
  65. @echo 'so you can add a description and verify the modifications.'
  66. @echo ''
  67. @echo 'Adding a new package:'
  68. @echo 'make PKG=foo VER=1.0 newpackage'
  69. @echo 'Adding a new simple library package:'
  70. @echo 'make PKG=foo VER=1.0 TYPE=lib newpackage'
  71. @echo 'Adding a new simple program package:'
  72. @echo 'make PKG=foo VER=1.0 TYPE=prog newpackage'
  73. clean: .prereq_done
  74. -@rm -f nohup.out
  75. @${GMAKE_INV} clean
  76. config: .prereq_done
  77. @${GMAKE_INV} _config W=
  78. oldconfig: .prereq_done
  79. @${GMAKE_INV} _config W=-o
  80. download: .prereq_done
  81. @${GMAKE_INV} toolchain/download
  82. @${GMAKE_INV} dep
  83. @${GMAKE_INV} package/download
  84. cleankernel kernelclean: .prereq_done
  85. -@${GMAKE_INV} cleankernel
  86. cleandir dirclean: .prereq_done
  87. -@${GMAKE_INV} cleandir
  88. @-rm -f make.log .prereq_done
  89. cleansystem: .prereq_done
  90. -@${GMAKE_INV} cleansystem
  91. @-rm -f make.log .prereq_done
  92. distclean cleandist:
  93. -@${GMAKE_INV} distclean
  94. @-rm -f make.log .prereq_done
  95. image: .prereq_done
  96. @${GMAKE_INV} image
  97. targethelp: .prereq_done
  98. @${GMAKE_INV} targethelp
  99. switch: .prereq_done
  100. @${GMAKE_INV} switch
  101. kernelconfig: .prereq_done
  102. @${GMAKE_INV} kernelconfig
  103. newpackage: .prereq_done
  104. @${GMAKE_INV} newpackage
  105. image_clean imageclean cleanimage: .prereq_done
  106. @${GMAKE_INV} image_clean
  107. menuconfig: .prereq_done
  108. @${GMAKE_INV} menuconfig
  109. defconfig: .prereq_done
  110. @${GMAKE_INV} defconfig
  111. allnoconfig: .prereq_done
  112. @${GMAKE_INV} _config W=-n
  113. allconfig: .prereq_done
  114. @${GMAKE_INV} _mconfig W=-y RCONFIG=Config.in
  115. allmodconfig: .prereq_done
  116. @${GMAKE_INV} _mconfig W=-o RCONFIG=Config.in
  117. package_index: .prereq_done
  118. @${GMAKE_INV} package_index
  119. buildall: .prereq_done
  120. @${GMAKE_INV} buildall
  121. check: .prereq_done
  122. @${GMAKE_INV} check
  123. check-gcc: .prereq_done
  124. @${GMAKE_INV} check-gcc
  125. check-g++: .prereq_done
  126. @${GMAKE_INV} check-g++
  127. menu: .prereq_done
  128. @${GMAKE_INV} menu
  129. dep: .prereq_done
  130. @${GMAKE_INV} dep
  131. world: .prereq_done
  132. @${GMAKE_INV} world
  133. prereq:
  134. @rm -f .prereq_done
  135. @${GMAKE} .prereq_done
  136. prereq-noerror:
  137. @rm -f .prereq_done
  138. @${GMAKE} .prereq_done NO_ERROR=1
  139. NO_ERROR=0
  140. .prereq_done:
  141. @-rm -rf .prereq_done
  142. @if ! bash --version 2>&1 | grep -F 'GNU bash' >/dev/null 2>&1; then \
  143. echo "GNU bash needs to be installed."; \
  144. exit 1; \
  145. fi
  146. @echo "ADK_TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
  147. @echo "BASH:=$$(which bash)" >>prereq.mk
  148. @if [ -z "$$(which gmake 2>/dev/null )" ]; then \
  149. echo "GMAKE:=$$(which make)" >>prereq.mk ;\
  150. else \
  151. echo "GMAKE:=$$(which gmake)" >>prereq.mk ;\
  152. fi
  153. @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
  154. @echo "ARCH_FOR_BUILD:=$$(${CC} -dumpmachine | sed \
  155. -e 's/x86_64-linux-gnux32/x32/' \
  156. -e s'/-.*//' \
  157. -e 's/sparc.*/sparc/' \
  158. -e 's/armeb.*/armeb/g' \
  159. -e 's/arm.*/arm/g' \
  160. -e 's/m68k.*/m68k/' \
  161. -e 's/sh[234]/sh/' \
  162. -e 's/mips-.*/mips/' \
  163. -e 's/mipsel-.*/mipsel/' \
  164. -e 's/i[3-9]86/x86/' \
  165. )" >>prereq.mk
  166. @echo 'HOST_CC:=${CC}' >>prereq.mk
  167. @echo 'HOST_CXX:=${CXX}' >>prereq.mk
  168. @echo 'LANGUAGE:=C' >>prereq.mk
  169. @echo 'LC_ALL:=C' >>prereq.mk
  170. @echo 'MAKE:=$${GMAKE}' >>prereq.mk
  171. @echo "OStype:=$$(env uname)" >>prereq.mk
  172. @echo "_PATH:=$$PATH" >>prereq.mk
  173. @echo "PATH:=\$${ADK_TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
  174. @echo "SHELL:=$$(which bash)" >>prereq.mk
  175. @echo "GIT:=$$(which git 2>/dev/null)" >>prereq.mk
  176. @env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \
  177. CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
  178. bash scripts/scan-tools.sh
  179. @echo '===> Prerequisites checked successfully.'
  180. @touch .adkinit
  181. @touch $@
  182. checkreloc:
  183. @bash scripts/reloc.sh
  184. .PHONY: prereq prereq-noerror checkreloc
  185. # DO NOT DELETE