-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (22 loc) · 907 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
# Makefile for cross-compilation
BINARY_NAME_SERVER=server
BINARY_NAME_CLIENT=client
BUILD_DIR=build
.PHONY: all clean build
# Windows
build-windows:
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/windows/$(BINARY_NAME_SERVER).exe ./server/server.go
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/windows/$(BINARY_NAME_CLIENT).exe ./client/client.go
# MacOS
build-macos:
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/macos/$(BINARY_NAME_SERVER) ./server/server.go
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/macos/$(BINARY_NAME_CLIENT) ./client/client.go
# Linux
build-linux:
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/linux/$(BINARY_NAME_SERVER) ./server/server.go
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/linux/$(BINARY_NAME_CLIENT) ./client/client.go
# All builds
all: build-windows build-macos build-linux
# Clean build artifacts
clean:
rm -rf $(BUILD_DIR)