#!/usr/bin/make -f

KEYRING=acfrmarine-archive-keyring.gpg
SOURCES=acfrmarine.sources acfrmarine-experimental.sources

DIST := $(shell dpkg-parsechangelog -S Distribution)

%:
	dh $@

acfrmarine.sources: template.sources
	sed 's/RELEASE/${DIST}/' $< > $@

acfrmarine-experimental.sources: template.sources
	sed 's/RELEASE/${DIST}-experimental/' $< > $@

$(KEYRING): archive.asc
	touch $@.tmp
	mkdir $(CURDIR)/gpg
	gpg --homedir $(CURDIR)/gpg --no-default-keyring --keyring $(CURDIR)/$@.tmp --import $<
	mv $@.tmp $@

override_dh_auto_build: $(KEYRING) $(SOURCES)

override_dh_auto_clean:
	rm -rf *.gpg *.gpg.tmp~ $(CURDIR)/gpg
