-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (59 loc) · 1.41 KB
/
Makefile
File metadata and controls
69 lines (59 loc) · 1.41 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
# SQL2EXPR Makefile
# Simple build system for the SQL to expr-lang transpiler library
# Variables
REPL_BINARY := repl
BIN_DIR := bin
CMD_DIR := cmd
# Go parameters
GOCMD := go
GOBUILD := $(GOCMD) build
GOCLEAN := $(GOCMD) clean
GOTEST := $(GOCMD) test
GOMOD := $(GOCMD) mod
# Build flags
LDFLAGS := -ldflags "-s -w"
# Default target
.PHONY: all
all: clean deps build
# Build the REPL binary
.PHONY: build
build:
@echo "Building REPL binary..."
@mkdir -p $(BIN_DIR)
$(GOBUILD) -v $(LDFLAGS) -o $(BIN_DIR)/$(REPL_BINARY) $(CMD_DIR)/repl/main.go
@echo "REPL binary built: $(BIN_DIR)/$(REPL_BINARY)"
# Run tests
.PHONY: test
test:
@echo "Running tests..."
$(GOTEST) -v ./...
# Run the REPL
.PHONY: run
run: build
@echo "Starting REPL..."
./$(BIN_DIR)/$(REPL_BINARY)
# Download dependencies
.PHONY: deps
deps:
@echo "Downloading dependencies..."
$(GOMOD) download
$(GOMOD) tidy
# Clean build artifacts
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
$(GOCLEAN)
rm -rf $(BIN_DIR)
# Show help
.PHONY: help
help:
@echo "SQL2EXPR Makefile - Available targets:"
@echo ""
@echo " build - Build REPL binary"
@echo " test - Run tests"
@echo " run - Build and run REPL"
@echo " clean - Clean build artifacts"
@echo " deps - Download and tidy dependencies"
@echo " help - Show this help message"
@echo ""
@echo "Default target: all (clean, deps, build)"