-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (50 loc) · 1.46 KB
/
Copy pathMakefile
File metadata and controls
60 lines (50 loc) · 1.46 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
.PHONY: build install clean test build-linux run help
# Variables
BINARY_NAME=phpark
VERSION=$(shell git describe --tags --always --dirty)
BUILD_DIR=dist
GO_FILES=$(shell find . -name '*.go' -type f)
# Default target
all: build
# Build for current platform
build: $(GO_FILES)
@echo "Building $(BINARY_NAME)..."
go build -ldflags="-X main.version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/phpark
# Build for Linux
build-linux:
@echo "Building for Linux..."
GOOS=linux GOARCH=amd64 go build -ldflags="-X main.version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux ./cmd/phpark
# Install dependencies
deps:
@echo "Installing dependencies..."
go mod download
go mod tidy
# Run tests
test:
@echo "Running tests..."
go test -v ./...
# Run the application
run: build
@$(BUILD_DIR)/$(BINARY_NAME)
# Clean build artifacts
clean:
@echo "Cleaning..."
rm -rf $(BUILD_DIR)
go clean
# Install locally (for development)
install: build
@echo "Installing to /usr/local/bin..."
sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
# Show help
help:
@echo "PHPark Makefile"
@echo ""
@echo "Usage:"
@echo " make build Build for current platform"
@echo " make build-linux Build for Linux (amd64)"
@echo " make deps Install dependencies"
@echo " make test Run tests"
@echo " make run Build and run"
@echo " make clean Remove build artifacts"
@echo " make install Install locally"
@echo " make help Show this help"