| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
GMAKE?= $(PWD)/lbin/gmake |
|---|
| 8 |
GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk |
|---|
| 9 |
GMAKE_INV= ${GMAKE_FMK} --no-print-directory |
|---|
| 10 |
|
|---|
| 11 |
all: .prereq_done |
|---|
| 12 |
@${GMAKE_INV} all |
|---|
| 13 |
|
|---|
| 14 |
v: .prereq_done |
|---|
| 15 |
(echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \ |
|---|
| 16 |
${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log |
|---|
| 17 |
|
|---|
| 18 |
verbose: .prereq_done |
|---|
| 19 |
@${GMAKE_FMK} all V=99 |
|---|
| 20 |
|
|---|
| 21 |
clean: .prereq_done |
|---|
| 22 |
@${GMAKE_INV} clean |
|---|
| 23 |
|
|---|
| 24 |
cleanbuild: .prereq_done |
|---|
| 25 |
@${GMAKE_INV} cleanbuild |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
config: .prereq_done |
|---|
| 29 |
@${GMAKE_INV} config |
|---|
| 30 |
|
|---|
| 31 |
cleandir: .prereq_done |
|---|
| 32 |
@${GMAKE_INV} cleandir |
|---|
| 33 |
@-rm -rf lbin |
|---|
| 34 |
@-rm -f make.log .prereq_done |
|---|
| 35 |
|
|---|
| 36 |
distclean: .prereq_done |
|---|
| 37 |
@${GMAKE_INV} distclean |
|---|
| 38 |
@-rm -rf lbin |
|---|
| 39 |
@-rm -f make.log .prereq_done |
|---|
| 40 |
|
|---|
| 41 |
image_clean: .prereq_done |
|---|
| 42 |
@${GMAKE_INV} image_clean |
|---|
| 43 |
|
|---|
| 44 |
menuconfig: .prereq_done |
|---|
| 45 |
@${GMAKE_INV} menuconfig |
|---|
| 46 |
|
|---|
| 47 |
allnoconfig: .prereq_done |
|---|
| 48 |
@${GMAKE_INV} allnoconfig |
|---|
| 49 |
|
|---|
| 50 |
allmodconfig: .prereq_done |
|---|
| 51 |
@${GMAKE_INV} allmodconfig |
|---|
| 52 |
|
|---|
| 53 |
snapshotconfig: .prereq_done |
|---|
| 54 |
@${GMAKE_INV} snapshotconfig |
|---|
| 55 |
|
|---|
| 56 |
package_index: .prereq_done |
|---|
| 57 |
@${GMAKE_INV} package_index |
|---|
| 58 |
|
|---|
| 59 |
target_clean: .prereq_done |
|---|
| 60 |
@${GMAKE_INV} target_clean |
|---|
| 61 |
|
|---|
| 62 |
world: .prereq_done |
|---|
| 63 |
@${GMAKE_INV} world |
|---|
| 64 |
|
|---|
| 65 |
allpackages: .prereq_done |
|---|
| 66 |
@${GMAKE_INV} allpackages |
|---|
| 67 |
|
|---|
| 68 |
prereq: |
|---|
| 69 |
@rm -f .prereq_done |
|---|
| 70 |
@${MAKE} .prereq_done |
|---|
| 71 |
|
|---|
| 72 |
prereq-noerror: |
|---|
| 73 |
@rm -f .prereq_done |
|---|
| 74 |
@${MAKE} .prereq_done NO_ERROR=1 |
|---|
| 75 |
|
|---|
| 76 |
NO_ERROR=0 |
|---|
| 77 |
.prereq_done: |
|---|
| 78 |
@-rm -rf .prereq_done lbin |
|---|
| 79 |
@if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \ |
|---|
| 80 |
echo "FreeWRT requires GNU bash to be installed, sorry."; \ |
|---|
| 81 |
exit 1; \ |
|---|
| 82 |
fi |
|---|
| 83 |
@mkdir lbin |
|---|
| 84 |
@if which nonexistent 2>&1 | grep -q '^no '; then \ |
|---|
| 85 |
cp scripts/which.mac lbin/which; \ |
|---|
| 86 |
chmod 555 lbin/which; \ |
|---|
| 87 |
else \ |
|---|
| 88 |
ln -s $$(which which) lbin/which; \ |
|---|
| 89 |
fi |
|---|
| 90 |
@if lbin/which gmake >/dev/null 2>&1; then \ |
|---|
| 91 |
ln -s $$(lbin/which gmake) lbin/gmake; \ |
|---|
| 92 |
else \ |
|---|
| 93 |
ln -s $$(lbin/which make) lbin/gmake; \ |
|---|
| 94 |
fi |
|---|
| 95 |
@if ! lbin/which md5sum >/dev/null 2>&1; then \ |
|---|
| 96 |
cp scripts/md5sum.bsd lbin/md5sum; \ |
|---|
| 97 |
chmod 555 lbin/md5sum; \ |
|---|
| 98 |
fi |
|---|
| 99 |
@if test x"$$(uname)" = x"MirBSD"; then \ |
|---|
| 100 |
sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \ |
|---|
| 101 |
-e "s!@@PROG@@!$$(lbin/which uname)!g" \ |
|---|
| 102 |
<scripts/uname.fake >lbin/uname; \ |
|---|
| 103 |
chmod 555 lbin/uname; \ |
|---|
| 104 |
fi |
|---|
| 105 |
@echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk |
|---|
| 106 |
@echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk |
|---|
| 107 |
@echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk |
|---|
| 108 |
@echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \ |
|---|
| 109 |
-e 's!mirbsd!openbsd!g' \ |
|---|
| 110 |
)" >>lbin/prereq.mk |
|---|
| 111 |
@echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \ |
|---|
| 112 |
-e 's/sparc.*/sparc/' \ |
|---|
| 113 |
-e 's/arm.*/arm/g' \ |
|---|
| 114 |
-e 's/m68k.*/m68k/' \ |
|---|
| 115 |
-e 's/ppc/powerpc/g' \ |
|---|
| 116 |
-e 's/v850.*/v850/g' \ |
|---|
| 117 |
-e 's/sh[234]/sh/' \ |
|---|
| 118 |
-e 's/mips-.*/mips/' \ |
|---|
| 119 |
-e 's/mipsel-.*/mipsel/' \ |
|---|
| 120 |
-e 's/cris.*/cris/' \ |
|---|
| 121 |
-e 's/i[3-9]86/i386/' \ |
|---|
| 122 |
)" >>lbin/prereq.mk |
|---|
| 123 |
@echo 'HOSTCC:=${CC}' >>lbin/prereq.mk |
|---|
| 124 |
@x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \ |
|---|
| 125 |
${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \ |
|---|
| 126 |
2>/dev/null | sed 's/^P://')"; \ |
|---|
| 127 |
echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \ |
|---|
| 128 |
>>lbin/prereq.mk |
|---|
| 129 |
@echo 'LC_ALL:=C' >>lbin/prereq.mk |
|---|
| 130 |
@echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk |
|---|
| 131 |
@echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk |
|---|
| 132 |
@echo "_PATH:=$$PATH" >>lbin/prereq.mk |
|---|
| 133 |
@echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk |
|---|
| 134 |
@echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk |
|---|
| 135 |
@TOPDIR=$$(readlink -nf .); \ |
|---|
| 136 |
printf '%s\n%s\nwq\n' "%g#$$TOPDIR#s##\$${TOPDIR}#g" \ |
|---|
| 137 |
"1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk |
|---|
| 138 |
@env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh |
|---|
| 139 |
@ln -s $$(lbin/which ${CC}) lbin/gcc |
|---|
| 140 |
@${GMAKE_INV} tools/install-lbin |
|---|
| 141 |
@echo '===> Prerequisites checked successfully.' |
|---|
| 142 |
@touch $@ |
|---|
| 143 |
|
|---|
| 144 |
.PHONY: prereq prereq-noerror |
|---|