forked from aws-samples/aurora-dsql-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (41 loc) · 920 Bytes
/
Makefile
File metadata and controls
51 lines (41 loc) · 920 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
48
49
50
51
# Build all cluster management examples
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
BINARY_DIR=bin
TEST_FLAGS=-v -count=1
# Find all cmd directories
CMD_DIRS := $(notdir $(wildcard cmd/*))
BINARIES := $(addprefix $(BINARY_DIR)/,$(CMD_DIRS))
# Default target
.PHONY: all
all: clean build
.PHONY: test
test: test-all
# Test all commands
.PHONY: test-all
test-all: $(addprefix test-,$(CMD_DIRS))
# Rule to test each command individually
.PHONY: test-%
test-%:
$(GOCMD) test $(TEST_FLAGS) ./cmd/$*
# Create bin directory
$(BINARY_DIR):
mkdir -p $(BINARY_DIR)
# Build all commands
.PHONY: build
build: $(BINARY_DIR) $(BINARIES)
# Rule to build each binary
$(BINARY_DIR)/%: cmd/%
$(GOBUILD) -o $@ ./cmd/$*
# Clean build artifacts
.PHONY: clean
clean:
$(GOCLEAN)
rm -rf $(BINARY_DIR)
# List all commands
.PHONY: list
list:
@echo "Available commands:"
@echo $(CMD_DIRS) | tr ' ' '\n'