# $FreeWRT$ #- # This file is part of the FreeWRT project. FreeWRT is copyrighted # material, please see the LICENCE file in the top-level directory # or at http://www.freewrt.org/licence for details. GMAKE?= $(PWD)/lbin/gmake GMAKE_FMK= ${GMAKE} -f $(PWD)/mk/build.mk GMAKE_INV= ${GMAKE_FMK} V=99 all verbose: .prereq_done @${GMAKE_INV} all v: .prereq_done (echo; echo "Build started on $$(LC_ALL=C LANGUAGE=C TZ=UTC date)"; \ set -x; ${GMAKE_FMK} V=99 all) 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 ' oldconfig - Update current config utilising a provided .configs base' @echo ' allmodconfig - New config selecting modules when possible' @echo ' allnoconfig - New config where all options are answered with no' @echo '' @echo 'Help targets:' @echo ' help - Print this help text' @echo ' pkg-help - Print help about selectively compiling single packages' @echo ' dev-help - Print help for developers / package maintainers' @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' pkg-help: @echo 'Package specific targets (use with "package=" parameter):' @echo ' fetch - Download the necessary distfile' @echo ' extract - Same as "fetch", but also extract the distfile' @echo ' patch - Same as "extract", but also patch the source' @echo ' build - Same as "patch", but also build the binaries' @echo ' fake - Same as "build", but also install the binaries' @echo ' package - Same as "fake", but also create the ipkg package' @echo '' @echo 'Short package rebuilding guide:' @echo ' run "make package= clean" to remove all generated binaries' @echo ' run "make package= package" to build everything and create the ipkg' @echo '' @echo 'BEWARE: as for now, this does not resolve package dependencies!' dev-help: @echo 'Fast way of updating package patches:' @echo ' run "make package= clean" to start with a good base' @echo ' run "make package= patch" to fetch, unpack and patch the source' @echo ' edit the package sources at build_dir//-' @echo ' run "make package= update-patches to update the existing patches (if any)' @echo '' @echo 'Each changed patches will be opened with your $$EDITOR,' @echo 'so you can add a description and verify the changes.' clean: .prereq_done @${GMAKE_INV} clean config: .prereq_done @${GMAKE_INV} config oldconfig: .prereq_done @${GMAKE_INV} oldconfig 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 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 @if which nonexistent 2>&1 | grep -q '^no '; then \ cp scripts/which.mac lbin/which; \ chmod 555 lbin/which; \ else \ ln -s $$(which which) lbin/which; \ fi @if ! lbin/which md5sum >/dev/null 2>&1; then \ cp scripts/md5sum.bsd lbin/md5sum; \ chmod 555 lbin/md5sum; \ fi @echo "TOPDIR:=$$(readlink -nf .)" >lbin/prereq.mk @echo "BASH:=$$(lbin/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/v850.*/v850/g' \ -e 's/sh[234]/sh/' \ -e 's/mips-.*/mips/' \ -e 's/mipsel-.*/mipsel/' \ -e 's/cris.*/cris/' \ -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://')"; y='${CFLAGS}'; echo \ "HOSTCFLAGS:=$${x:-$${y:--O2}}" | sed 's/ *$$//' >>lbin/prereq.mk @echo 'LANGUAGE:=C' >>lbin/prereq.mk @echo 'LC_ALL:=C' >>lbin/prereq.mk @echo 'MAKE:=$${GMAKE}' >>lbin/prereq.mk @echo "OStype:=$$(env NOFAKE=yes uname)" >>lbin/prereq.mk @echo "_PATH:=$$PATH" >>lbin/prereq.mk @echo "PATH:=\$${TOPDIR}/lbin:$$PATH" >>lbin/prereq.mk @echo "SHELL:=$$(lbin/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="$$(lbin/which bash)" \ CC='${CC}' CPPFLAGS='${CPPFLAGS}' \ bash ${_PX} scripts/scan-tools.sh @cc='${CC}'; if test x"$$cc" = x"gcc"; then \ ln -s $$(lbin/which "$$cc") lbin/gcc; \ else \ ( echo "#!$$(lbin/which bash)"; \ echo "export PATH=$$PATH"; \ echo "exec $$cc" '"$$@"' ) >lbin/gcc; \ chmod 555 lbin/gcc; \ fi @${GMAKE_INV} tools/install-lbin @echo '===> Prerequisites checked successfully.' @touch $@ .PHONY: prereq prereq-noerror