-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (34 loc) · 874 Bytes
/
Makefile
File metadata and controls
40 lines (34 loc) · 874 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
APP_NAME := spear
PLUGIN_DIRS := $(wildcard plugins/*)
.PHONY: all build plugins clean shrink
all: build plugins
## Build main app
build:
@echo ">> Building $(APP_NAME)..."
go build -o build/$(APP_NAME) ./cmd/$(APP_NAME)/main.go
## Build all plugins
plugins:
@echo ">> Building plugins..."
@for dir in $(PLUGIN_DIRS); do \
$(MAKE) -C $$dir; \
done
## Clean everything
clean:
@echo ">> Cleaning..."
@rm -rf build/
@for dir in $(PLUGIN_DIRS); do \
$(MAKE) -C $$dir clean || true; \
done
## Shrink binaries with UPX
shrink:
@if ! command -v upx >/dev/null 2>&1; then \
echo "❌ upx isn't installed."; \
exit 1; \
fi
@echo "📦 Compressing binrary..."
@if [ -f build/$(APP_NAME) ]; then \
upx --best --lzma build/$(APP_NAME); \
fi
@echo "📦 Compressing plugins..."
strip --strip-unneeded build/plugins/*.so
@echo "✅ Compression finished."