>> add install recipes

This commit is contained in:
Thomas Lindop 2025-07-22 11:07:09 +01:00
parent c45d3bda9a
commit 9c34a31fde
2 changed files with 14 additions and 12 deletions

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
owl
testdata/ testdata/
owl.1* dist/

View file

@ -1,23 +1,26 @@
SOURCES=*.go SOURCES=*.go
LINKER_FLAGS=-X main.OwlVersion=`git describe --tags --dirty` LINKER_FLAGS=-X main.OwlVersion=`git describe --tags --dirty`
ifeq (${XDG_DATA_HOME},) INSTALL_DIR=${HOME}/.local
XDG_DATA_HOME=${HOME}/.local/share
endif
MAN_DIR=${XDG_DATA_HOME}/man/man1
BIN_DIR=${HOME}/.local/bin
owl: ${SOURCES} owl: ${SOURCES}
go build -o owl -ldflags "${LINKER_FLAGS}" -- ${SOURCES} go build -o owl -ldflags "${LINKER_FLAGS}" -- ${SOURCES}
owl.1: man.md owl.1: man.md
pandoc -s --shift-heading-level-by=-1 --to=man man.md > owl.1 pandoc -s --shift-heading-level-by=-1 --to=man man.md > owl.1
build: owl owl.1 build: owl owl.1
test: *.go test: *.go
go test -v . go test -v .
install: build
install -m 0777 owl ${BIN_DIR} install:
mkdir -p ${MAN_DIR} install -m 0755 -D owl ${INSTALL_DIR}/bin/owl
install owl.1 ${MAN_DIR} install -m 0644 -D owl.1 ${INSTALL_DIR}/man/man1/owl.1
install -m 0644 -D LICENSE ${INSTALL_DIR}/share/doc/LICENSE
uninstall: uninstall:
rm -I ${BIN_DIR}/owl ${MAN_DIR}/owl.1 rm -I ${INSTALL_DIR}/bin/owl \
${INSTALL_DIR}/man/man1/owl.1 \
${INSTALL_DIR}/share/doc/LICENSE
.PHONY: build test install uninstall .PHONY: build test install uninstall