blob: 9cec0216a38c756280489124f5d8c4eed76cef4f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
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
|