From b3bfa523287e2f20458c45a3d9b52e39f8a53ff6 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sat, 4 Oct 2025 14:18:56 -0400 Subject: update makefile --- Makefile | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 276fd6b..9cec021 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.3