install linkable library link
[openadk.git] / Makefile
blobd1a29bd8198ad07244bcb9dda63e7ae7e95e834e
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 -dS $$__limit;
7 all: .prereq_done
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 'Common targets:'
16 @echo ' switch TARGET=targetname - Backup current config and copy old saved target config'
17 @echo ' download - fetches all needed distfiles'
18 @echo 'Cleaning targets:'
19 @echo ' clean - Remove bin and build_dir directories'
20 @echo ' cleantarget - Same as "clean", but also remove toolchain for target'
21 @echo ' cleandir - Same as "clean", but also remove all built toolchains'
22 @echo ' cleankernel - Remove kernel dir, useful if you changed any kernel patches'
23 @echo ' distclean - Same as "cleandir", but also remove downloaded'
24 @echo ' distfiles and .config'
25 @echo ''
26 @echo 'Configuration targets:'
27 @echo ' config - Update current config utilising a line-oriented program'
28 @echo ' menuconfig - Update current config utilising a menu based program'
29 @echo ' guiconfig - Update current config utilising a gui based program'
30 @echo ' (default when .config does not exist)'
31 @echo ' oldconfig - Update current config utilising a provided .configs base'
32 @echo ' allmodconfig - New config selecting all packages as modules when possible'
33 @echo ' allconfig - New config selecting all packages when possible'
34 @echo ' allnoconfig - New config where all options are answered with no'
35 @echo ' kernelconfig - Modify the target kernel configuration'
36 @echo ''
37 @echo 'Help targets:'
38 @echo ' help - Print this help text'
39 @echo ' pkg-help - Print help about selectively compiling single packages'
40 @echo ' dev-help - Print help for developers / package maintainers'
41 @echo ''
42 @echo 'Other generic targets:'
43 @echo ' all - Build everything as specified in .config'
44 @echo ' (default if .config exists)'
45 @echo ' v - Same as "all" but with logging to make.log enabled'
47 pkg-help:
48 @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
49 @echo ' fetch - Download the necessary distfile'
50 @echo ' extract - Same as "fetch", but also extract the distfile'
51 @echo ' patch - Same as "extract", but also patch the source'
52 @echo ' build - Same as "patch", but also build the binaries'
53 @echo ' fake - Same as "build", but also install the binaries'
54 @echo ' package - Same as "fake", but also create the package'
55 @echo ' clean - Deinstall and remove the build area'
56 @echo ' distclean - Same as "clean", but also remove the distfiles'
57 @echo ''
58 @echo 'Short package rebuilding guide:'
59 @echo ' run "make package=<pkgname> clean" to remove all generated binaries'
60 @echo ' run "make package=<pkgname> package" to build everything and create the package(s)'
61 @echo ''
62 @echo 'This does not automatically resolve package dependencies!'
64 dev-help:
65 @echo 'Fast way of updating package patches:'
66 @echo ' run "make package=<pkgname> clean" to start with a good base'
67 @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
68 @echo ' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
69 @echo ' run "make package=<pkgname> update-patches" to regenerate patch files'
70 @echo ''
71 @echo 'All changed patches will be opened with your $$EDITOR,'
72 @echo 'so you can add a description and verify the modifications.'
73 @echo ''
74 @echo 'Adding a new package:'
75 @echo 'make PKG=foo VER=1.0 newpackage'
77 clean: .prereq_done
78 -@rm -f nohup.out
79 @${GMAKE_INV} clean
81 config: .prereq_done
82 @${GMAKE_INV} _config W=
84 oldconfig: .prereq_done
85 @${GMAKE_INV} _config W=-o
87 download: .prereq_done
88 @${GMAKE_INV} toolchain/download
89 @${GMAKE_INV} package/download
91 cleankernel kernelclean: .prereq_done
92 -@${GMAKE_INV} cleankernel
94 cleandir dirclean: .prereq_done
95 -@${GMAKE_INV} cleandir
96 @-rm -f make.log .prereq_done
98 cleantarget targetclean: .prereq_done
99 -@${GMAKE_INV} cleantarget
100 @-rm -f make.log
102 distclean cleandist:
103 -@${GMAKE_INV} distclean
104 @-rm -f make.log .prereq_done
106 image: .prereq_done
107 @${GMAKE_INV} image
109 switch: .prereq_done
110 @${GMAKE_INV} switch
112 kernelconfig: .prereq_done
113 @${GMAKE_INV} kernelconfig
115 newpackage: .prereq_done
116 @${GMAKE_INV} newpackage
118 image_clean imageclean cleanimage: .prereq_done
119 @${GMAKE_INV} image_clean
121 menuconfig: .prereq_done
122 @${GMAKE_INV} menuconfig
124 guiconfig: .prereq_done
125 @${GMAKE_INV} guiconfig
127 defconfig: .prereq_done
128 @${GMAKE_INV} defconfig
130 allnoconfig: .prereq_done
131 @${GMAKE_INV} _config W=-n
133 allconfig: .prereq_done
134 @${GMAKE_INV} _mconfig W=-y RCONFIG=Config.in
136 allmodconfig: .prereq_done
137 @${GMAKE_INV} _mconfig W=-o RCONFIG=Config.in
139 package_index: .prereq_done
140 @${GMAKE_INV} package_index
142 bulk: .prereq_done
143 @${GMAKE_INV} bulk
145 bulktoolchain: .prereq_done
146 @${GMAKE_INV} bulktoolchain
148 bulkall: .prereq_done
149 @${GMAKE_INV} bulkall
151 bulkallmod: .prereq_done
152 @${GMAKE_INV} bulkallmod
154 check: .prereq_done
155 @${GMAKE_INV} check
157 menu: .prereq_done
158 @${GMAKE_INV} menu
160 dep: .prereq_done
161 @${GMAKE_INV} dep
163 world: .prereq_done
164 @${GMAKE_INV} world
166 prereq:
167 @rm -f .prereq_done
168 @${GMAKE} .prereq_done
170 prereq-noerror:
171 @rm -f .prereq_done
172 @${GMAKE} .prereq_done NO_ERROR=1
174 NO_ERROR=0
175 .prereq_done:
176 @-rm -rf .prereq_done
177 @if ! bash --version 2>&1 | grep -F 'GNU bash' >/dev/null 2>&1; then \
178 echo "GNU bash needs to be installed."; \
179 exit 1; \
181 @if test x"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x"OK"; then \
182 echo >&2 Error: you must build with umask 022, sorry.; \
183 exit 1; \
185 @echo "TOPDIR:=$$(readlink -nf . 2>/dev/null || pwd -P)" >prereq.mk
186 @echo "BASH:=$$(which bash)" >>prereq.mk
187 @if [ -z "$$(which gmake 2>/dev/null )" ]; then \
188 echo "GMAKE:=$$(which make)" >>prereq.mk ;\
189 else \
190 echo "GMAKE:=$$(which gmake)" >>prereq.mk ;\
192 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine)" >>prereq.mk
193 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
194 -e 's/sparc.*/sparc/' \
195 -e 's/arm.*/arm/g' \
196 -e 's/m68k.*/m68k/' \
197 -e 's/ppc/powerpc/g' \
198 -e 's/v850.*/v850/g' \
199 -e 's/sh[234]/sh/' \
200 -e 's/mips-.*/mips/' \
201 -e 's/mipsel-.*/mipsel/' \
202 -e 's/cris.*/cris/' \
203 -e 's/i[3-9]86/i386/' \
204 )" >>prereq.mk
205 @echo 'HOSTCC:=${CC}' >>prereq.mk
206 @echo 'HOSTCFLAGS:=-O2' >>prereq.mk
207 @echo 'HOSTCXX:=${CXX}' >>prereq.mk
208 @echo 'HOSTCXXFLAGS:=-O2' >>prereq.mk
209 @echo "HOST_LIBIDL_CONFIG:=$$(which libIDL-config-2)" >>prereq.mk
210 @echo 'LANGUAGE:=C' >>prereq.mk
211 @echo 'LC_ALL:=C' >>prereq.mk
212 @echo 'MAKE:=$${GMAKE}' >>prereq.mk
213 @echo "OStype:=$$(env uname)" >>prereq.mk
214 @echo "ADKtype:=$$(cat /etc/adktarget 2>/dev/null)" >>prereq.mk
215 @echo "_PATH:=$$PATH" >>prereq.mk
216 @echo "PATH:=\$${TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk
217 @echo "SHELL:=$$(which bash)" >>prereq.mk
218 @env NO_ERROR=${NO_ERROR} BASH="$$(which bash)" \
219 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
220 bash scripts/scan-tools.sh
221 @echo '===> Prerequisites checked successfully.'
222 @touch .adkinit
223 @touch $@
225 .PHONY: prereq prereq-noerror