-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 906 Bytes
/
Makefile
File metadata and controls
37 lines (29 loc) · 906 Bytes
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
# Installation paths
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SYSCONFDIR := $(PREFIX)/etc
# Compilers and tools
GO ?= go
# Compiler flags
GOOS ?= $(shell $(GO) env | grep '^GOOS' | cut -d'=' -f2 | tr -d "'")
GOARCH ?= $(shell $(GO) env | grep '^GOARCH' | cut -d'=' -f2 | tr -d "'")
LDFLAGS ?= -w
build:
install -dm755 build
cd src/; GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -ldflags "$(LDFLAGS) -X 'main.sysconfdir=$(SYSCONFDIR)'" -o ../build/
install: build/typer
# Create directories
install -dm755 $(DESTDIR)$(BINDIR)
# Install files
install -m755 build/typer* $(DESTDIR)$(BINDIR)/
install-config:
# Create directories
install -dm755 $(DESTDIR)$(SYSCONFDIR)
# Install files
cp -r config -T $(DESTDIR)$(SYSCONFDIR)/typer
uninstall:
-rm -f $(DESTDIR)$(BINDIR)/typer
-rm -rf $(DESTDIR)$(SYSCONFDIR)/typer
clean:
-rm -rf build/
.PHONY: build install install-config uninstall clean