1# $OpenBSD: Makefile,v 1.2 2017/06/25 21:33:23 bluhm Exp $ 2 3# Copyright (c) 2017 Alexander Bluhm <bluhm@openbsd.org> 4# 5# Permission to use, copy, modify, and distribute this software for any 6# purpose with or without fee is hereby granted, provided that the above 7# copyright notice and this permission notice appear in all copies. 8# 9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 17# acme-client retrieves a certificate from letsencrypt.org. For 18# that a domain must be registered and the local machine must be 19# reachable via this DNS name. 20 21DOMAIN ?= 22 23.if empty (DOMAIN) 24regress: 25 @echo This tests needs a domain reachable from letsencrypt.org. 26 @echo Set it with the DOMAIN variable. 27 @echo SKIPPED 28.endif 29 30clean: _SUBDIRUSE 31 rm -f a.out [Ee]rrs mklog *.core y.tab.h ktrace.out 32 rm -rf etc www 33 34etc/acme-client.conf: acme-client.conf 35 mkdir -p etc 36 sed 's,$${.OBJDIR},${.OBJDIR},;s,$${DOMAIN},${DOMAIN},'\ 37 ${.CURDIR}/acme-client.conf >etc/acme-client.conf 38 39etc/httpd.conf: httpd.conf 40 mkdir -p etc 41 sed 's,$${.OBJDIR},${.OBJDIR},'\ 42 ${.CURDIR}/httpd.conf >etc/httpd.conf 43 mkdir -p www/htdocs www/acme www/logs etc/acme etc/ssl/acme/private 44 45httpd-start: etc/httpd.conf 46 ${SUDO} /usr/sbin/httpd -f ${.OBJDIR}/etc/httpd.conf 47 sleep .1 # give httpd some time to spin up 48 pgrep -xf "/usr/sbin/httpd -f ${.OBJDIR}/etc/httpd.conf" 49 50httpd-stop: 51 -${SUDO} pkill -xf "/usr/sbin/httpd -f ${.OBJDIR}/etc/httpd.conf" 52 53REGRESS_TARGETS += run-regress-acme 54run-regress-acme: etc/acme-client.conf httpd-start 55 ${SUDO} /usr/sbin/acme-client \ 56 -f ${.OBJDIR}/etc/acme-client.conf \ 57 -A -D -v ${DOMAIN} 58 ${SUDO} /usr/sbin/acme-client \ 59 -f ${.OBJDIR}/etc/acme-client.conf \ 60 -r -v ${DOMAIN} 61 62REGRESS_TARGETS += run-regress-cleanup 63run-regress-cleanup: 64 ${.MAKE} -C ${.CURDIR} httpd-stop 65 66.PHONY: ${REGRESS_TARGETS} httpd-start httpd-stop 67 68.include <bsd.regress.mk> 69