opendoas

my fork of doas with custom prompt
git clone git://git.kocotian.pl/opendoas.git
Log | Files | Refs | README | LICENSE

commit b82ffa68a6436ce3f4c4b480bc9c12ac284b0d99
parent 9bfe647d25e27479c391492470e31dedef366238
Author: Duncan Overbruck <mail@duncano.de>
Date:   Thu, 12 Nov 2020 17:22:54 +0100

simplify makefile

Diffstat:
AGNUmakefile | 44++++++++++++++++++++++++++++++++++++++++++++
DMakefile | 16----------------
Dbsd.prog.mk | 42------------------------------------------
Mconfigure | 44+++++++++++++++++++++++++-------------------
4 files changed, 69 insertions(+), 77 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile @@ -0,0 +1,44 @@ +PROG= doas +MAN= doas.1 doas.conf.5 + +SRCS= parse.y doas.c env.c + +include config.mk + +CFLAGS+= -I. -Ilibopenbsd ${COPTS} +COPTS+= -Wall -Wextra -Werror -pedantic +YFLAGS= + +all: ${PROG} + +OBJS:= ${SRCS:.y=.c} +OBJS:= ${OBJS:.c=.o} + +${PROG}: ${OBJS} + ${CC} ${CFLAGS} $^ -o $@ ${LDFLAGS} + +install: ${PROG} ${PAM_DOAS} ${MAN} + mkdir -p -m 0755 ${DESTDIR}${BINDIR} + [ -n "${PAM_DOAS}" ] && mkdir -p -m 0755 ${DESTDIR}${PAMDIR} || true + mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man1 + mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man5 + cp -f ${PROG} ${DESTDIR}${BINDIR} + chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG} + chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG} + [ -n "${PAM_DOAS}" ] && cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas || true + [ -n "${PAM_DOAS}" ] && chmod 0644 ${DESTDIR}${PAMDIR}/doas || true + cp -f doas.1 ${DESTDIR}${MANDIR}/man1 + cp -f doas.conf.5 ${DESTDIR}${MANDIR}/man5 + +uninstall: + rm -f ${DESTDIR}${BINDIR}/${PROG} + rm -f ${DESTDIR}${PAMDIR}/doas + rm -f ${DESTDIR}${MANDIR}/man1/doas.1 + rm -f ${DESTDIR}${MANDIR}/man5/doas.conf.5 + +clean: + rm -f ${PROG} ${OBJS} ${OBJS:.o=.d} parse.c + +-include ${OBJS:.o=.d} + +.PHONY: all clean install uninstall diff --git a/Makefile b/Makefile @@ -1,16 +0,0 @@ -# $OpenBSD: Makefile,v 1.9 2014/01/13 01:41:00 tedu Exp $ - -SRCS= parse.y doas.c env.c - -PROG= doas -MAN= doas.1 doas.conf.5 - -BINOWN= root -BINGRP= root -BINMODE=4755 - -CFLAGS+= -I${CURDIR} -COPTS+= -Wall -Wextra -Werror -pedantic -YFLAGS= - -include bsd.prog.mk diff --git a/bsd.prog.mk b/bsd.prog.mk @@ -1,42 +0,0 @@ -# Copyright 2015 Nathan Holstein - -default: ${PROG} - -CFLAGS += -I${CURDIR}/libopenbsd ${COPTS} -MD -MP -Wno-unused-result - -include config.mk - -OBJS := ${SRCS:.y=.c} -OBJS := ${OBJS:.c=.o} - -${PROG}: ${OBJS} - ${CC} ${CFLAGS} $^ -o $@ ${LDFLAGS} - -install: ${PROG} ${PAM_DOAS} ${MAN} - mkdir -p -m 0755 ${DESTDIR}${BINDIR} - [ -n "${PAM_DOAS}" ] && mkdir -p -m 0755 ${DESTDIR}${PAMDIR} || true - mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man1 - mkdir -p -m 0755 ${DESTDIR}${MANDIR}/man5 - cp -f ${PROG} ${DESTDIR}${BINDIR} - chown ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/${PROG} - chmod ${BINMODE} ${DESTDIR}${BINDIR}/${PROG} - [ -n "${PAM_DOAS}" ] && cp ${PAM_DOAS} ${DESTDIR}${PAMDIR}/doas || true - [ -n "${PAM_DOAS}" ] && chmod 0644 ${DESTDIR}${PAMDIR}/doas || true - cp -f doas.1 ${DESTDIR}${MANDIR}/man1 - cp -f doas.conf.5 ${DESTDIR}${MANDIR}/man5 - -uninstall: - rm -f ${DESTDIR}${BINDIR}/${PROG} - rm -f ${DESTDIR}${PAMDIR}/doas - rm -f ${DESTDIR}${MANDIR}/man1/doas.1 - rm -f ${DESTDIR}${MANDIR}/man5/doas.conf.5 - -clean: - rm -f ${OBJS} - rm -f ${OBJS:.o=.d} - rm -f ${PROG} - rm -f parse.c - --include ${OBJS:.o=.d} - -.PHONY: default clean install uninstall diff --git a/configure b/configure @@ -42,14 +42,6 @@ WITHOUT_TIMESTAMP=yes UID_MAX=65535 GID_MAX=65535 -: ${PREFIX:=/usr/local} -: ${EPREFIX:=${PREFIX}} -: ${BINDIR:=${PREFIX}/bin} -: ${SHAREDIR:=${PREFIX}/share} -: ${MANDIR:=${SHAREDIR}/man} -: ${SYSCONFDIR:=/etc} -: ${PAMDIR:=${SYSCONFDIR}/pam.d} - for x; do opt=${x%%=*} var=${x#*=} @@ -89,17 +81,6 @@ cat <<! >$CONFIG_H ! -cat <<EOF >>$CONFIG_MK -CURDIR := . -PREFIX ?= ${PREFIX} -EPREFIX ?= ${EPREFIX} -BINDIR ?= ${BINDIR} -SHAREDIR ?= ${SHAREDIR} -MANDIR ?= ${MANDIR} -SYSCONFDIR?= ${SYSCONFDIR} -PAMDIR ?= ${PAMDIR} -EOF - if [ -z "$BUILD" ]; then BUILD="$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')" fi @@ -136,9 +117,34 @@ case "$OS" in netbsd) OS_CFLAGS="$OS_CFLAGS -D_OPENBSD_SOURCE" printf 'LDFLAGS += -lutil\n' >>$CONFIG_MK + : ${BINGRP:=wheel} ;; esac +: ${PREFIX:=/usr/local} +: ${EPREFIX:=${PREFIX}} +: ${BINDIR:=${PREFIX}/bin} +: ${SHAREDIR:=${PREFIX}/share} +: ${MANDIR:=${SHAREDIR}/man} +: ${SYSCONFDIR:=/etc} +: ${PAMDIR:=${SYSCONFDIR}/pam.d} +: ${BINMODE:=4755} +: ${BINOWN:=root} +: ${BINGRP:=root} + +cat <<EOF >>$CONFIG_MK +PREFIX ?= ${PREFIX} +EPREFIX ?= ${EPREFIX} +BINDIR ?= ${BINDIR} +SHAREDIR ?= ${SHAREDIR} +MANDIR ?= ${MANDIR} +SYSCONFDIR?= ${SYSCONFDIR} +PAMDIR ?= ${PAMDIR} +BINMODE ?= ${BINMODE} +BINOWN ?= ${BINOWN} +BINGRP ?= ${BINGRP} +EOF + [ -n "$OS_CFLAGS" ] && \ printf 'CFLAGS += %s\n' "$OS_CFLAGS" >>$CONFIG_MK