TARGET=justcaptcha DAEMON_NAME=${TARGET}d SYSCTL=${shell which systemctl} SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir} SYSDDIR=${SYSDDIR_:/%=%} DESTDIR=/ LDFLAGS=-ldflags "-s -w" -tags osusergo,netgo all: ${DAEMON_NAME} .PHONY: ${DAEMON_NAME} ${DAEMON_NAME}: go build -o bin/$@ ${LDFLAGS} cmd/$@/main.go run-test: bin/${DAEMON_NAME} -expire 1m -listen 127.0.0.1:19134 install: install -Dm 0755 bin/${DAEMON_NAME} ${DESTDIR}usr/bin/${DAEMON_NAME} install -Dm 0644 LICENSE ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE install -Dm 0644 init/systemd/${TARGET}.service ${DESTDIR}${SYSDDIR}/${TARGET}.service uninstall: rm ${DESTDIR}usr/bin/${DAEMON_NAME} rm ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE rm ${DESTDIR}${SYSDDIR}/${TARGET}.service clean: go clean