aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b4f03d2ae4bef7858285cfb769c9bf7c136c9fe0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Top-level build of software packages to work with Cryptech Alpha board.

export CRYPTECH_VERSION := 2.0

HEAD_TIME := $(shell git show -s --format=%ct HEAD)
HEAD_HASH := $(shell git rev-parse HEAD)

CRYPTECH_PACKAGE_VERSION := ${CRYPTECH_VERSION}~${HEAD_TIME}~${HEAD_HASH}

# Command to generate a new changelog containing one entry.
# Does nothing if the changelog already exists.

DCH =	test -f debian/changelog || \
	EDITOR=true VISUAL=true TZ=UTC DEBEMAIL='APT Builder Robot <aptbot@cryptech.is>' \
	dch --create --package cryptech-alpha --newversion '${CRYPTECH_PACKAGE_VERSION}' \
	'$(strip Version ${CRYPTECH_VERSION} of software for Cryptech Alpha development board.)'

export GNUPGHOME := /home/aptbot/gnupg

REPO_BASE	 := /home/aptbot/alpha
REPO_UMASK	 := 002

PBUILDER_BASE	 := ${HOME}/pbuilder
PBUILDER_TARGETS := debian/jessie/i386 debian/jessie/amd64 ubuntu/xenial/i386 ubuntu/xenial/amd64

REPO_UPLOAD_USER := aptbot
REPO_UPLOAD_URI	 := rsync://apt.cryptech.is/alpha/

all: init source pbuilder homebrew

enchilada: all upload

init:
	git submodule update --init --recursive

clean:
	git clean -dfx
	git submodule foreach --recursive git clean -dfx

sandblast: clean
	git submodule deinit -f .

source:
	cd sw; ${DCH}
	cd sw; debuild -S -uc -us

pbuilder:
	rm -f ${PBUILDER_BASE}/*result/*
	umask ${REPO_UMASK}; \
	for target in ${PBUILDER_TARGETS}; do echo $$target | tr '/' ' '; done | \
	while read dist code arch; do \
		reprepro -b ${REPO_BASE}/$$dist -A $$arch list $$code cryptech-alpha | awk '{v = $$3} END {exit v != ${CRYPTECH_PACKAGE_VERSION}}' && continue; \
		pbuilder-dist $$code $$arch build cryptech-alpha_${CRYPTECH_PACKAGE_VERSION}.dsc; \
		reprepro -b ${REPO_BASE}/$$dist include $$code ${PBUILDER_BASE}/$${code}-$${arch}_result/cryptech-alpha_${CRYPTECH_PACKAGE_VERSION}_$${arch}.changes; \
	done

RSYNC	:= rsync --rsh 'ssh -l ${REPO_UPLOAD_USER}' --archive --itemize-changes

upload:
	${RSYNC} --ignore-existing       ${REPO_BASE}/ ${REPO_UPLOAD_URI}
	${RSYNC} --delete --delete-delay ${REPO_BASE}/ ${REPO_UPLOAD_URI}

.PHONY: all init clean source pbuilder homebrew upload enchilada sandblast