~adnano/astronaut

ref: 5e4973a9557669a641d5762e0c5105c6260f37d2 astronaut/Makefile -rw-r--r-- 1.3 KiB
5e4973a9Adnan Maolood Makefile: Add astronaut.conf to install target 3 months ago
                                                                                
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
54
55
56
57
58
.POSIX:
.SUFFIXES:
.SUFFIXES: .1 .1.scd

_git_version=$(shell git describe --tags --dirty 2>/dev/null)
ifeq ($(strip $(_git_version)),)
VERSION=0.0.0
else
VERSION=$(_git_version)
endif

PREFIX?=/usr/local
BINDIR?=$(PREFIX)/bin
SHAREDIR?=$(PREFIX)/share/astronaut
MANDIR?=$(PREFIX)/share/man

VPATH=doc
GO?=go
GOFLAGS?=
GOSRC!=find . -name '*.go'
GOSRC+=go.mod go.sum
GOSRC+=about/*

DOCS := \
	astronaut.1

all: astronaut doc

doc: $(DOCS)

.1.scd.1:
	scdoc < $< > $@

astronaut: $(GOSRC)
	$(GO) build $(GOFLAGS) \
		-ldflags "-X main.Version=$(VERSION)" \
		-o $@

clean:
	$(RM) astronaut
	$(RM) $(DOCS)

install: all
	mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR) $(DESTDIR)$(MANDIR)/man1 
	install -m755 astronaut $(DESTDIR)$(BINDIR)/astronaut
	install -m755 astronaut.1 $(DESTDIR)$(MANDIR)/man1/astronaut.1
	install -m755 config/astronaut.conf $(DESTDIR)$(SHAREDIR)/astronaut.conf
	install -m755 config/binds.conf $(DESTDIR)$(SHAREDIR)/binds.conf
	install -m755 config/style.conf $(DESTDIR)$(SHAREDIR)/style.conf

uninstall:
	$(RM) $(DESTDIR)$(BINDIR)/astronaut
	$(RM) $(DESTDIR)$(MANDIR)/man1/astronaut.1
	$(RM) $(DESTDIR)$(SHAREDIR)/astronaut.conf
	$(RM) $(DESTDIR)$(SHAREDIR)/binds.conf
	$(RM) $(DESTDIR)$(SHAREDIR)/style.conf

.PHONY: all doc clean install uninstall