1
0

Makefile 7.1 KB

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