aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2016-05-08 20:01:25 +0200
committerDuncaen <mail@duncano.de>2016-05-08 20:11:27 +0200
commit09843fcf8876df1ab1728e9c2c49de4836b25626 (patch)
tree3b282b645fda76003a7e0be382371b791de35c03
parentc387f2c31718d4f34c77203dae6bb8c4bc0abc94 (diff)
downloadopendoas-09843fcf8876df1ab1728e9c2c49de4836b25626.tar.gz
Simply install and move version to configure script
-rw-r--r--Makefile2
-rw-r--r--bsd.prog.mk36
-rwxr-xr-xconfigure3
-rw-r--r--doas.c1
4 files changed, 14 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 3c8f8c5..f2277ab 100644
--- a/Makefile
+++ b/Makefile
@@ -14,5 +14,3 @@ COPTS+= -Wall -Wextra -Werror -pedantic -std=c11
LDFLAGS+= -lpam
include bsd.prog.mk
-
-doas.o: version.h
diff --git a/bsd.prog.mk b/bsd.prog.mk
index d2caff4..c759f72 100644
--- a/bsd.prog.mk
+++ b/bsd.prog.mk
@@ -16,31 +16,17 @@ OBJS:=${OBJS:.c=.o}
${PROG}: ${OBJS} libopenbsd.a
${CC} ${CFLAGS} ${LDFLAGS} $^ -o $@
-.%.chmod: %
- cp $< $@
- chown ${BINOWN}:${BINGRP} $@
- chmod ${BINMODE} $@
-
-${DESTDIR}${BINDIR} ${DESTDIR}${PAMDIR}:
- mkdir -pm 0755 $@
-
-${DESTDIR}${BINDIR}/${PROG}: .${PROG}.chmod ${BINDIR}
- mv $< $@
-
-${DESTDIR}${PAMDIR}/doas: ${PAM_DOAS}
- cp $< $@
-
-VERSION:=\#define VERSION "$(shell git describe --dirty --tags --long --always)"
-OLDVERSION:=$(shell [ -f version.h ] && cat version.h)
-version.h: ; @echo '$(VERSION)' > $@
-ifneq ($(VERSION),$(OLDVERSION))
-.PHONY: version.h
-endif
-
-MAN:=$(join $(addprefix ${DESTDIR}${MANDIR}/man,$(patsubst .%,%/,$(suffix ${MAN}))),${MAN})
-$(foreach M,${MAN},$(eval $M: $(notdir $M); cp $$< $$@))
-
-install: ${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}${PAMDIR}/doas ${MAN}
+install: ${PROG} ${PAM_DOAS}
+ mkdir -p -m 0755 ${DESTDIR}${BINDIR}
+ mkdir -p -m 0755 ${DESTDIR}${PAMDIR}
+ mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man{1,5}
+ cp -f ${PROG} ${DESTDIR}${BINDIR}
+ chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG}
+ chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG}
+ cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas
+ chmod 0644 ${DESTDIR}${PAMDIR}/doas
+ cp -f doas.1 ${DESTDIR}${MANDIR}/man1
+ cp -f doas.conf.5 ${DESTDIR}${MANDIR}/man5
clean:
rm -f version.h
diff --git a/configure b/configure
index 66589b9..7328547 100755
--- a/configure
+++ b/configure
@@ -55,6 +55,8 @@ done
CONFIG_MK=config.mk
rm -f "$CONFIG_MK"
+: ${VERSION:="$(git describe --dirty --tags --long --always)"}
+
cat <<EOF >>$CONFIG_MK
DESTDIR ?= /
PREFIX ?= ${PREFIX:="/usr"}
@@ -64,6 +66,7 @@ SHAREDIR ?= ${SHAREDIR:="${PREFIX}/share"}
MANDIR ?= ${MANDIR:="${SHAREDIR}/man"}
SYSCONFDIR?= ${SYSCONFDIR:="/etc"}
PAMDIR ?= ${PAMDIR:="${SYSCONFDIR}/pam.d"}
+CFLAGS += -DVERSION="\"${VERSION}\""
EOF
if [ -z "$BUILD" ]; then
diff --git a/doas.c b/doas.c
index cceeac1..6f644ec 100644
--- a/doas.c
+++ b/doas.c
@@ -32,7 +32,6 @@
#include "includes.h"
#include "doas.h"
-#include "version.h"
static void __dead
version(void)