source: freewrt/Makefile@ f855d85

Last change on this file since f855d85 was af75d5a, checked in by Thorsten Glaser <tg@…>, 19 years ago

some wording fixes, 80-column limit, and “make package=foo” will NEVER
resolve dependencies. description of update-patches was already here @wbx

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2510 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 6.7 KB
Line 
1# $FreeWRT$
2#-
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6
7GMAKE?= $(PWD)/lbin/gmake
8GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk
9GMAKE_INV= ${GMAKE_FMK} V=99
10
11all verbose: .prereq_done
12 @${GMAKE_INV} all
13
14v: .prereq_done
15 @(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C TZ=UTC date)"; \
16 set -x; ${GMAKE_FMK} V=99 all) 2>&1 | tee -a make.log
17
18# this is not to be called by the user
19v_q: .prereq_done
20 @(echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C TZ=UTC date)"; \
21 set -x; ${GMAKE_FMK} V=99 all) >>make.log 2>&1
22
23slow:
24 @(nohup make v_q 2>&- & while sleep 2; do tail -n 3 make.log; done; :)
25
26help:
27 @echo 'Cleaning targets:'
28 @echo ' clean - Remove bin and build_dir directories'
29 @echo ' cleandir - Same as "clean", but also remove built toolchain'
30 @echo ' distclean - Same as "cleandir", but also remove downloaded'
31 @echo ' distfiles and .config'
32 @echo ''
33 @echo 'Configuration targets:'
34 @echo ' config - Update current config utilising a line-oriented program'
35 @echo ' menuconfig - Update current config utilising a menu based program'
36 @echo ' (default when .config does not exist)'
37 @echo ' oldconfig - Update current config utilising a provided .configs base'
38 @echo ' allmodconfig - New config selecting modules when possible'
39 @echo ' allnoconfig - New config where all options are answered with no'
40 @echo ''
41 @echo 'Help targets:'
42 @echo ' help - Print this help text'
43 @echo ' pkg-help - Print help about selectively compiling single packages'
44 @echo ' dev-help - Print help for developers / package maintainers'
45 @echo ''
46 @echo 'Other generic targets:'
47 @echo ' all - Build everything as specified in .config'
48 @echo ' (default if .config exists)'
49 @echo ' v - Same as "all" but with logging to make.log enabled'
50 @echo ' slow - Same, but with sparse output for slow serial lines'
51
52pkg-help:
53 @echo 'Package specific targets (use with "package=<pkg-name>" parameter):'
54 @echo ' fetch - Download the necessary distfile'
55 @echo ' extract - Same as "fetch", but also extract the distfile'
56 @echo ' patch - Same as "extract", but also patch the source'
57 @echo ' build - Same as "patch", but also build the binaries'
58 @echo ' fake - Same as "build", but also install the binaries'
59 @echo ' package - Same as "fake", but also create the ipkg package'
60 @echo ''
61 @echo 'Short package rebuilding guide:'
62 @echo ' run "make package=<pkgname> clean" to remove all generated binaries'
63 @echo ' run "make package=<pkgname> package" to build everything and create the ipkg'
64 @echo ''
65 @echo 'This does not automatically resolve package dependencies!'
66
67dev-help:
68 @echo 'Fast way of updating package patches:'
69 @echo ' run "make package=<pkgname> clean" to start with a good base'
70 @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source'
71 @echo ' edit the package sources at build_dir/w-<pkgname>-*/<pkgname>-<version>'
72 @echo ' run "make package=<pkgname> update-patches to regenerate patch files'
73 @echo ''
74 @echo 'All changed patches will be opened with your $$EDITOR,'
75 @echo 'so you can add a description and verify the modifications.'
76
77clean: .prereq_done
78 -rm -f nohup.out
79 @${GMAKE_INV} clean
80
81config: .prereq_done
82 @${GMAKE_INV} config
83
84oldconfig: .prereq_done
85 @${GMAKE_INV} oldconfig
86
87cleandir: .prereq_done
88 @${GMAKE_INV} cleandir
89 @-rm -rf lbin
90 @-rm -f make.log .prereq_done
91
92distclean: .prereq_done
93 @${GMAKE_INV} distclean
94 @-rm -rf lbin
95 @-rm -f make.log .prereq_done
96
97image_clean: .prereq_done
98 @${GMAKE_INV} image_clean
99
100menuconfig: .prereq_done
101 @${GMAKE_INV} menuconfig
102
103allnoconfig: .prereq_done
104 @${GMAKE_INV} allnoconfig
105
106allmodconfig: .prereq_done
107 @${GMAKE_INV} allmodconfig
108
109snapshotconfig: .prereq_done
110 @${GMAKE_INV} snapshotconfig
111
112package_index: .prereq_done
113 @${GMAKE_INV} package_index
114
115target_clean: .prereq_done
116 @${GMAKE_INV} target_clean
117
118world: .prereq_done
119 @${GMAKE_INV} world
120
121prereq:
122 @rm -f .prereq_done
123 @${MAKE} .prereq_done
124
125prereq-noerror:
126 @rm -f .prereq_done
127 @${MAKE} .prereq_done NO_ERROR=1
128
129NO_ERROR=0
130.prereq_done:
131 @-rm -rf .prereq_done lbin
132 @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
133 echo "FreeWRT requires GNU bash to be installed, sorry."; \
134 exit 1; \
135 fi
136 @mkdir lbin
137 @if which nonexistent 2>&1 | grep -q '^no '; then \
138 cp scripts/which.mac lbin/which; \
139 chmod 555 lbin/which; \
140 else \
141 ln -s $$(which which) lbin/which; \
142 fi
143 @if ! lbin/which md5sum >/dev/null 2>&1; then \
144 cp scripts/md5sum.bsd lbin/md5sum; \
145 chmod 555 lbin/md5sum; \
146 fi
147 @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
148 @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
149 @if lbin/which mksh >/dev/null 2>&1; then \
150 echo "MBSH:=$$(lbin/which mksh)" >>lbin/prereq.mk; \
151 else \
152 echo "MBSH:=$$(lbin/which bash)" >>lbin/prereq.mk; \
153 fi
154 @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
155 @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
156 -e 's!mirbsd!openbsd!g' \
157 )" >>lbin/prereq.mk
158 @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
159 -e 's/sparc.*/sparc/' \
160 -e 's/arm.*/arm/g' \
161 -e 's/m68k.*/m68k/' \
162 -e 's/ppc/powerpc/g' \
163 -e 's/v850.*/v850/g' \
164 -e 's/sh[234]/sh/' \
165 -e 's/mips-.*/mips/' \
166 -e 's/mipsel-.*/mipsel/' \
167 -e 's/cris.*/cris/' \
168 -e 's/i[3-9]86/i386/' \
169 )" >>lbin/prereq.mk
170 @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
171 @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
172 ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
173 2>/dev/null | sed 's/^P://')"; y='${CFLAGS}'; echo \
174 "HOSTCFLAGS:=$${x:-$${y:--O2}}" | sed 's/ *$$//' >>lbin/prereq.mk
175 @echo 'LANGUAGE:=C' >>lbin/prereq.mk
176 @echo 'LC_ALL:=C' >>lbin/prereq.mk
177 @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
178 @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
179 @echo "_PATH:=$$PATH" >>lbin/prereq.mk
180 @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
181 @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
182 @TOPDIR=$$(readlink -nf .); \
183 printf '%s\n%s\nwq\n' ",g#$$TOPDIR#s##\$${TOPDIR}#g" \
184 "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
185 @env NO_ERROR=${NO_ERROR} BASH="$$(lbin/which bash)" \
186 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \
187 bash ${_PX} scripts/scan-tools.sh
188 @cc='${CC}'; if test x"$$cc" = x"gcc"; then \
189 ln -s $$(lbin/which "$$cc") lbin/gcc; \
190 else \
191 ( echo "#!$$(lbin/which bash)"; \
192 echo "export PATH=$$PATH"; \
193 echo "exec $$cc" '"$$@"' ) >lbin/gcc; \
194 chmod 555 lbin/gcc; \
195 fi
196 @${GMAKE_INV} tools/install-lbin
197 @echo '===> Prerequisites checked successfully.'
198 @touch $@
199
200.PHONY: prereq prereq-noerror
Note: See TracBrowser for help on using the repository browser.