upstream_commit = $$(printf '%s\n' '$(OPK_SOURCE_VERSION_UPSTREAM)' | \ sed 's/^.*~git........~\([0-9a-f]*\).*$$/\1/') upstream_url_base = https://github.com/qca/open-ath9k-htc-firmware upstream_url = $(upstream_url_base)/archive/$(upstream_commit).tar.gz source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.gz $(source_archive): wget -O '$@' "$(upstream_url)" source: $(source_archive) set -e; \ dir="$$(tar -tzf $(source_archive) | head -n 1 )"; \ tar -xzOf $(source_archive) "$${dir%%/*}/Makefile" >Makefile; \ printf '\ntoolchain-dl:\n' >>Makefile; \ for pkg in GMP MPFR MPC BINUTILS GCC; do \ printf '\twget -c -P ../toolchain/ $$(%s_URL)\n' "$${pkg}" \ >>Makefile; \ done; \ make toolchain-dl; \ rm Makefile