-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (34 loc) · 1 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
# Go parameters
GOCMD = go
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
GOGET = $(GOCMD) get
BINARY_NAME = jtnctl
# This should be set to the directory containing your Go source files
SRC_DIR = ./main.go
# Build for all supported platforms
all: clean build-linux build-windows build-darwin
# Clean the workspace
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
# Build for Linux
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) $(SRC_DIR)
# Build for Windows
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME).exe $(SRC_DIR)
# Build for macOS (Darwin)
build-darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME)_darwin $(SRC_DIR)
# Install dependencies (if needed)
get:
$(GOGET) ./...
# Run tests (if you have tests)
test:
$(GOTEST) -v ./...
# Run the built binary (example)
run:
./$(BINARY_NAME)
.PHONY: clean build-linux build-windows build-darwin get test run