-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
27 lines (23 loc) · 758 Bytes
/
Copy pathMakefile
File metadata and controls
27 lines (23 loc) · 758 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
PLUGIN_NAME ?= cpa-sensitive
VERSION ?= 0.1.4
BUILD_DIR ?= .
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GO_LDFLAGS ?= -s -w -X main.cpaSensitivePluginVersion=$(VERSION)
EXT_linux = so
EXT_freebsd = so
EXT_darwin = dylib
EXT_windows = dll
PLUGIN_EXT = $(or $(EXT_$(GOOS)),so)
PLUGIN_OUTPUT ?= $(BUILD_DIR)/$(PLUGIN_NAME).$(PLUGIN_EXT)
PLUGIN_HEADER = $(basename $(PLUGIN_OUTPUT)).h
.PHONY: build clean
build:
mkdir -p $(BUILD_DIR)
CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -trimpath -buildmode=c-shared -ldflags "$(GO_LDFLAGS)" -o $(PLUGIN_OUTPUT) .
rm -f $(PLUGIN_HEADER)
clean:
rm -f $(BUILD_DIR)/$(PLUGIN_NAME).so
rm -f $(BUILD_DIR)/$(PLUGIN_NAME).dylib
rm -f $(BUILD_DIR)/$(PLUGIN_NAME).dll
rm -f $(PLUGIN_HEADER)