summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8c1db3372fc72f1ce06b522cde12984114919b46 (plain)
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
# sixkcd - Fetch XKCD comics from the command line
# See LICENSE file for copyright and license details.
COMMIT := $(shell git rev-parse --short HEAD)
VERSION := $(or $(SIXKCD_VERSION),dev-$(COMMIT))

SRC := $(shell go list -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' ./...)

CMD := sixkcd

PREFIX=/usr/local
MANPREFIX=$(PREFIX)/share/man

sixkcd: $(SRC)
	go mod download
	go mod verify
	go build -ldflags "-X main.version=$(VERSION)" -o $(CMD) ./$(CMD).go

install: all
	mkdir -p $(PREFIX)/bin
	mkdir -p $(MANPREFIX)/man1
	cp -f $(CMD) $(PREFIX)/bin
	cp -f $(CMD).1 $(MANPREFIX)/man1

clean:
	rm -f ./$(CMD)

uninstall:
	rm -f $(PREFIX)/bin/$(CMD)
	rm -f $(MANPREFIX)/man1/$(CMD).1

info:
	@echo "$(CMD)"
	@echo "Version: $(VERSION)"

all: info sixkcd

.PHONY: all install clean uninstall help