aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 38 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 17f6f10..3d4fde2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,50 @@
# Top-level package build for Cryptech Alpha board.
-PACKAGE_NAME := cryptech-alpha
-PACKAGE_VERSION := 2.0.$(shell git show -s --format=%ct HEAD)
+# What we call the package before we start mucking with branches and revision numbers
+
+PACKAGE_BASE_NAME := cryptech-alpha
+PACKAGE_BASE_VERSION := 2.0
+
+# Git voodoo: plumbing commands to pull the current branch and list of
+# all (local) branches, and to pull something we can use as a version
+# number suffix.
+#
+# Using a timestamp here is not particularly friendly, but we're
+# looking for something simple that all the packaging systems involved
+# are willing to accept as a version number, so, at least for now, we
+# avoid more interesting options such as git-describe.
+
+GIT_VERSION := $(shell git show -s --format=%ct HEAD)
+GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
+GIT_BRANCHES := $(notdir $(shell git for-each-ref --format '%(refname)' refs/heads/))
+
+# Make voodoo: construct the package name, version number, and list of
+# other package names (constructed on other branches) with which this
+# one conflicts.
+
+PACKAGE_BRANCH = ${PACKAGE_BASE_NAME}$(and $(filter-out master,$(1)),-$(1))
+PACKAGE_NAME := $(call PACKAGE_BRANCH,${GIT_BRANCH})
+PACKAGE_CONFLICT := $(foreach I,$(filter-out ${GIT_BRANCH},${GIT_BRANCHES}),$(call PACKAGE_BRANCH,${I}))
+PACKAGE_VERSION := ${PACKAGE_BASE_VERSION}.${GIT_VERSION}
+
+# gpg setup, for signing packages and repositories
export GNUPGHOME := /home/aptbot/gnupg
GPG_USER := APT Builder Robot <aptbot@cryptech.is>
GPG_KEYID := 37A8E93F5D7E7B9A
+# Package repository setup
+
REPO_BASE := /home/aptbot
REPO_UMASK := 002
+# Debian clean-room package builder setup
+
PBUILDER_BASE := ${HOME}/pbuilder
PBUILDER_TARGETS := debian/jessie/i386 debian/jessie/amd64 ubuntu/xenial/i386 ubuntu/xenial/amd64
+# Where we upload the final results (if we do)
+
REPO_UPLOAD_USER := aptbot
REPO_UPLOAD_HOST := bikeshed.cryptech.is
REPO_UPLOAD_DIRS := apt brew
@@ -28,14 +60,6 @@ BITSTREAM := build/core/platform/alpha/build/alpha_fmc.bit
ELVES := build/sw/stm32/projects/bootloader/bootloader.elf build/sw/stm32/projects/hsm/hsm.elf
TAMPER := build/sw/tamper/tamper.hex
-# 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='${GPG_USER}' \
- dch --create --package ${PACKAGE_NAME} --newversion '${PACKAGE_VERSION}' \
- 'Software and firmware for Cryptech Alpha development board.'
-
all: init firmware dsc pbuilder homebrew expire
enchilada: all upload
@@ -54,10 +78,10 @@ sandblast: clean
firmware: shadow ${FIRMWARE_TARBALL}
shadow:
- ./build-shadow-tree.py
+ ./scripts/build-shadow-tree.py
${FIRMWARE_TARBALL}: ${BITSTREAM} $(sort ${ELVES} ${ELVES:.elf=.bin}) ${TAMPER}
- fakeroot ./build-firmware-package.py $@ $^
+ fakeroot ./scripts/build-firmware-package.py $@ $^
bitstream: ${BITSTREAM}
@@ -76,7 +100,7 @@ tamper:
dsc:
rm -f source/debian/changelog ${PACKAGE_NAME}_*.dsc ${PACKAGE_NAME}_*.tar.xz ${PACKAGE_NAME}_*_source.build ${PACKAGE_NAME}_*_source.changes
- cd source; ${DCH}
+ cd source; ../scripts/build-debian-control-files.py --debemail='${GPG_USER}' --package ${PACKAGE_NAME} --newversion '${PACKAGE_VERSION}' --conflicts='${PACKAGE_CONFLICT}'
cd source; debuild -S -uc -us
pbuilder:
@@ -95,7 +119,7 @@ homebrew:
umask ${REPO_UMASK}; \
git clone ${REPO_BASE}/brew/tap tap; \
cd tap; \
- ../build-homebrew-formula.py ${REPO_BASE}/brew/tarballs/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz ${PACKAGE_VERSION} ${PACKAGE_NAME}.rb; \
+ ../scripts/build-homebrew-formula.py ${REPO_BASE}/brew/tarballs/${PACKAGE_NAME}_${PACKAGE_VERSION}.tar.xz ${PACKAGE_VERSION} ${PACKAGE_NAME}.rb ${PACKAGE_CONFLICT}; \
git add ${PACKAGE_NAME}.rb; \
git commit -S${GPG_KEYID} --author='${GPG_USER}' -m '${PACKAGE_NAME} ${PACKAGE_VERSION}'; \
git push