-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
40 lines (30 loc) · 938 Bytes
/
GNUmakefile
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
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
MKDIR = mkdir -p
GO = go
PANDOC = pandoc
INSTALL = install
RM = rm -f
DATETIME= "Apr 17, 2024"
VERSION= 1.0.0
LDFLAGS = -ldflags "-X 'main.Version=$(VERSION)'"
BIN = bin/vanity
.PHONY: all build man install uninstall clean
all: build man
build:
$(GO) build $(LDFLAGS) -o $(BIN) cmd/vanity/main.go
man:
@$(MKDIR) man
$(PANDOC) --standalone --to man -M footer=$(VERSION) -M date=$(DATETIME) doc/vanity.1.md -o man/vanity.1
$(PANDOC) --standalone --to man -M footer=$(VERSION) -M date=$(DATETIME) doc/vanity.conf.5.md -o man/vanity.conf.5
install: build man
$(INSTALL) -m 755 $(BIN) $(BINDIR)/vanity
$(INSTALL) -m 644 man/vanity.1 $(MANDIR)/man1/vanity.1
$(INSTALL) -m 644 man/vanity.conf.5 $(MANDIR)/man5/vanity.conf.5
uninstall:
$(RM) $(BINDIR)/vanity
$(RM) $(MANDIR)/man1/vanity.1
$(RM) $(MANDIR)/man5/vanity.conf.5
clean:
$(RM) -r bin man