-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 986 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (26 loc) · 986 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
BINARY_NAME=codeatlas
CMD_PATH=./cmd/codeatlas
DIST_DIR=dist
.PHONY: build run test clean build-linux-amd64 build-linux-arm64 build-darwin-amd64 build-darwin-arm64 build-all
build: clean
go build -o $(BINARY_NAME) $(CMD_PATH)
run: build
./$(BINARY_NAME)
test:
go test ./...
build-linux-amd64:
mkdir -p $(DIST_DIR)
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o $(DIST_DIR)/$(BINARY_NAME)-linux-amd64 $(CMD_PATH)
build-linux-arm64:
mkdir -p $(DIST_DIR)
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -o $(DIST_DIR)/$(BINARY_NAME)-linux-arm64 $(CMD_PATH)
build-darwin-amd64:
mkdir -p $(DIST_DIR)
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o $(DIST_DIR)/$(BINARY_NAME)-darwin-amd64 $(CMD_PATH)
build-darwin-arm64:
mkdir -p $(DIST_DIR)
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o $(DIST_DIR)/$(BINARY_NAME)-darwin-arm64 $(CMD_PATH)
build-all: build-linux-amd64 build-linux-arm64
clean:
rm -f $(BINARY_NAME)
rm -rf $(DIST_DIR)