-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
42 lines (31 loc) · 999 Bytes
/
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
# Force Go Modules
GO111MODULE = on
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/kubo))
# make reproducible
ifneq ($(findstring /,$(IPFS_VERSION)),)
# Locally built kubo
GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
else
# Remote version of kubo (e.g. via `go get -trimpath` or official distribution)
GOFLAGS += -trimpath
endif
.PHONY: install build
go.mod: FORCE
./set-target.sh $(IPFS_VERSION)
FORCE:
mexport.so: main.go go.mod
$(GOCC) build $(GOFLAGS) -buildmode=plugin -o "$@" "$<"
chmod +x "$@"
gen-out:
./build-in-docker.sh
build: mexport.so
@echo "Built against" $(IPFS_VERSION)
install: build
mkdir -p "$(IPFS_PATH)/plugins/"
cp -f mexport.so "$(IPFS_PATH)/plugins/mexport.so"