-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
51 lines (36 loc) · 937 Bytes
/
Makefile
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
# Package information
CLI ?= main.go
PACKAGE ?= kx-ipmd5-brute
PACKAGES := $(shell go list ./...)
VERSION ?= $(shell git describe --match '[0-9]*\.[0-9]*\.[0-9]*' --tags --abbrev=0 &> /dev/null || echo "0.1")
COMMIT ?= $(shell git log --pretty=format:'%h' -n 1 || echo "unknown")
# Flags
VERSION_FLAGS := "-X github.com/jlettman/kx-ipmd5-brute/brute.Version=${VERSION} -X github.com/jlettman/kx-ipmd5-brute/brute.Commit=${COMMIT}"
# Binary
BIN ?= $(PACKAGE)
# Tools
GO ?= go
###############
# Build tasks #
###############
default: build
.PHONY: default
build: $(BIN)
$(BIN): clean
$(GO) build -ldflags $(VERSION_FLAGS) -o $(BIN) .
build-clean:
rm -f $(BIN)
#############
# Run tasks #
#############
run:
$(GO) run -ldflags $(VERSION_FLAGS) $(CLI)
####################
# Dependency tasks #
####################
depends:
$(GO) get $(PACKAGES)
###############
# Clean tasks #
###############
clean: build-clean