#!/usr/bin/make -f

patch-stamp:
	[ -e debian/control ]
	patch -b -p1 -z .source-orig < $(wildcard debian/patches/*)
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: patch-stamp
	[ -e debian/control ]
	travis/support/script
	touch $@

build-arch:

build: build-indep

clean:
	[ -e debian/control ]
	rm -f build-indep-stamp debian/files patch-stamp
	cd AndorsTrail && rm -fr *.apk .gradle build build.gradle \
		gradle.properties keystore.p12 local.properties src/main
	find -name "*.source-orig" \
		-execdir sh -c 'mv $$0 $${0%.source-orig}' "{}" \;

binary-indep: build-indep
	[ -e debian/control ]
	cp -a AndorsTrail/*.apk ..
	dpkg-distaddfile $(shell basename AndorsTrail/*.apk) - -

binary-arch:

binary: binary-indep
.PHONY: build-indep build-arch build clean binary-indep binary-arch binary
