-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (74 loc) · 1.78 KB
/
Copy pathMakefile
File metadata and controls
90 lines (74 loc) · 1.78 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
# InfraSync Makefile
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GORUN=$(GOCMD) run
GOTEST=$(GOCMD) test
GOCLEAN=$(GOCMD) clean
GOGET=$(GOCMD) get
GOFORMAT=$(GOCMD) fmt
GOLINT=golangci-lint
BINARY_NAME=infrasync
CMD_DIR=./cmd
MAIN_GO=./main.go
# Build targets
.PHONY: all build clean run test lint fmt help
all: clean fmt lint test build
build:
@echo "Building..."
$(GOBUILD) -o $(BINARY_NAME) $(MAIN_GO)
install:
$(GOCMD) install $(MAIN_GO)
clean:
@echo "Cleaning..."
$(GOCLEAN)
rm -f $(BINARY_NAME)
run:
@echo "Running..."
$(GORUN) $(MAIN_GO)
test:
@echo "Testing..."
$(GOTEST) -v ./...
lint:
@echo "Linting..."
$(GOLINT) run
fmt:
@echo "Formatting..."
$(GOFORMAT) -s -w .
# Specific commands
.PHONY: init import sync
init:
@echo "Running init command..."
./$(BINARY_NAME) init $(filter-out $@,$(MAKECMDGOALS))
import:
@echo "Running import command..."
./$(BINARY_NAME) import $(filter-out $@,$(MAKECMDGOALS))
sync:
@echo "Running sync command..."
./$(BINARY_NAME) sync $(filter-out $@,$(MAKECMDGOALS))
# Special target to allow passing arguments to specific commands
%:
@:
help:
@echo "InfraSync Makefile"
@echo ""
@echo "Usage:"
@echo " make <target>"
@echo ""
@echo "Targets:"
@echo " build Build the binary"
@echo " clean Clean build files"
@echo " run Run directly with go run"
@echo " test Run tests"
@echo " lint Run linter"
@echo " fmt Format code"
@echo " init Run init command"
@echo " import Run import command"
@echo " sync Run sync command"
@echo " help Show this help"
@echo ""
@echo "Examples:"
@echo " make build"
@echo " make import --project=my-project --services=pubsub"
@echo " make sync --project=my-project --state-bucket=my-bucket"
@echo ""