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