diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-10-04 14:18:56 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-10-04 14:18:56 -0400 |
| commit | b3bfa523287e2f20458c45a3d9b52e39f8a53ff6 (patch) | |
| tree | 7ba146fa4304a19d95f478459fca6a0ee183bcb9 /Makefile | |
| parent | 6817d5861986084f55785842b07639f7aeaacf0a (diff) | |
| download | pfc-b3bfa523287e2f20458c45a3d9b52e39f8a53ff6.zip | |
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -1,23 +1,34 @@ -include config.mk +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man -build: +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: build +run: pfc ./pfc clean: - rm -f pfc pfc-v* + rm -f pfc pfc-v* pfc.1 + +doc: pfc.1 -doc: - sed "s/VERSION/${VERSION}/g" < doc/intro.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: doc - go build -buildvcs=false +install: pfc pfc.1 cp pfc ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/pfc mkdir -p ${DESTDIR}${MANPREFIX}/man1 @@ -29,13 +40,14 @@ uninstall: ${DESTDIR}${MANPREFIX}/man1/pfc.1 release: + mkdir -p release/${VERSION} for os in ${GOOSES} ; do \ for arch in ${GOARCHES} ; do \ - bin=pfc-v${VERSION}-$$os-$$arch; \ + bin=pfc-${VERSION}-$$os-$$arch; \ if [ $$os = "windows" ] ; then bin=$$bin.exe; fi; \ echo building $$bin; \ - GOOS=$$os GOARCH=$$arch go build -o $$bin; \ + GOOS=$$os GOARCH=$$arch go build -o release/${VERSION}/$$bin; \ done \ done -.PHONY: build run clean doc install uninstall release +.PHONY: build run clean doc install uninstall release .FORCE |