-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (33 loc) · 1.1 KB
/
Makefile
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
GOCC ?= go
GOFLAGS ?=
# If set, override the install location for plugins
IPFS_PATH ?= $(HOME)/.ipfs
# If set, override the IPFS version to build against. This _modifies_ the local
# go.mod/go.sum files and permanently sets this version.
IPFS_VERSION ?= $(lastword $(shell $(GOCC) list -m github.com/ipfs/go-ipfs))
# make reproducible
ifneq ($(findstring /,$(IPFS_VERSION)),)
# Locally built go-ipfs
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
else
# Remote version of go-ipfs (e.g. via `go get -trimpath` or official distribution)
GOFLAGS += -trimpath
endif
.PHONY: build install
all: ~/.ipfs/plugins/cidtrack.so
clean:
rm -rf $(IPFS_PATH)/plugins/cidtrack.so ../cidtrack.so
go clean
build: cidtrack.so
install: $(IPFS_PATH)/plugins/cidtrack.so
FORCE:
go.mod: FORCE
./set-target.sh $(IPFS_VERSION)
test: *.go
go test -race -cover ./...
$(IPFS_PATH)/plugins/cidtrack.so: cidtrack.so
mkdir -p $(IPFS_PATH)/plugins
cp cidtrack.so $(IPFS_PATH)/plugins/cidtrack.so
cidtrack.so: *.go go.mod
$(GOCC) build $(GOFLAGS) -buildmode=plugin -o cidtrack.so
chmod +x cidtrack.so