summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-05-29 12:13:33 -0400
committerAndrew Cady <d@jerkface.net>2020-05-29 12:17:29 -0400
commitb5dcd1d2803047f21363fc7f5128c70ffc4c3a82 (patch)
tree28960873e7e36f148de136ce2b22f6b02457ff09
parentb03e239f21f86fd5f05ea946aa71e1e305387a7c (diff)
use config.mk
-rw-r--r--.gitignore1
-rw-r--r--Makefile19
-rw-r--r--src/control.mk5
-rw-r--r--src/equivs.mk19
4 files changed, 24 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index 379cec3..40f5587 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
1control 1control
2equivs-stamp 2equivs-stamp
3*.deb 3*.deb
4config.mk
diff --git a/Makefile b/Makefile
index b35e8c5..43b72aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,22 @@
1all: control 1.DEFAULT_GOAL = all
2.PHONY: all install postinst clean
3 2
4prefix = /usr/local 3prefix ?= /usr/local
5exec_prefix = $(prefix) 4exec_prefix ?= $(prefix)
6bindir = $(exec_prefix)/bin 5bindir ?= $(exec_prefix)/bin
7bin_PROGRAMS := $(wildcard bin/*) 6bin_PROGRAMS := $(wildcard bin/*)
8export prefix exec_prefix bindir bin_PROGRAMS 7export prefix exec_prefix bindir bin_PROGRAMS
9 8
9include src/control.mk
10
10DD_USER = dyndns 11DD_USER = dyndns
11DD_GROUP = dyndns 12DD_GROUP = dyndns
12 13
13include src/control.mk 14
15
16
17.PHONY: all install clean
18
19all: control
14 20
15clean: clean-equivs 21clean: clean-equivs
16 22
@@ -27,7 +33,6 @@ else
27 $(MAKE) ~$(DD_USER)/.ssh/authorized_keys 33 $(MAKE) ~$(DD_USER)/.ssh/authorized_keys
28endif 34endif
29 35
30
31define dyndns_authorized_keys_contents 36define dyndns_authorized_keys_contents
32command="$(bindir)/samizdat-ssh-command $(bindir)/cryptonomic-dyndns-command",no-port-forwarding * Samizdat - YES WE CAN 37command="$(bindir)/samizdat-ssh-command $(bindir)/cryptonomic-dyndns-command",no-port-forwarding * Samizdat - YES WE CAN
33endef 38endef
diff --git a/src/control.mk b/src/control.mk
index a0bba6e..42760c5 100644
--- a/src/control.mk
+++ b/src/control.mk
@@ -1,9 +1,6 @@
1clean-equivs:
2 rm -f control equivs-stamp
3 1
4control_files := $(wildcard control.d/*.control) 2control_files := $(wildcard control.d/*.control)
5control: src/control.sh $(control_files) .git/refs/heads/master 3control: src/control.sh $(control_files) .git/refs/heads/master
6 ./src/control.sh $(control_files) > $@ 4 ./src/control.sh $(control_files) > $@
7include src/equivs.mk
8
9 5
6include src/equivs.mk
diff --git a/src/equivs.mk b/src/equivs.mk
index 7035250..a1f1bac 100644
--- a/src/equivs.mk
+++ b/src/equivs.mk
@@ -1,16 +1,18 @@
1ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH) 1config.mk: control
2ifndef VERSION 2 sed -ne 's/^Version: /VERSION=/p; s/^Architecture: /ARCH=/p; s/^Package: /PKG=/p;' < $< > $@
3VERSION := $(shell TZ=UTC date -Is | tr -d :- | tr T . | sed 's/+.*//') 3 echo 'export VERSION ARCH PKG' >> $@
4endif 4
5export VERSION 5include config.mk
6PKG ?= $(notdir $(PWD))
7 6
8PKG_FILE ?= $(PKG)_$(VERSION)_$(ARCH).deb 7PKG_FILE = $(PKG)_$(VERSION)_$(ARCH).deb
9export PKG_FILE 8export PKG_FILE
10 9
11$(PKG_FILE): control 10$(PKG_FILE): control
12 equivs-build control 11 equivs-build control
13 12
13clean-equivs:
14 rm -f control equivs-stamp
15
14equivs-stamp: control 16equivs-stamp: control
15 $(MAKE) $(PKG_FILE) 17 $(MAKE) $(PKG_FILE)
16 $(MAKE) install-equivs 18 $(MAKE) install-equivs
@@ -18,12 +20,11 @@ equivs-stamp: control
18 touch $@ 20 touch $@
19 21
20.PHONY: install-equivs 22.PHONY: install-equivs
21
22install-equivs: 23install-equivs:
23ifneq (0,$(shell id -u)) 24ifneq (0,$(shell id -u))
24 sudo $(MAKE) PKG_FILE=$(PKG_FILE) MAKEFLAGS=$(MAKEFLAGS) $@ 25 sudo $(MAKE) PKG_FILE=$(PKG_FILE) MAKEFLAGS=$(MAKEFLAGS) $@
25else 26else
26 dpkg -i $(PKG_FILE) 27 dpkg -i $${PKG_FILE}
27ifneq ($(REMOVE_EQUIVS_PACKAGE),) 28ifneq ($(REMOVE_EQUIVS_PACKAGE),)
28 dpkg -r $${PKG_FILE%%_*} 29 dpkg -r $${PKG_FILE%%_*}
29endif 30endif