summaryrefslogtreecommitdiff
path: root/src/equivs.mk
diff options
context:
space:
mode:
Diffstat (limited to 'src/equivs.mk')
-rw-r--r--src/equivs.mk27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/equivs.mk b/src/equivs.mk
new file mode 100644
index 0000000..d7f989a
--- /dev/null
+++ b/src/equivs.mk
@@ -0,0 +1,27 @@
1ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH)
2ifndef VERSION
3VERSION := $(shell TZ=UTC date -Is | tr -d :- | tr T . | sed 's/+.*//')
4endif
5export VERSION
6PKG ?= $(notdir $(PWD))
7
8PKG_FILE ?= $(PKG)_$(VERSION)_$(ARCH).deb
9export PKG_FILE
10
11$(PKG_FILE): control
12 equivs-build control
13
14equivs-stamp: control
15 $(MAKE) $(PKG_FILE)
16 $(MAKE) install-remove-equivs
17 rm $(PKG_FILE)
18 touch $@
19
20.PHONY: install-remove-equivs
21install-remove-equivs:
22ifneq (0,$(shell id -u))
23 sudo $(MAKE) PKG_FILE=$(PKG_FILE) MAKEFLAGS=$(MAKEFLAGS) $@
24else
25 dpkg -i $(PKG_FILE)
26 f=$(PKG_FILE); dpkg -r $${f%%_*}
27endif