-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (91 loc) · 3.63 KB
/
Copy pathMakefile
File metadata and controls
108 lines (91 loc) · 3.63 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Makefile for tproxy project
# Default: Build Linux client and Windows server in Linux environment
# Binary names
CLIENT_BINARY := client
SERVER_BINARY := server
# Build directory
BUILD_DIR := bin
# Go build flags
LDFLAGS := -s -w
DEBUG_FLAGS := -gcflags "all=-N -l"
.PHONY: all build client server debug clean test help install
# Default target - build Linux client and Windows server
all: clean build
# Build Linux client and Windows server (for Linux environment)
build: client server
# Build Linux client
client:
@echo "Building Linux $(CLIENT_BINARY)..."
@mkdir -p $(BUILD_DIR)
@GOOS=linux GOARCH=amd64 go build -gcflags "all=-N -l" -o $(BUILD_DIR)/$(CLIENT_BINARY) ./proxy
@cp proxy/conf.yaml $(BUILD_DIR)/
@echo "$(CLIENT_BINARY) built successfully"
# Build Windows server
server:
@echo "Building Windows $(SERVER_BINARY)..."
@mkdir -p $(BUILD_DIR)
@GOOS=windows GOARCH=amd64 go build -gcflags "all=-N -l" -o $(BUILD_DIR)/$(SERVER_BINARY).exe ./relay
@echo "$(SERVER_BINARY).exe built successfully"
# Build with debug symbols
debug:
@echo "Building with debug symbols..."
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 go build $(DEBUG_FLAGS) -o $(BUILD_DIR)/$(CLIENT_BINARY)-debug ./proxy
GOOS=windows GOARCH=amd64 go build $(DEBUG_FLAGS) -o $(BUILD_DIR)/$(SERVER_BINARY)-debug.exe ./relay
@echo "Debug builds completed"
# Build both client and server for Linux
linux-all:
@echo "Building both client and server for Linux..."
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(CLIENT_BINARY)-linux ./proxy
GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(SERVER_BINARY)-linux ./relay
@echo "Linux builds completed"
# Build both client and server for Windows
windows-all:
@echo "Building both client and server for Windows..."
@mkdir -p $(BUILD_DIR)
GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(CLIENT_BINARY)-windows.exe ./proxy
GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(SERVER_BINARY)-windows.exe ./relay
@echo "Windows builds completed"
# Run tests
test:
@echo "Running tests..."
go test -v ./...
@echo "Tests completed"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BUILD_DIR)/*
@echo "Clean completed"
cleanall:
@echo "Cleaning all build artifacts..."
@rm -rf $(BUILD_DIR)
@echo "All clean completed"
# Install dependencies
install:
@echo "Installing dependencies..."
go mod download
go mod tidy
@echo "Dependencies installed"
# Show help
help:
@echo "Available targets:"
@echo " make all - Clean and build all binaries"
@echo " make build - Build both client and server"
@echo " make client - Build only client"
@echo " make server - Build only server"
@echo " make debug - Clean and build Linux client + Windows server (default)"
@echo " make build - Build Linux client + Windows server"
@echo " make client - Build Linux client only"
@echo " make server - Build Windows server only"
@echo " make debug - Build with debug symbols"
@echo " make linux-all - Build both client and server for Linux"
@echo " make windows-all - Build both client and server for Windows"
@echo " make test - Run tests"
@echo " make clean - Remove build artifacts"
@echo " make install - Install/update dependencies"
@echo " make help - Show this help message"
@echo ""
@echo "Build outputs:"
@echo " bin/$(CLIENT_BINARY) - Linux client"
@echo " bin/$(SERVER_BINARY).exe - Windows server