-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (44 loc) · 1.31 KB
/
Copy pathMakefile
File metadata and controls
56 lines (44 loc) · 1.31 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
APP := ytdl-pro
CMD := ./cmd/ytdl-pro
BIN_DIR := bin
BIN := $(BIN_DIR)/$(APP)
GO ?= go
ARGS ?=
PREFIX ?= /opt/homebrew
ZSH_COMPLETION_DIR ?= $(PREFIX)/share/zsh/site-functions
.PHONY: all build build-libllama run test fmt tidy install install-completion clean help
all: build
build:
@mkdir -p $(BIN_DIR)
$(GO) build -o $(BIN) $(CMD)
build-libllama:
@mkdir -p $(BIN_DIR)
CGO_ENABLED=1 $(GO) build -tags libllama -o $(BIN) $(CMD)
run:
$(GO) run $(CMD) $(ARGS)
test:
$(GO) test ./...
fmt:
$(GO) fmt ./...
tidy:
$(GO) mod tidy
install:
$(GO) install $(CMD)
install-completion:
@mkdir -p $(ZSH_COMPLETION_DIR)
cp completions/zsh/_ytdl-pro $(ZSH_COMPLETION_DIR)/_ytdl-pro
clean:
$(GO) clean
rm -rf $(BIN_DIR)
help:
@printf '%s\n' \
'Available targets:' \
' make build Build ./bin/ytdl-pro' \
' make build-libllama Build ./bin/ytdl-pro with embedded libllama' \
' make run ARGS="..." Run the application with arguments' \
' make test Run all tests' \
' make fmt Format Go source files' \
' make tidy Update Go module dependencies' \
' make install Install ytdl-pro into GOBIN/GOPATH/bin' \
' make install-completion Install zsh tab completion' \
' make clean Remove build output'