2021-03-13 03:17:30 +04:00
|
|
|
TARGET=httpprocwatchd
|
|
|
|
|
2021-12-24 21:17:36 +04:00
|
|
|
SYSCTL=${shell which systemctl}
|
|
|
|
DESTDIR=/
|
2021-03-13 03:17:30 +04:00
|
|
|
|
2021-12-24 21:17:36 +04:00
|
|
|
INSTALL_BINDIR=${DESTDIR}usr/bin
|
|
|
|
INSTALL_CONFIGDIR=${DESTDIR}etc/${TARGET}
|
|
|
|
INSTALL_SYSDSERVICEDIR=${DESTDIR}usr/lib/systemd/system
|
2021-03-13 03:17:30 +04:00
|
|
|
|
|
|
|
LDFLAGS=-ldflags "-s -w"
|
|
|
|
|
2022-01-02 05:14:52 +04:00
|
|
|
SOURCES := main.go ${wildcard prog/*.go}
|
|
|
|
|
2021-12-24 21:17:36 +04:00
|
|
|
all: ${TARGET}
|
2021-03-13 03:17:30 +04:00
|
|
|
|
2022-01-02 05:14:52 +04:00
|
|
|
${TARGET}: ${SOURCES}
|
2021-12-24 21:17:36 +04:00
|
|
|
go build ${LDFLAGS}
|
2021-03-13 03:17:30 +04:00
|
|
|
|
|
|
|
install:
|
2021-12-24 21:17:36 +04:00
|
|
|
install -Dm 0755 ${TARGET} ${INSTALL_BINDIR}/${TARGET}
|
2022-01-02 02:58:24 +04:00
|
|
|
install -Dm 0644 contrib/config.example.json ${INSTALL_CONFIGDIR}/config.json
|
2021-03-13 03:17:30 +04:00
|
|
|
|
|
|
|
install-service:
|
2022-01-02 02:58:24 +04:00
|
|
|
install -Dm 0644 contrib/systemd/${TARGET}.service ${INSTALL_SYSDSERVICEDIR}/${TARGET}.service
|
2021-12-24 21:17:36 +04:00
|
|
|
${SYSCTL} daemon-reload
|
2021-03-13 03:17:30 +04:00
|
|
|
|
|
|
|
uninstall:
|
2021-12-24 21:17:36 +04:00
|
|
|
rm ${INSTALL_BINDIR}/${TARGET}
|
2021-03-13 03:17:30 +04:00
|
|
|
|
|
|
|
uninstall-service:
|
2021-12-24 21:17:36 +04:00
|
|
|
${SYSCTL} stop ${TARGET}.service
|
|
|
|
${SYSCTL} disable ${TARGET}.service
|
|
|
|
rm ${INSTALL_SYSDSERVICEDIR}/${TARGET}.service
|
|
|
|
${SYSCTL} daemon-reload
|
|
|
|
|
|
|
|
clean:
|
|
|
|
go clean
|