2021-08-26 22:25:48 +00:00
|
|
|
GOCMD := go
|
|
|
|
BINARY := slp
|
|
|
|
PREFIX := /usr/local
|
|
|
|
EXEC_PREFIX := ${PREFIX}
|
|
|
|
BINDIR := ${EXEC_PREFIX}/bin
|
|
|
|
DATAROOTDIR := ${PREFIX}/share
|
2021-12-24 18:27:31 +00:00
|
|
|
LIBDIR := ${PREFIX}/lib
|
2021-08-26 22:25:48 +00:00
|
|
|
MANDIR := ${DATAROOTDIR}/man
|
|
|
|
MAN1DIR := ${MANDIR}/man1
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
|
|
|
${GOCMD} build -ldflags "-w -s" -o ${BINARY}
|
|
|
|
|
|
|
|
.PHONY: install
|
2021-12-24 18:27:31 +00:00
|
|
|
install: install-bin install-man install-module-dir clean
|
2021-08-26 22:25:48 +00:00
|
|
|
|
|
|
|
.PHONY: install-bin
|
|
|
|
install-bin: build
|
|
|
|
install -d ${DESTDIR}${BINDIR}
|
|
|
|
install -m 0755 ./${BINARY} ${DESTDIR}${BINDIR}
|
|
|
|
|
2021-12-24 18:27:31 +00:00
|
|
|
.PHONY: install-module-dir
|
|
|
|
install-module-dir:
|
|
|
|
-mkdir -p ${DESTDIR}${LIBDIR}/slope/modules
|
|
|
|
|
2021-08-26 22:25:48 +00:00
|
|
|
.PHONY: install-man
|
|
|
|
install-man: ${BINARY}.1
|
|
|
|
gzip -k ./${BINARY}.1
|
|
|
|
install -d ${DESTDIR}${MAN1DIR}
|
|
|
|
install -m 0644 ./${BINARY}.1.gz ${DESTDIR}${MAN1DIR}
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
${GOCMD} clean
|
|
|
|
rm -f ./${BINARY}.1.gz 2> /dev/null
|
|
|
|
rm -f ./${BINARY}_* 2> /dev/null
|