-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (36 loc) · 910 Bytes
/
Makefile
File metadata and controls
48 lines (36 loc) · 910 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
37
38
39
40
41
42
43
44
45
46
47
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
BINARY_NAME=text2sql
BINARY_UNIX=$(BINARY_NAME)_unix
# Main package location
MAIN_PACKAGE=./cmd/text2sql
all: test build
build:
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN_PACKAGE)
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
run:
$(GOBUILD) -o $(BINARY_NAME) -v $(MAIN_PACKAGE)
./$(BINARY_NAME)
deps:
$(GOGET) github.com/spf13/cobra
$(GOGET) github.com/lib/pq
$(GOGET) github.com/sashabaranov/go-openai
$(GOGET) github.com/anthropic-ai/anthropic-sdk-golang
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v $(MAIN_PACKAGE)
docker-build:
docker build -t $(BINARY_NAME):latest .
tidy:
$(GOMOD) tidy
.PHONY: all build test clean run deps build-linux docker-build tidy