#!/usr/bin/make -f

VER=$(shell dpkg-parsechangelog --show-field Version| sed -rne 's/^([0-9.]+)[-+].*$$/\1/p')
NOM=$(shell dpkg-parsechangelog --show-field Source)

# other archive formats, and pulls from SCM/VCS systems, need different logic
# for gz tarball, only need to edit this one line (usually)
#URL="https://braingames.jorito.net/goonies/downloads/goonies.src_${VER}.tgz"
URL="https://mtfmu4.chickenkiller.com/goonies.src_${VER}.tgz"

TARGET="../${NOM}_${VER}.orig.tar.gz"

all: default

default: $(TARGET)

$(TARGET):
#	# !!! mk-origtargz won't work out of the box, because this tarball is not gzipped, holy gosh
#	# $(shell wget ${URL} -O "`basename ${URL}`" && mk-origtargz "`basename ${URL}`" && rm "`basename ${URL}`")

	wget ${URL} -O ../tmp.tar
	gzip ../tmp.tar
	mv ../tmp.tar.gz ${TARGET}
