aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-10-04 14:18:56 -0400
committerSam Anthony <sam@samanthony.xyz>2025-10-04 14:18:56 -0400
commitb3bfa523287e2f20458c45a3d9b52e39f8a53ff6 (patch)
tree7ba146fa4304a19d95f478459fca6a0ee183bcb9
parent6817d5861986084f55785842b07639f7aeaacf0a (diff)
downloadpfc-master.zip
update makefileHEADv1.5.1master
-rw-r--r--.gitignore1
-rw-r--r--Makefile34
-rw-r--r--config.mk7
3 files changed, 24 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index 271f523..28c9503 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/pfc
/pfc.1
/pfc-v*
+/release
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
diff --git a/config.mk b/config.mk
deleted file mode 100644
index 70167db..0000000
--- a/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-VERSION = 1.5.0
-
-PREFIX = /usr/local
-MANPREFIX = ${PREFIX}/share/man
-
-GOOSES = darwin linux windows
-GOARCHES = amd64 arm64