-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (44 loc) · 1.34 KB
/
Copy pathMakefile
File metadata and controls
61 lines (44 loc) · 1.34 KB
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
59
60
PREFIX ?= /usr/local/bin
pkgname ?= mermaid-ascii
targets += $(PREFIX)/$(pkgname)
ifneq (,$(wildcard /usr/share/bash-completion/completions/))
targets += /usr/share/bash-completion/completions/$(pkgname)
endif
all: build/$(pkgname) build/completions/bash build/completions/zsh build/completions/fish ## All targets
build/$(pkgname): cmd/*.go | build/
go build -o $@
.PHONY: install
install: $(targets)
$(PREFIX)/$(pkgname): build/$(pkgname) | $(PREFIX)
install -m 755 $< $@
/usr/share/bash-completion/completions/$(pkgname): build/completions/bash
install -m 755 $< $@
build/completions/%: build/$(pkgname) | build/completions/
./$< completion $(@F) > $@
%/:
mkdir -p $@
.PHONY: clean
clean: ## Remove generated files
$(RM) -r build
.PHONY: uninstall
uninstall: ## Remove local installation
$(RM) $(targets)
.PHONY: test
test: ## Run the go tests
go test ./... -v
.PHONY: docker-build
docker-build:
docker build -t mermaid-ascii:latest .
.PHONY: docker-test
docker-test: docker-build ## Run the go tests in docker
docker build --target test -t mermaid-ascii:test -f Dockerfile.test .
.PHONY: docker-run
docker-run: docker-build
docker run -i mermaid-ascii:latest
dev:
air
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
sort | \
column -s ':' -t