| 1 | # $FreeWRT: src/share/misc/licence.template,v 1.7 2006/04/09 22:08:49 tg Rel $ */
|
|---|
| 2 | #-
|
|---|
| 3 | # Copyright (c) 2006
|
|---|
| 4 | # Thorsten Glaser <tg@mirbsd.de>
|
|---|
| 5 | #
|
|---|
| 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.
|
|---|
| 12 | #
|
|---|
| 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.
|
|---|
| 22 | #
|
|---|
| 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
|
|---|
| 33 | GMAKE_FMK= ${GMAKE} -f $(PWD)/build.mk
|
|---|
| 34 | GMAKE_INV= ${GMAKE_FMK} --no-print-directory
|
|---|
| 35 |
|
|---|
| 36 | all: .prereq_done
|
|---|
| 37 | @${GMAKE_INV} all
|
|---|
| 38 |
|
|---|
| 39 | v: .prereq_done
|
|---|
| 40 | (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \
|
|---|
| 41 | ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log
|
|---|
| 42 |
|
|---|
| 43 | verbose: .prereq_done
|
|---|
| 44 | @${GMAKE_FMK} all V=99
|
|---|
| 45 |
|
|---|
| 46 | clean: .prereq_done
|
|---|
| 47 | @${GMAKE_INV} clean
|
|---|
| 48 |
|
|---|
| 49 | config: .prereq_done
|
|---|
| 50 | @${GMAKE_INV} config
|
|---|
| 51 |
|
|---|
| 52 | cleandir: .prereq_done
|
|---|
| 53 | @${GMAKE_INV} cleandir
|
|---|
| 54 | @-rm -rf lbin
|
|---|
| 55 | @-rm -f make.log .prereq_done
|
|---|
| 56 |
|
|---|
| 57 | distclean: .prereq_done
|
|---|
| 58 | @${GMAKE_INV} distclean
|
|---|
| 59 | @-rm -rf lbin
|
|---|
| 60 | @-rm -f make.log .prereq_done
|
|---|
| 61 |
|
|---|
| 62 | image_clean: .prereq_done
|
|---|
| 63 | @${GMAKE_INV} image_clean
|
|---|
| 64 |
|
|---|
| 65 | menuconfig: .prereq_done
|
|---|
| 66 | @${GMAKE_INV} menuconfig
|
|---|
| 67 |
|
|---|
| 68 | oldconfig: .prereq_done
|
|---|
| 69 | @${GMAKE_INV} oldconfig
|
|---|
| 70 |
|
|---|
| 71 | package_index: .prereq_done
|
|---|
| 72 | @${GMAKE_INV} package_index
|
|---|
| 73 |
|
|---|
| 74 | source: .prereq_done
|
|---|
| 75 | @${GMAKE_INV} source
|
|---|
| 76 |
|
|---|
| 77 | target_clean: .prereq_done
|
|---|
| 78 | @${GMAKE_INV} target_clean
|
|---|
| 79 |
|
|---|
| 80 | world: .prereq_done
|
|---|
| 81 | @${GMAKE_INV} world
|
|---|
| 82 |
|
|---|
| 83 | prereq:
|
|---|
| 84 | @rm -f .prereq_done
|
|---|
| 85 | @${MAKE} .prereq_done
|
|---|
| 86 |
|
|---|
| 87 | prereq-noerror:
|
|---|
| 88 | @rm -f .prereq_done
|
|---|
| 89 | @${MAKE} .prereq_done NO_ERROR=1
|
|---|
| 90 |
|
|---|
| 91 | NO_ERROR=0
|
|---|
| 92 | .prereq_done:
|
|---|
| 93 | @-rm -rf .prereq_done lbin
|
|---|
| 94 | @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
|
|---|
| 95 | echo "FreeWRT requires GNU bash to be installed, sorry."; \
|
|---|
| 96 | exit 1; \
|
|---|
| 97 | fi
|
|---|
| 98 | @mkdir lbin
|
|---|
| 99 | @if which gmake >/dev/null 2>&1; then \
|
|---|
| 100 | ln -s $$(which gmake) lbin/gmake; \
|
|---|
| 101 | else \
|
|---|
| 102 | ln -s $$(which make) lbin/gmake; \
|
|---|
| 103 | fi
|
|---|
| 104 | @if which gtar >/dev/null 2>&1; then \
|
|---|
| 105 | ln -s $$(which gtar) lbin/tar; \
|
|---|
| 106 | else \
|
|---|
| 107 | ln -s $$(which tar) lbin/tar; \
|
|---|
| 108 | fi
|
|---|
| 109 | @if ! which md5sum >/dev/null 2>&1; then \
|
|---|
| 110 | cp scripts/md5sum.bsd lbin/md5sum; \
|
|---|
| 111 | chmod 555 lbin/md5sum; \
|
|---|
| 112 | fi
|
|---|
| 113 | @if test x"$$(uname)" = x"MirBSD"; then \
|
|---|
| 114 | sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
|
|---|
| 115 | -e "s!@@PROG@@!$$(which uname)!g" \
|
|---|
| 116 | <scripts/uname.fake >lbin/uname; \
|
|---|
| 117 | chmod 555 lbin/uname; \
|
|---|
| 118 | fi
|
|---|
| 119 | @if ! sed --help 2>&1 | fgrep in-place >/dev/null 2>&1; then \
|
|---|
| 120 | cp scripts/sed.bsd lbin/sed; \
|
|---|
| 121 | chmod 555 lbin/sed; \
|
|---|
| 122 | fi
|
|---|
| 123 | @echo "BASH=$$(which bash)" >>lbin/prereq.mk
|
|---|
| 124 | @echo 'HOSTCC=${CC}' >>lbin/prereq.mk
|
|---|
| 125 | @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
|
|---|
| 126 | ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
|
|---|
| 127 | 2>/dev/null | sed 's/^P://')"; \
|
|---|
| 128 | echo "HOSTCFLAGS=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
|
|---|
| 129 | >>lbin/prereq.mk
|
|---|
| 130 | @echo 'LC_ALL=C' >>lbin/prereq.mk
|
|---|
| 131 | @echo 'MAKE=${GMAKE}' >>lbin/prereq.mk
|
|---|
| 132 | @echo "OStype=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
|
|---|
| 133 | @echo "_PATH=$$PATH" >>lbin/prereq.mk
|
|---|
| 134 | @echo "PATH=$$(pwd)/lbin:$$PATH" >>lbin/prereq.mk
|
|---|
| 135 | @echo "SHELL=$$(which bash)" >>lbin/prereq.mk
|
|---|
| 136 | @echo "export BASH HOSTCC HOSTCFLAGS LC_ALL MAKE OStype PATH SHELL" \
|
|---|
| 137 | >>lbin/prereq.mk
|
|---|
| 138 | @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh
|
|---|
| 139 | @ln -s $$(which ${CC}) lbin/gcc
|
|---|
| 140 | @echo '===> Prerequisites checked successfully.'
|
|---|
| 141 | @touch $@
|
|---|
| 142 |
|
|---|
| 143 | .PHONY: prereq prereq-noerror
|
|---|