1
0

Makefile 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 -dS $$__limit;
  5. all: checkreloc .prereq_done
  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 ' guiconfig - Update current config utilising a gui based program'
  16. @echo ' oldconfig - Update current config utilising a provided .configs base'
  17. @echo ' allmodconfig - New config selecting all packages as modules when possible'
  18. @echo ' allconfig - New config selecting all packages when possible'
  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 ' switch ARCH=arch SYSTEM=system - Backup current config and copy old saved target config'
  28. @echo ' download - fetches all needed distfiles'
  29. @echo ' kernelconfig - Modify the target kernel configuration'
  30. @echo ''
  31. @echo 'Cleaning targets:'
  32. @echo ' clean - Remove bin and build_dir directories'
  33. @echo ' cleantarget - Same as "clean", but also remove toolchain for target'
  34. @echo ' cleandir - Same as "clean", but also remove all built toolchains'
  35. @echo ' cleankernel - Remove kernel dir, useful if you changed any kernel patches'
  36. @echo ' distclean - Same as "cleandir", but also remove downloaded'
  37. @echo ' distfiles and .config'
  38. @echo ''
  39. @echo 'Other generic targets:'
  40. @echo ' all - Build everything as specified in .config'
  41. @echo ' (default if .config exists)'
  42. @echo ' v - Same as "all" but with logging to make.log enabled'
  43. pkg-help:
  44. @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
  45. @echo ' fetch - Download the necessary distfile'
  46. @echo ' extract - Same as "fetch", but also extract the distfile'
  47. @echo ' patch - Same as "extract", but also patch the source'
  48. @echo ' build - Same as "patch", but also build the binaries'
  49. @echo ' fake - Same as "build", but also install the binaries'
  50. @echo ' package - Same as "fake", but also create the package'
  51. @echo ' clean - Deinstall and remove the build area'
  52. @echo ' distclean - Same as "clean", but also remove the distfiles'
  53. @echo ''
  54. @echo 'Short package rebuilding guide:'
  55. @echo ' run "make package=<pkgname> clean" to remove all generated binaries'
  56. @echo ' run "make package=<pkgname> package" to build everything and create the package(s)'
  57. @echo ''
  58. @echo 'This does not automatically resolve package dependencies!'
  59. dev-help:
  60. @echo 'Fast way of updating package patches:'
  61. @echo ' run "make package=<pkgname> clean" to start with a good base'
  62. @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
  63. @echo ' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
  64. @echo ' run "make package=<pkgname> update-patches" to regenerate patch files'
  65. @echo ''
  66. @echo 'All changed patches will be opened with your $$EDITOR,'
  67. @echo 'so you can add a description and verify the modifications.'
  68. @echo ''
  69. @echo 'Adding a new package:'
  70. @echo 'make PKG=foo VER=1.0 newpackage'
  71. clean: .prereq_done
  72. -@rm -f nohup.out
  73. @${GMAKE_INV} clean
  74. config: .prereq_done
  75. @${GMAKE_INV} _config W=
  76. oldconfig: .prereq_done
  77. @${GMAKE_INV} _config W=-o
  78. download: .prereq_done
  79. @${GMAKE_INV} toolchain/download
  80. @${GMAKE_INV} package/download
  81. cleankernel kernelclean: .prereq_done
  82. -@${GMAKE_INV} cleankernel
  83. cleandir dirclean: .prereq_done
  84. -@${GMAKE_INV} cleandir
  85. @-rm -f make.log .prereq_done
  86. cleantarget targetclean: .prereq_done
  87. -@${GMAKE_INV} cleantarget
  88. @-rm -f make.log
  89. distclean cleandist:
  90. -@${GMAKE_INV} distclean
  91. @-rm -f make.log .prereq_done
  92. image: .prereq_done
  93. @${GMAKE_INV} image
  94. switch: .prereq_done
  95. @${GMAKE_INV} switch
  96. kernelconfig: .prereq_done
  97. @${GMAKE_INV} kernelconfig
  98. newpackage: .prereq_done
  99. @${GMAKE_INV} newpackage
  100. image_clean imageclean cleanimage: .prereq_done
  101. @${GMAKE_INV} image_clean
  102. menuconfig: .prereq_done
  103. @${GMAKE_INV} menuconfig
  104. guiconfig: .prereq_done
  105. @${GMAKE_INV} guiconfig
  106. defconfig: .prereq_done
  107. @${GMAKE_INV} defconfig
  108. allnoconfig: .prereq_done
  109. @${GMAKE_INV} _config W=-n
  110. allconfig: .prereq_done
  111. @${GMAKE_INV} _mconfig W=-y RCONFIG=Config.in
  112. allmodconfig: .prereq_done
  113. @${GMAKE_INV} _mconfig W=-o RCONFIG=Config.in
  114. package_index: .prereq_done
  115. @${GMAKE_INV} package_index
  116. bulk: .prereq_done
  117. @${GMAKE_INV} bulk
  118. bulktoolchain: .prereq_done
  119. @${GMAKE_INV} bulktoolchain
  120. bulkall: .prereq_done
  121. @${GMAKE_INV} bulkall
  122. bulkallmod: .prereq_done
  123. @${GMAKE_INV} bulkallmod
  124. check: .prereq_done
  125. @${GMAKE_INV} check
  126. menu: .prereq_done
  127. @${GMAKE_INV} menu
  128. dep: .prereq_done
  129. @${GMAKE_INV} dep
  130. world: .prereq_done
  131. @${GMAKE_INV} world
  132. prereq:
  133. @rm -f .prereq_done
  134. @${GMAKE} .prereq_done
  135. prereq-noerror:
  136. @rm -f .prereq_done
  137. @${GMAKE} .prereq_done NO_ERROR=1
  138. NO_ERROR=0
  139. .prereq_done:
  140. @-rm -rf .prereq_done
  141. @if ! bash --version 2>&1 | grep -F 'GNU bash' >/dev/null 2>&1; then \
  142. echo "GNU bash needs to be installed."; \
  143. exit 1; \
  144. fi
  145. @if test x"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x"OK"; then \
  146. echo >&2 Error: you must build with umask 022, sorry.; \
  147. exit 1; \
  148. fi
  149. @echo "TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
  150. @echo "BASH:=$$(which bash)" >>prereq.mk
  151. @if [ -z "$$(which gmake 2>/dev/null )" ]; then \
  152. echo "GMAKE:=$$(which make)" >>prereq.mk ;\
  153. else \
  154. echo "GMAKE:=$$(which gmake)" >>prereq.mk ;\
  155. fi
  156. @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
  157. @echo "HOSTARCH:=$$(${CC} -dumpmachine | sed -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/v850.*/v850/g' \
  163. -e 's/sh[234]/sh/' \
  164. -e 's/mips-.*/mips/' \
  165. -e 's/mipsel-.*/mipsel/' \
  166. -e 's/cris.*/cris/' \
  167. -e 's/i[3-9]86/x86/' \
  168. )" >>prereq.mk
  169. @echo 'CC_FOR_BUILD:=${CC}' >>prereq.mk
  170. @echo 'CXX_FOR_BUILD:=${CXX}' >>prereq.mk
  171. @echo 'HOSTCC:=${CC}' >>prereq.mk
  172. @echo 'HOSTCXX:=${CXX}' >>prereq.mk
  173. @echo 'LANGUAGE:=C' >>prereq.mk
  174. @echo 'LC_ALL:=C' >>prereq.mk
  175. @echo 'MAKE:=$${GMAKE}' >>prereq.mk
  176. @echo "OStype:=$$(env uname)" >>prereq.mk
  177. @echo "ADKtype:=$$(cat /etc/adktarget 2>/dev/null)" >>prereq.mk
  178. @echo "_PATH:=$$PATH" >>prereq.mk
  179. @echo "PATH:=\$${TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
  180. @echo "SHELL:=$$(which bash)" >>prereq.mk
  181. @echo "BUILD_LIBIDL_CONFIG:=$$(which libIDL-config-2 2>/dev/null)" >>prereq.mk
  182. @echo "PKG_HOSTLIB_DIR=$$(eval pkg-config --variable pc_path pkg-config 2>/dev/null)" >/dev/null
  183. @echo "PKG_HOSTLIB_DIR:=$${PKG_HOSTLIB_DIR:-/usr/lib/pkgconfig}" >>prereq.mk
  184. @env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \
  185. CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
  186. bash scripts/scan-tools.sh
  187. @echo '===> Prerequisites checked successfully.'
  188. @bash scripts/create-sys
  189. @bash scripts/create-pkg
  190. @touch .adkinit
  191. @touch $@
  192. checkreloc:
  193. @bash scripts/reloc.sh
  194. .PHONY: prereq prereq-noerror checkreloc