1PKG= openresolv 2 3# Nasty hack so that make clean works without configure being run 4_CONFIG_MK!= test -e config.mk && echo config.mk || echo config-null.mk 5CONFIG_MK?= ${_CONFIG_MK} 6include ${CONFIG_MK} 7 8SBINDIR?= /sbin 9SYSCONFDIR?= /etc 10LIBEXECDIR?= /libexec/resolvconf 11VARDIR?= /var/run/resolvconf 12 13ECHO?= echo 14INSTALL?= install 15SED?= sed 16 17VERSION!= ${SED} -n 's/OPENRESOLV_VERSION="\(.*\)".*/\1/p' resolvconf.in 18 19BINMODE?= 0755 20DOCMODE?= 0644 21MANMODE?= 0444 22 23RESOLVCONF= resolvconf resolvconf.8 resolvconf.conf.5 24SUBSCRIBERS= libc dnsmasq named pdnsd pdns_recursor unbound 25TARGET= ${RESOLVCONF} ${SUBSCRIBERS} 26SRCS= ${TARGET:C,$,.in,} # pmake 27SRCS:= ${TARGET:=.in} # gmake 28 29SED_SBINDIR= -e 's:@SBINDIR@:${SBINDIR}:g' 30SED_SYSCONFDIR= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' 31SED_LIBEXECDIR= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' 32SED_VARDIR= -e 's:@VARDIR@:${VARDIR}:g' 33SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' 34SED_RESTARTCMD= -e 's:@RESTARTCMD@:${RESTARTCMD}:g' 35SED_RCDIR= -e 's:@RCDIR@:${RCDIR}:g' 36SED_STATUSARG= -e 's:@STATUSARG@:${STATUSARG}:g' 37 38DISTPREFIX?= ${PKG}-${VERSION} 39DISTFILEGZ?= ${DISTPREFIX}.tar.gz 40DISTFILE?= ${DISTPREFIX}.tar.xz 41DISTINFO= ${DISTFILE}.distinfo 42DISTINFOSIGN= ${DISTINFO}.asc 43CKSUM?= cksum -a SHA256 44PGP?= netpgp 45 46GITREF?= HEAD 47 48.SUFFIXES: .in 49 50all: ${TARGET} 51 52.in: Makefile ${CONFIG_MK} 53 ${SED} ${SED_SBINDIR} ${SED_SYSCONFDIR} ${SED_LIBEXECDIR} \ 54 ${SED_VARDIR} \ 55 ${SED_RCDIR} ${SED_RESTARTCMD} ${SED_RCDIR} ${SED_STATUSARG} \ 56 $< > $@ 57 58clean: 59 rm -f ${TARGET} 60 61distclean: clean 62 rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} 63 64installdirs: 65 66proginstall: ${TARGET} 67 ${INSTALL} -d ${DESTDIR}${SBINDIR} 68 ${INSTALL} -m ${BINMODE} resolvconf ${DESTDIR}${SBINDIR} 69 ${INSTALL} -d ${DESTDIR}${SYSCONFDIR} 70 test -e ${DESTDIR}${SYSCONFDIR}/resolvconf.conf || \ 71 ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR} 72 ${INSTALL} -d ${DESTDIR}${LIBEXECDIR} 73 ${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR} 74 75maninstall: 76 ${INSTALL} -d ${DESTDIR}${MANDIR}/man8 77 ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8 78 ${INSTALL} -d ${DESTDIR}${MANDIR}/man5 79 ${INSTALL} -m ${MANMODE} resolvconf.conf.5 ${DESTDIR}${MANDIR}/man5 80 81install: proginstall maninstall 82 83dist-git: 84 git archive --prefix=${DISTPREFIX}/ ${GITREF} | xz >${DISTFILE} 85 86dist-inst: 87 mkdir /tmp/${DISTPREFIX} 88 cp -RPp * /tmp/${DISTPREFIX} 89 (cd /tmp/${DISTPREFIX}; make clean) 90 tar -cvjpf ${DISTFILE} -C /tmp ${DISTPREFIX} 91 rm -rf /tmp/${DISTPREFIX} 92 93dist: dist-git 94 95distinfo: dist 96 rm -f ${DISTINFO} ${DISTINFOSIGN} 97 ${CKSUM} ${DISTFILE} >${DISTINFO} 98 #printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO} 99 ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO} 100 chmod 644 ${DISTINFOSIGN} 101 ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN} 102 103import: dist 104 rm -rf /tmp/${DISTPREFIX} 105 ${INSTALL} -d /tmp/${DISTPREFIX} 106 tar xvJpf ${DISTFILE} -C /tmp 107 108_import-src: 109 rm -rf ${DESTDIR}/* 110 ${INSTALL} -d ${DESTDIR} 111 cp LICENSE README.md ${SRCS} resolvconf.conf ${DESTDIR}; 112 cp resolvconf.8.in resolvconf.conf.5.in ${DESTDIR}; 113 @${ECHO} 114 @${ECHO} "=============================================================" 115 @${ECHO} "openresolv-${VERSION} imported to ${DESTDIR}" 116 117import-src: 118 ${MAKE} _import-src DESTDIR=`if [ -n "${DESTDIR}" ]; then echo "${DESTDIR}"; else echo /tmp/${DISTPREFIX}; fi` 119