forked from AccursedGalaxy/Insider-Monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.12 KB
/
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
52
53
54
55
.PHONY: build run test clean setup
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=insider-monitor
BINARY_UNIX=$(BINARY_NAME)_unix
# Build directory
BUILD_DIR=bin
all: test build
build:
mkdir -p $(BUILD_DIR)
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -v ./cmd/monitor
clean:
$(GOCLEAN)
rm -rf $(BUILD_DIR)
rm -rf data/*.log
run:
$(GOCMD) run cmd/monitor/main.go
run-test:
$(GOCMD) run cmd/monitor/main.go -test
test:
$(GOTEST) -v ./...
setup:
$(GOGET) -v ./...
cp -n config.example.json config.json || true
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_UNIX) -v ./cmd/monitor
docker-build:
docker build -t $(BINARY_NAME) .
# Help target
help:
@echo "Available targets:"
@echo " make build - Build the binary"
@echo " make run - Run the application"
@echo " make run-test - Run in test mode"
@echo " make test - Run tests"
@echo " make clean - Clean build files"
@echo " make setup - Initial setup"
@echo " make build-linux- Build for Linux"