[Makefile] $() -> ${}. Use install
the right way. Make it ready for PKGBUILD using DESTDIR. Added clean target.
This commit is contained in:
parent
230034da27
commit
e559b11b08
36
Makefile
36
Makefile
@ -1,31 +1,35 @@
|
||||
TARGET=httpprocwatchd
|
||||
|
||||
SYSCTL=$(shell which systemctl)
|
||||
SYSCTL=${shell which systemctl}
|
||||
DESTDIR=/
|
||||
|
||||
CONFDIR=/etc/$(TARGET)
|
||||
SYSDSERVICEDIR=/etc/systemd/system
|
||||
INSTALL_BINDIR=${DESTDIR}usr/bin
|
||||
INSTALL_CONFIGDIR=${DESTDIR}etc/${TARGET}
|
||||
INSTALL_SYSDSERVICEDIR=${DESTDIR}usr/lib/systemd/system
|
||||
|
||||
LDFLAGS=-ldflags "-s -w"
|
||||
|
||||
all: $(TARGET)
|
||||
all: ${TARGET}
|
||||
|
||||
$(TARGET): main.go
|
||||
go build $(LDFLAGS)
|
||||
${TARGET}: main.go
|
||||
go build ${LDFLAGS}
|
||||
|
||||
install:
|
||||
install -m 0755 $(TARGET) /usr/bin/$(TARGET)
|
||||
mkdir -p -m 0755 $(CONFDIR)
|
||||
install -m 0644 config.example.json $(CONFDIR)/config.example.json
|
||||
install -Dm 0755 ${TARGET} ${INSTALL_BINDIR}/${TARGET}
|
||||
install -Dm 0644 config.example.json ${INSTALL_CONFIGDIR}/config.json
|
||||
|
||||
install-service:
|
||||
install -m 0644 $(TARGET).service $(SYSDSERVICEDIR)/$(TARGET).service
|
||||
$(SYSCTL) daemon-reload
|
||||
install -Dm 0644 ${TARGET}.service ${INSTALL_SYSDSERVICEDIR}/${TARGET}.service
|
||||
${SYSCTL} daemon-reload
|
||||
|
||||
uninstall:
|
||||
rm /usr/bin/$(TARGET)
|
||||
rm ${INSTALL_BINDIR}/${TARGET}
|
||||
|
||||
uninstall-service:
|
||||
$(SYSCTL) stop $(TARGET).service
|
||||
$(SYSCTL) disable $(TARGET).service
|
||||
rm $(SYSDSERVICEDIR)/$(TARGET).service
|
||||
$(SYSCTL) daemon-reload
|
||||
${SYSCTL} stop ${TARGET}.service
|
||||
${SYSCTL} disable ${TARGET}.service
|
||||
rm ${INSTALL_SYSDSERVICEDIR}/${TARGET}.service
|
||||
${SYSCTL} daemon-reload
|
||||
|
||||
clean:
|
||||
go clean
|
Loading…
Reference in New Issue
Block a user