github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/ipfs/plugin/Makefile (about)

     1  # Force Go Modules
     2  GO111MODULE = on
     3  
     4  GOCC ?= go
     5  GOFLAGS ?=
     6  
     7  # If set, override the install location for plugins
     8  IPFS_PATH ?= $(HOME)/.ipfs
     9  
    10  # If set, override the IPFS version to build against. This _modifies_ the local
    11  # go.mod/go.sum files and permanently sets this version.
    12  IPFS_VERSION ?= $(lastword $(shell $(GOCC) list -m github.com/ipfs/go-ipfs))
    13  
    14  # make reproducible
    15  ifneq ($(findstring /,$(IPFS_VERSION)),)
    16  # Locally built go-ipfs
    17  GOFLAGS += -asmflags=all=-trimpath="$(GOPATH)" -gcflags=all=-trimpath="$(GOPATH)"
    18  else
    19  # Remote version of go-ipfs (e.g. via `go get -trimpath` or official distribution)
    20  GOFLAGS += -trimpath
    21  endif
    22  
    23  .PHONY: install build
    24  
    25  nmt-plugin.so: main/main.go
    26  	$(GOCC) build $(GOFLAGS) -buildmode=plugin -o "$@" "$<"
    27  	chmod +x "$@"
    28  
    29  build: nmt-plugin.so
    30  	@echo "Built against" $(IPFS_VERSION)
    31  
    32  install: build
    33  	mkdir -p "$(IPFS_PATH)/plugins/"
    34  	cp -f nmt-plugin.so "$(IPFS_PATH)/plugins/nmt-plugin.so"