-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (36 loc) · 908 Bytes
/
Copy pathMakefile
File metadata and controls
44 lines (36 loc) · 908 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
38
39
40
41
42
43
44
APP_NAME = scrollback
BUILD_DIR = bin
.PHONY: all build install uninstall clean test lint
all: build
build:
@echo "Building $(APP_NAME)..."
@mkdir -p $(BUILD_DIR)
go build -o $(BUILD_DIR)/$(APP_NAME) .
install:
@echo "Installing $(APP_NAME)..."
@bin_dir=$$(go env GOBIN); \
if [ -z "$$bin_dir" ]; then \
bin_dir=$$(go env GOPATH)/bin; \
fi; \
mkdir -p "$$bin_dir"; \
echo "Installing to $$bin_dir/$(APP_NAME)"; \
go build -o "$$bin_dir/$(APP_NAME)" .
uninstall:
@echo "Uninstalling $(APP_NAME)..."
@bin_dir=$$(go env GOBIN); \
if [ -z "$$bin_dir" ]; then \
bin_dir=$$(go env GOPATH)/bin; \
fi; \
echo "Removing $$bin_dir/$(APP_NAME)"; \
rm -f "$$bin_dir/$(APP_NAME)"
clean:
@echo "Cleaning up..."
rm -rf $(BUILD_DIR)
test:
go test ./... -race
lint:
@command -v golangci-lint >/dev/null 2>&1 || { \
echo "golangci-lint is not installed"; \
exit 1; \
}
golangci-lint run