-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (19 loc) · 721 Bytes
/
Makefile
File metadata and controls
25 lines (19 loc) · 721 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
APP_NAME := github-hdd-mirror
BUILD_DIR := bin
GO_FILES := $(shell find . -name '*.go' -not -path './vendor/*')
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_DATE)
.PHONY: build clean test lint run
build:
@mkdir -p $(BUILD_DIR)
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP_NAME) ./cmd/github-hdd-mirror/
clean:
rm -rf $(BUILD_DIR)
test:
go test ./...
lint:
golangci-lint run ./...
run: build
$(BUILD_DIR)/$(APP_NAME) $(ARGS)