From b5dcd1d2803047f21363fc7f5128c70ffc4c3a82 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Fri, 29 May 2020 12:13:33 -0400 Subject: use config.mk --- .gitignore | 1 + Makefile | 19 ++++++++++++------- src/control.mk | 5 +---- src/equivs.mk | 19 ++++++++++--------- 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 @@ control equivs-stamp *.deb +config.mk diff --git a/Makefile b/Makefile index b35e8c5..43b72aa 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,22 @@ -all: control -.PHONY: all install postinst clean +.DEFAULT_GOAL = all -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin +prefix ?= /usr/local +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin bin_PROGRAMS := $(wildcard bin/*) export prefix exec_prefix bindir bin_PROGRAMS +include src/control.mk + DD_USER = dyndns DD_GROUP = dyndns -include src/control.mk + + + +.PHONY: all install clean + +all: control clean: clean-equivs @@ -27,7 +33,6 @@ else $(MAKE) ~$(DD_USER)/.ssh/authorized_keys endif - define dyndns_authorized_keys_contents command="$(bindir)/samizdat-ssh-command $(bindir)/cryptonomic-dyndns-command",no-port-forwarding * Samizdat - YES WE CAN endef 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 @@ -clean-equivs: - rm -f control equivs-stamp control_files := $(wildcard control.d/*.control) control: src/control.sh $(control_files) .git/refs/heads/master ./src/control.sh $(control_files) > $@ -include src/equivs.mk - +include 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 @@ -ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH) -ifndef VERSION -VERSION := $(shell TZ=UTC date -Is | tr -d :- | tr T . | sed 's/+.*//') -endif -export VERSION -PKG ?= $(notdir $(PWD)) +config.mk: control + sed -ne 's/^Version: /VERSION=/p; s/^Architecture: /ARCH=/p; s/^Package: /PKG=/p;' < $< > $@ + echo 'export VERSION ARCH PKG' >> $@ + +include config.mk -PKG_FILE ?= $(PKG)_$(VERSION)_$(ARCH).deb +PKG_FILE = $(PKG)_$(VERSION)_$(ARCH).deb export PKG_FILE $(PKG_FILE): control equivs-build control +clean-equivs: + rm -f control equivs-stamp + equivs-stamp: control $(MAKE) $(PKG_FILE) $(MAKE) install-equivs @@ -18,12 +20,11 @@ equivs-stamp: control touch $@ .PHONY: install-equivs - install-equivs: ifneq (0,$(shell id -u)) sudo $(MAKE) PKG_FILE=$(PKG_FILE) MAKEFLAGS=$(MAKEFLAGS) $@ else - dpkg -i $(PKG_FILE) + dpkg -i $${PKG_FILE} ifneq ($(REMOVE_EQUIVS_PACKAGE),) dpkg -r $${PKG_FILE%%_*} endif -- cgit v1.2.3