-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (41 loc) · 1002 Bytes
/
Makefile
File metadata and controls
52 lines (41 loc) · 1002 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
52
SHELL := /bin/bash
# Define the Go compiler
GOCMD = go
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
# Define the main Go application
MAIN_OUT = xpire
# Define the plugin directory and plugin output
PLUGIN_DIR = filesystems
PLUGIN_SRC = $(PLUGIN_DIR)/*/*.go
.PHONY: all build plugins test clean
# Default target
all: plugins build
# Build the Go plugin(s)
plugins:
for src in $(PLUGIN_SRC); do \
$(GOBUILD) -buildmode=plugin -o $(PLUGIN_DIR)/$$(basename $$src .go)/$$(basename $$src .go).so $$src; \
done
# Clean up
clean:
$(GOCLEAN)
rm -f $(MAIN_OUT) $(PLUGIN_DIR)/*/*.so
## Build the main Go application
build:
$(GOBUILD) -o $(MAIN_OUT) .
test: test-setup test-all test-teardown
test-setup:
@echo "setup testing environment"
@cd tests \
&& ./setup.sh > /dev/null
test-all:
@echo "running tests"
@$(GOTEST) || { \
$(MAKE) test-teardown; \
exit 1; \
}
test-teardown:
@echo "teardown testing environment"
@cd tests \
&& ./teardown.sh