| 1 | # $FreeWRT: src/share/misc/licence.template,v 1.14 2006/08/09 19:35:23 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 | # Advertising materials mentioning features or use of this work must
|
|---|
| 14 | # 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.
|
|---|
| 20 | #
|
|---|
| 21 | # Licensor offers the work "AS IS" and WITHOUT WARRANTY of any kind,
|
|---|
| 22 | # express, or implied, to the maximum extent permitted by applicable
|
|---|
| 23 | # law, without malicious intent or gross negligence; in no event may
|
|---|
| 24 | # licensor, an author or contributor be held liable for any indirect
|
|---|
| 25 | # or other damage, or direct damage except proven a consequence of a
|
|---|
| 26 | # direct error of said person and intended use of this work, loss or
|
|---|
| 27 | # other issues arising in any way out of its use, even if advised of
|
|---|
| 28 | # the possibility of such damage or existence of a defect.
|
|---|
| 29 |
|
|---|
| 30 | GMAKE?= $(PWD)/lbin/gmake
|
|---|
| 31 | GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk
|
|---|
| 32 | GMAKE_INV= ${GMAKE_FMK} --no-print-directory
|
|---|
| 33 |
|
|---|
| 34 | all: .prereq_done
|
|---|
| 35 | @${GMAKE_INV} all
|
|---|
| 36 |
|
|---|
| 37 | v: .prereq_done
|
|---|
| 38 | (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \
|
|---|
| 39 | ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log
|
|---|
| 40 |
|
|---|
| 41 | verbose: .prereq_done
|
|---|
| 42 | @${GMAKE_FMK} all V=99
|
|---|
| 43 |
|
|---|
| 44 | clean: .prereq_done
|
|---|
| 45 | @${GMAKE_INV} clean
|
|---|
| 46 |
|
|---|
| 47 | config: .prereq_done
|
|---|
| 48 | @${GMAKE_INV} config
|
|---|
| 49 |
|
|---|
| 50 | cleandir: .prereq_done
|
|---|
| 51 | @${GMAKE_INV} cleandir
|
|---|
| 52 | @-rm -rf lbin
|
|---|
| 53 | @-rm -f make.log .prereq_done
|
|---|
| 54 |
|
|---|
| 55 | distclean: .prereq_done
|
|---|
| 56 | @${GMAKE_INV} distclean
|
|---|
| 57 | @-rm -rf lbin
|
|---|
| 58 | @-rm -f make.log .prereq_done
|
|---|
| 59 |
|
|---|
| 60 | image_clean: .prereq_done
|
|---|
| 61 | @${GMAKE_INV} image_clean
|
|---|
| 62 |
|
|---|
| 63 | menuconfig: .prereq_done
|
|---|
| 64 | @${GMAKE_INV} menuconfig
|
|---|
| 65 |
|
|---|
| 66 | oldconfig: .prereq_done
|
|---|
| 67 | @${GMAKE_INV} oldconfig
|
|---|
| 68 |
|
|---|
| 69 | autobuild: .prereq_done
|
|---|
| 70 | @${GMAKE_INV} autobuild
|
|---|
| 71 |
|
|---|
| 72 | snapshot: snapshots/.snapshot_done
|
|---|
| 73 |
|
|---|
| 74 | snapshots/.snapshot_done: .prereq_done .defconfig
|
|---|
| 75 | -rm -rf snapshots
|
|---|
| 76 | mkdir snapshots
|
|---|
| 77 | ${GMAKE_INV} clean
|
|---|
| 78 | for target in $$(awk '/^config FWRT_LINUX/ { print $$2 }' \
|
|---|
| 79 | target/Config.in); do \
|
|---|
| 80 | for filesystem in JFFS2 SQUASHFS_LZMA; do \
|
|---|
| 81 | sed -e "s!FWRT_LINUX_MODEL!$$target!g" \
|
|---|
| 82 | -e "s!FWRT_TARGET_ROOTFS!&_$$filesystem!g" \
|
|---|
| 83 | <.defconfig >.config; \
|
|---|
| 84 | ${GMAKE_INV} all; \
|
|---|
| 85 | cp bin/freewrt-* snapshots/; \
|
|---|
| 86 | ${GMAKE_INV} clean; \
|
|---|
| 87 | done; \
|
|---|
| 88 | done
|
|---|
| 89 |
|
|---|
| 90 | package_index: .prereq_done
|
|---|
| 91 | @${GMAKE_INV} package_index
|
|---|
| 92 |
|
|---|
| 93 | target_clean: .prereq_done
|
|---|
| 94 | @${GMAKE_INV} target_clean
|
|---|
| 95 |
|
|---|
| 96 | world: .prereq_done
|
|---|
| 97 | @${GMAKE_INV} world
|
|---|
| 98 |
|
|---|
| 99 | prereq:
|
|---|
| 100 | @rm -f .prereq_done
|
|---|
| 101 | @${MAKE} .prereq_done
|
|---|
| 102 |
|
|---|
| 103 | prereq-noerror:
|
|---|
| 104 | @rm -f .prereq_done
|
|---|
| 105 | @${MAKE} .prereq_done NO_ERROR=1
|
|---|
| 106 |
|
|---|
| 107 | NO_ERROR=0
|
|---|
| 108 | .prereq_done:
|
|---|
| 109 | @-rm -rf .prereq_done lbin
|
|---|
| 110 | @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \
|
|---|
| 111 | echo "FreeWRT requires GNU bash to be installed, sorry."; \
|
|---|
| 112 | exit 1; \
|
|---|
| 113 | fi
|
|---|
| 114 | @mkdir lbin
|
|---|
| 115 | @if which nonexistent 2>&1 | grep -q '^no '; then \
|
|---|
| 116 | cp scripts/which.mac lbin/which; \
|
|---|
| 117 | chmod 555 lbin/which; \
|
|---|
| 118 | else \
|
|---|
| 119 | ln -s $$(which which) lbin/which; \
|
|---|
| 120 | fi
|
|---|
| 121 | @if lbin/which gmake >/dev/null 2>&1; then \
|
|---|
| 122 | ln -s $$(lbin/which gmake) lbin/gmake; \
|
|---|
| 123 | else \
|
|---|
| 124 | ln -s $$(lbin/which make) lbin/gmake; \
|
|---|
| 125 | fi
|
|---|
| 126 | @if ! lbin/which md5sum >/dev/null 2>&1; then \
|
|---|
| 127 | cp scripts/md5sum.bsd lbin/md5sum; \
|
|---|
| 128 | chmod 555 lbin/md5sum; \
|
|---|
| 129 | fi
|
|---|
| 130 | @if test x"$$(uname)" = x"MirBSD"; then \
|
|---|
| 131 | sed -e 's!@@FromOS@@!MirBSD!g' -e 's!@@ToOS@@!OpenBSD!g' \
|
|---|
| 132 | -e "s!@@PROG@@!$$(lbin/which uname)!g" \
|
|---|
| 133 | <scripts/uname.fake >lbin/uname; \
|
|---|
| 134 | chmod 555 lbin/uname; \
|
|---|
| 135 | fi
|
|---|
| 136 | @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk
|
|---|
| 137 | @echo "BASH:=$$(lbin/which bash)" >>lbin/prereq.mk
|
|---|
| 138 | @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk
|
|---|
| 139 | @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \
|
|---|
| 140 | -e 's!mirbsd!openbsd!g' \
|
|---|
| 141 | )" >>lbin/prereq.mk
|
|---|
| 142 | @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \
|
|---|
| 143 | -e 's/sparc.*/sparc/' \
|
|---|
| 144 | -e 's/arm.*/arm/g' \
|
|---|
| 145 | -e 's/m68k.*/m68k/' \
|
|---|
| 146 | -e 's/ppc/powerpc/g' \
|
|---|
| 147 | -e 's/v850.*/v850/g' \
|
|---|
| 148 | -e 's/sh[234]/sh/' \
|
|---|
| 149 | -e 's/mips-.*/mips/' \
|
|---|
| 150 | -e 's/mipsel-.*/mipsel/' \
|
|---|
| 151 | -e 's/cris.*/cris/' \
|
|---|
| 152 | -e 's/i[3-9]86/i386/' \
|
|---|
| 153 | )" >>lbin/prereq.mk
|
|---|
| 154 | @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk
|
|---|
| 155 | @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include <bsd.prog.mk>' | \
|
|---|
| 156 | ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \
|
|---|
| 157 | 2>/dev/null | sed 's/^P://')"; \
|
|---|
| 158 | echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \
|
|---|
| 159 | >>lbin/prereq.mk
|
|---|
| 160 | @echo 'LC_ALL:=C' >>lbin/prereq.mk
|
|---|
| 161 | @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk
|
|---|
| 162 | @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk
|
|---|
| 163 | @echo "_PATH:=$$PATH" >>lbin/prereq.mk
|
|---|
| 164 | @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk
|
|---|
| 165 | @echo "SHELL:=$$(lbin/which bash)" >>lbin/prereq.mk
|
|---|
| 166 | @TOPDIR=$$(readlink -nf .); \
|
|---|
| 167 | printf '%s\n%s\nwq\n' "%g#$$TOPDIR#s##\$${TOPDIR}#g" \
|
|---|
| 168 | "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk
|
|---|
| 169 | @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh
|
|---|
| 170 | @ln -s $$(lbin/which ${CC}) lbin/gcc
|
|---|
| 171 | @${GMAKE_INV} tools/install-lbin
|
|---|
| 172 | @echo '===> Prerequisites checked successfully.'
|
|---|
| 173 | @touch $@
|
|---|
| 174 |
|
|---|
| 175 | .PHONY: prereq prereq-noerror
|
|---|