# This file is part of the FreeWRT project. FreeWRT is copyrighted # material, please see the LICENCE file in the top-level directory GMAKE?= $(PWD)/lbin/gmake GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk GMAKE_INV= ${GMAKE_FMK} --no-print-directory all: .prereq_done @${GMAKE_INV} all v: .prereq_done (echo; echo "Build started on $$(LC_ALL=C TZ=UTC date)"; set -x; \ ${GMAKE_FMK} all V=99) 2>&1 | tee -a make.log help: @echo 'Cleaning targets:' @echo ' clean - Remove bin and build_dir directories' @echo ' cleandir - Same as "clean", but also remove built toolchain' @echo ' distclean - Same as "cleandir", but also remove downloaded' @echo ' distfiles and .config' @echo '' @echo 'Configuration targets:' @echo ' config - Update current config utilising a line-oriented program' @echo ' menuconfig - Update current config utilising a menu based program' @echo ' (default when .config does not exist)' @echo ' allmodconfig - New config selecting modules when possible' @echo ' allnoconfig - New config where all options are answered with no' @echo '' @echo 'Other generic targets:' @echo ' all - Build everything as specified in .config' @echo ' (default if .config exists)' @echo ' v - Same as "all" but with logging to make.log enabled' verbose: .prereq_done @${GMAKE_FMK} all V=99 clean: .prereq_done @${GMAKE_INV} clean cleanbuild: .prereq_done @${GMAKE_INV} cleanbuild config: .prereq_done @${GMAKE_INV} config cleandir: .prereq_done @${GMAKE_INV} cleandir @-rm -rf lbin @-rm -f make.log .prereq_done distclean: .prereq_done @${GMAKE_INV} distclean @-rm -rf lbin @-rm -f make.log .prereq_done image_clean: .prereq_done @${GMAKE_INV} image_clean menuconfig: .prereq_done @${GMAKE_INV} menuconfig allnoconfig: .prereq_done @${GMAKE_INV} allnoconfig allmodconfig: .prereq_done @${GMAKE_INV} allmodconfig snapshotconfig: .prereq_done @${GMAKE_INV} snapshotconfig package_index: .prereq_done @${GMAKE_INV} package_index target_clean: .prereq_done @${GMAKE_INV} target_clean world: .prereq_done @${GMAKE_INV} world allpackages: .prereq_done @${GMAKE_INV} allpackages prereq: @rm -f .prereq_done @${MAKE} .prereq_done prereq-noerror: @rm -f .prereq_done @${MAKE} .prereq_done NO_ERROR=1 NO_ERROR=0 .prereq_done: @-rm -rf .prereq_done lbin @if ! bash --version 2>&1 | fgrep 'GNU bash' >/dev/null 2>&1; then \ echo "FreeWRT requires GNU bash to be installed, sorry."; \ exit 1; \ fi @mkdir lbin @cp scripts/makeinfo lbin/makeinfo @if which gmake >/dev/null 2>&1; then \ ln -s $$(which gmake) lbin/gmake; \ else \ ln -s $$(which make) lbin/gmake; \ fi @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk @echo "BASH:=$$(which bash)" >>lbin/prereq.mk @echo 'GMAKE:=$${TOPDIR}/lbin/gmake' >>lbin/prereq.mk @echo "GNU_HOST_NAME:=$$(${CC} -dumpmachine | sed \ -e 's!mirbsd!openbsd!g' \ )" >>lbin/prereq.mk @echo "HOST_ARCH:=$$(${CC} -dumpmachine | sed -e s'/-.*//' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ -e 's/m68k.*/m68k/' \ -e 's/ppc/powerpc/g' \ -e 's/sh[234]/sh/' \ -e 's/mips-.*/mips/' \ -e 's/mipsel-.*/mipsel/' \ -e 's/i[3-9]86/i386/' \ )" >>lbin/prereq.mk @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk @x="$$(echo 'f:\n\techo P:$${CFLAGS}\n.include ' | \ ${MAKE} -f - f EXPERIMENTAL=yes 2>/dev/null | grep '^P:' \ 2>/dev/null | sed 's/^P://')"; \ echo "HOSTCFLAGS:=$${x:--O2 ${CFLAGS}}" | sed 's/ *$$//' \ >>lbin/prereq.mk @echo 'LC_ALL:=C' >>lbin/prereq.mk @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk @echo "OStype:=$$(uname)" >>lbin/prereq.mk @echo "_PATH:=$$PATH" >>lbin/prereq.mk @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk @echo "SHELL:=$$(which bash)" >>lbin/prereq.mk @TOPDIR=$$(readlink -nf .); \ printf '%s\n%s\nwq\n' ",g#$$TOPDIR#s##\$${TOPDIR}#g" \ "1s#^.*\$$#TOPDIR:=$$TOPDIR#" | ed -s lbin/prereq.mk @env NO_ERROR=${NO_ERROR} bash scripts/scan-tools.sh @ln -s $$(which ${CC}) lbin/gcc @${GMAKE_INV} tools/install-lbin @echo '===> Prerequisites checked successfully.' @touch $@ .PHONY: prereq prereq-noerror