Skip to content

Commit ee58b6c

Browse files
authored
add Makefile (#35)
1 parent 66793f5 commit ee58b6c

File tree

3 files changed

+148
-128
lines changed

3 files changed

+148
-128
lines changed

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Flags for production build
2+
BUILD_FLAGS := -ldflags="-s -w" -trimpath -buildvcs=false -tags=performance
3+
4+
# Flags for test build (debugging, race detection, and more)
5+
TEST_BUILD_FLAGS := -race -gcflags=all="-N -l" -trimpath -tags=debug
6+
7+
# Default target: build for production
8+
all: build
9+
10+
# Build production binary (optimized for runtime speed and size)
11+
build:
12+
go build $(BUILD_FLAGS) -o bin/percona-mongolink .
13+
14+
# Build test binary with race detection and debugging enabled
15+
test-build:
16+
go build $(TEST_BUILD_FLAGS) -o bin/percona-mongolink_test .
17+
18+
# Run tests with race detection
19+
test:
20+
go test -race ./...
21+
22+
pytest:
23+
poetry run pytest
24+
25+
lint:
26+
golangci-lint run
27+
28+
# Clean generated files
29+
clean:
30+
rm -rf bin/*
31+
go clean -cache -testcache
32+
33+
.PHONY: all build test-build test clean

0 commit comments

Comments
 (0)