| [021d11b] | 1 | # $FreeWRT: src/share/misc/licence.template,v 1.7 2006/04/09 22:08:49 tg Rel $
|
|---|
| [6d5c7cc] | 2 | #-
|
|---|
| 3 | # Copyright (c) 2006
|
|---|
| 4 | # Thorsten Glaser <tg@mirbsd.de>
|
|---|
| [475ad56] | 5 | #
|
|---|
| [6d5c7cc] | 6 | # Licensee is hereby permitted to deal in this work without restric-
|
|---|
| 7 | # tion, including unlimited rights to use, publicly perform, modify,
|
|---|
| 8 | # merge, distribute, sell, give away or sublicence, provided all co-
|
|---|
| 9 | # pyright notices above, these terms and the disclaimer are retained
|
|---|
| 10 | # in all redistributions or reproduced in accompanying documentation
|
|---|
| 11 | # or other materials provided with binary redistributions.
|
|---|
| [475ad56] | 12 | #
|
|---|
| [6d5c7cc] | 13 | # All advertising materials mentioning features or use of this soft-
|
|---|
| 14 | # ware must display the following acknowledgement:
|
|---|
| 15 | # This product includes material provided by Thorsten Glaser.
|
|---|
| 16 | # This acknowledgement does not need to be reprinted if this work is
|
|---|
| 17 | # linked into a bigger work whose licence does not allow such clause
|
|---|
| 18 | # and the author of this work is given due credit in the bigger work
|
|---|
| 19 | # or its documentation. Specifically, re-using this code in any work
|
|---|
| 20 | # covered by the GNU General Public License version 1 or Library Ge-
|
|---|
| 21 | # neral Public License (any version) is permitted.
|
|---|
| [475ad56] | 22 | #
|
|---|
| [6d5c7cc] | 23 | # Licensor offers the work "AS IS" and WITHOUT WARRANTY of any kind,
|
|---|
| 24 | # express, or implied, to the maximum extent permitted by applicable
|
|---|
| 25 | # law, without malicious intent or gross negligence; in no event may
|
|---|
| 26 | # licensor, an author or contributor be held liable for any indirect
|
|---|
| 27 | # or other damage, or direct damage except proven a consequence of a
|
|---|
| 28 | # direct error of said person and intended use of this work, loss or
|
|---|
| 29 | # other issues arising in any way out of its use, even if advised of
|
|---|
| 30 | # the possibility of such damage or existence of a nontrivial bug.
|
|---|
| 31 |
|
|---|
| 32 | GMAKE?= $(PWD)/lbin/gmake
|
|---|
| [4d98ec5] | 33 | GMAKE_FMK= ${GMAKE} -f $(PWD)/build.mk
|
|---|
| 34 | GMAKE_INV= ${GMAKE_FMK} --no-print-directory
|
|---|
| [6d5c7cc] | 35 |
|
|---|
| [4d98ec5] | 36 | all: .prereq_done
|
|---|
| [8eab46d] | 37 | @${GMAKE_INV} all
|
|---|
| [6d5c7cc] | 38 |
|
|---|
| [4d98ec5] | 39 | v: .prereq_done
|
|---|
| [acf89eb] | 40 | (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \
|
|---|
| [4d98ec5] | 41 | ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log
|
|---|
| [71b4d1c] | 42 |
|
|---|
| [4d98ec5] | 43 | verbose: .prereq_done
|
|---|
| 44 | @${GMAKE_FMK} all V=99
|
|---|
| [aaafd63] | 45 |
|
|---|
| [4d98ec5] | 46 | clean: .prereq_done
|
|---|
| [8eab46d] | 47 | @${GMAKE_INV} clean
|
|---|
| [6d5c7cc] | 48 |
|
|---|
| [4d98ec5] | 49 | config: .prereq_done
|
|---|
| [8eab46d] | 50 | @${GMAKE_INV} config
|
|---|
| [6d5c7cc] | 51 |
|
|---|
| [4d98ec5] | 52 | cleandir: .prereq_done
|
|---|
| [8eab46d] | 53 | @${GMAKE_INV} cleandir
|
|---|
| [41be261] | 54 | @-rm -rf lbin
|
|---|
| [4d98ec5] | 55 | @-rm -f make.log .prereq_done
|
|---|
| [6d5c7cc] | 56 |
|
|---|
| [4d98ec5] | 57 | distclean: .prereq_done
|
|---|
| [8eab46d] | 58 | @${GMAKE_INV} distclean
|
|---|
| [41be261] | 59 | @-rm -rf lbin
|
|---|
| [4d98ec5] | 60 | @-rm -f make.log .prereq_done
|
|---|
| [6d5c7cc] | 61 |
|
|---|
| [4d98ec5] | 62 | image_clean: .prereq_done
|
|---|
| [8eab46d] | 63 | @${GMAKE_INV} image_clean
|
|---|
| [6d5c7cc] | 64 |
|
|---|
| [4d98ec5] | 65 | menuconfig: .prereq_done
|
|---|
| [8eab46d] | 66 | @${GMAKE_INV} menuconfig
|
|---|
| [6d5c7cc] | 67 |
|
|---|
| [4d98ec5] | 68 | oldconfig: .prereq_done
|
|---|
| [8eab46d] | 69 | @${GMAKE_INV} oldconfig
|
|---|
| [6d5c7cc] | 70 |
|
|---|
| [4d98ec5] | 71 | package_index: .prereq_done
|
|---|
| [8eab46d] | 72 | @${GMAKE_INV} package_index
|
|---|
| [6d5c7cc] | 73 |
|
|---|
| [4d98ec5] | 74 | source: .prereq_done
|
|---|
| [8eab46d] | 75 | @${GMAKE_INV} source
|
|---|
| [6d5c7cc] | 76 |
|
|---|
| [4d98ec5] | 77 | target_clean: .prereq_done
|
|---|
| [8eab46d] | 78 | @${GMAKE_INV} target_clean
|
|---|
| [6d5c7cc] | 79 |
|
|---|
| [4d98ec5] | 80 | world: .prereq_done
|
|---|
| [8eab46d] | 81 | @${GMAKE_INV} world
|
|---|
| [6d5c7cc] | 82 |
|
|---|
| [2ff11cb] | 83 | update-package:
|
|---|
| [ce110ba] | 84 | @find target/linux/package package/ -name Config.in -exec \
|
|---|
| 85 | grep -r FWRT_PACKAGE {} \; | \
|
|---|
| [021d11b] | 86 | awk '/config/ { print $$2 }' | sort | grep -v config | \
|
|---|
| 87 | sed -e 's#.*#&=m#' >>.config
|
|---|
| [2ff11cb] | 88 |
|
|---|
| [d813884] | 89 | prereq:
|
|---|
| [4d98ec5] | 90 | @rm -f .prereq_done
|
|---|
| 91 | @${MAKE} .prereq_done
|
|---|
| 92 |
|
|---|
| [d813884] | 93 | prereq-noerror:
|
|---|
| [4d98ec5] | 94 | @rm -f .prereq_done
|
|---|
| 95 | @${MAKE} .prereq_done NO_ERROR=1
|
|---|
| [4ed535c] | 96 |
|
|---|
| 97 | NO_ERROR=0
|
|---|
| [4d98ec5] | 98 | .prereq_done:
|
|---|
| 99 | @-rm -rf .prereq_done lbin
|
|---|
| [86dab31] | 100 | @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
|
|---|
| 101 | echo "FreeWRT requires GNU bash to be installed, sorry."; \
|
|---|
| 102 | exit 1; \
|
|---|
| 103 | fi
|
|---|
| [41be261] | 104 | @mkdir lbin
|
|---|
| [003e3c1] | 105 | @if which nonexistent 2>&1 | grep -q '^no '; then \
|
|---|
| [2856f83] | 106 | cp scripts/which.mac lbin/which; \
|
|---|
| 107 | chmod 555 lbin/which; \
|
|---|
| [6d5c7cc] | 108 | else \
|
|---|
| [2856f83] | 109 | ln -s $$(which which) lbin/which; \
|
|---|
| [6d5c7cc] | 110 | fi
|
|---|
| [2856f83] | 111 | @if lbin/which gmake >/dev/null 2>&1; then \
|
|---|
| 112 | ln -s $$(lbin/which gmake) lbin/gmake; \
|
|---|
| 113 | else \
|
|---|
| 114 | ln -s $$(lbin/which make) lbin/gmake; \
|
|---|
| 115 | fi
|
|---|
| 116 | @if ! lbin/which md5sum >/dev/null 2>&1; then \
|
|---|
| [6d5c7cc] | 117 | cp scripts/md5sum.bsd lbin/md5sum; \
|
|---|
| 118 | chmod 555 lbin/md5sum; \
|
|---|
| 119 | fi
|
|---|
| [b84b14f] | 120 | @if test x"$$(uname)" = x"MirBSD"; then \
|
|---|
| 121 | sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
|
|---|
| [2856f83] | 122 | -e "s!@@PROG@@!$$(lbin/which uname)!g" \
|
|---|
| [b84b14f] | 123 | <scripts/uname.fake >lbin/uname; \
|
|---|
| 124 | chmod 555 lbin/uname; \
|
|---|
| 125 | fi
|
|---|
| [7d9827e] | 126 | @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
|
|---|
| 127 | @echo 'GMAKE:=${GMAKE}' >>lbin/prereq.mk
|
|---|
| 128 | @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
|
|---|
| [2242649] | 129 | -e 's!mirbsd!openbsd!g' \
|
|---|
| 130 | )" >>lbin/prereq.mk
|
|---|
| [7d9827e] | 131 | @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
|
|---|
| [2242649] | 132 | -e 's/sparc.*/sparc/' \
|
|---|
| 133 | -e 's/arm.*/arm/g' \
|
|---|
| 134 | -e 's/m68k.*/m68k/' \
|
|---|
| 135 | -e 's/ppc/powerpc/g' \
|
|---|
| 136 | -e 's/v850.*/v850/g' \
|
|---|
| 137 | -e 's/sh[234]/sh/' \
|
|---|
| 138 | -e 's/mips-.*/mips/' \
|
|---|
| 139 | -e 's/mipsel-.*/mipsel/' \
|
|---|
| 140 | -e 's/cris.*/cris/' \
|
|---|
| 141 | -e 's/i[3-9]86/i386/' \
|
|---|
| 142 | )" >>lbin/prereq.mk
|
|---|
| [7d9827e] | 143 | @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
|
|---|
| [b84b14f] | 144 | @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
|
|---|
| 145 | ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
|
|---|
| 146 | 2>/dev/null | sed 's/^P://')"; \
|
|---|
| [7d9827e] | 147 | echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
|
|---|
| [b84b14f] | 148 | >>lbin/prereq.mk
|
|---|
| [7d9827e] | 149 | @echo 'LC_ALL:=C' >>lbin/prereq.mk
|
|---|
| 150 | @echo 'MAKE:=${GMAKE}' >>lbin/prereq.mk
|
|---|
| 151 | @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
|
|---|
| 152 | @echo "_PATH:=$$PATH" >>lbin/prereq.mk
|
|---|
| 153 | @echo "PATH:=$$(pwd)/lbin:$$PATH" >>lbin/prereq.mk
|
|---|
| 154 | @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
|
|---|
| 155 | @echo "TOPDIR:=$$(readlink -nf .)" >>lbin/prereq.mk
|
|---|
| [4ed535c] | 156 | @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh
|
|---|
| [2856f83] | 157 | @ln -s $$(lbin/which ${CC}) lbin/gcc
|
|---|
| [a7b530b] | 158 | @${GMAKE_INV} tools/install-lbin
|
|---|
| [bc1387d] | 159 | @echo '===> Prerequisites checked successfully.'
|
|---|
| [41be261] | 160 | @touch $@
|
|---|
| [d813884] | 161 |
|
|---|
| 162 | .PHONY: prereq prereq-noerror
|
|---|