PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man GOOSES = darwin linux windows GOARCHES = amd64 arm64 VERSION = $(shell git describe --tags --abbrev=0) SRC = $(wildcard *.go) build: pfc pfc: ${SRC} go mod tidy go build go test gofmt -l -s -w . run: pfc ./pfc clean: rm -f pfc pfc-v* pfc.1 doc: pfc.1 pfc.1: .FORCE sed "s/VERSION/${subst v,,${VERSION}}/g" < doc/intro.1 | \ cat - doc/{cmd.1,op.1,func.1,const.1} > pfc.1 install: pfc pfc.1 cp pfc ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/pfc mkdir -p ${DESTDIR}${MANPREFIX}/man1 cp pfc.1 ${DESTDIR}${MANPREFIX}/man1 chmod 644 ${DESTDIR}${MANPREFIX}/man1/pfc.1 uninstall: rm -f ${DESTDIR}${PREFIX}/bin/pfc \ ${DESTDIR}${MANPREFIX}/man1/pfc.1 release: mkdir -p release/${VERSION} for os in ${GOOSES} ; do \ for arch in ${GOARCHES} ; do \ bin=pfc-${VERSION}-$$os-$$arch; \ if [ $$os = "windows" ] ; then bin=$$bin.exe; fi; \ echo building $$bin; \ GOOS=$$os GOARCH=$$arch go build -o release/${VERSION}/$$bin; \ done \ done .PHONY: build run clean doc install uninstall release .FORCE