Skip to content

Commit

Permalink
Rework tags and flags passing in Makefile
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Dec 6, 2016
1 parent c12f977 commit 650eeee
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ IPFS_MIN_GO_VERSION = 1.7
IPFS_MIN_GX_VERSION = 0.6
IPFS_MIN_GX_GO_VERSION = 1.1

GOTAGS =
GOTAGS += "" # we have to have always at least one tag, empty tag works well

GOFLAGS =
GOTFLAGS =

export IPFS_REUSEPORT=false
export GOFLAGS
export GOTFLAGS

GOFLAGS += -tags $(call join-with,$(comma),$(GOTAGS))

ifneq ($(COVERALLS_TOKEN), )
covertools_rule = covertools
GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOTFLAGS)
GOT = overalls -project=github.com/ipfs/go-ipfs -covermode atomic -ignore=.git,Godeps,thirdparty,test,core/commands,cmd -- $(GOFLAGS) $(GOTFLAGS)
else
covertools_rule = $()
GOT = go test $(GOTFLAGS) ./...
covertools_rule =
GOT = go test $(GOFLAGS) $(GOTFLAGS) ./...
endif

ifeq ($(TEST_NO_FUSE),1)
GOTFLAGS += -tags nofuse
GOTAGS += nofuse
endif

ifeq ($(OS),Windows_NT)
Expand All @@ -28,6 +37,13 @@ dist_root=/ipfs/QmNZL8wNsvAGdVYr8uGeUE9aGfHjFpHegAWywQFEdSaJbp
gx_bin=bin/gx-v0.9.0
gx-go_bin=bin/gx-go-v1.3.0


# util functions

space =
space +=
comma =,
join-with = $(subst $(space),$1,$(strip $2))
# use things in our bin before any other system binaries
export PATH := bin:$(PATH)
export IPFS_API ?= v04x.ipfs.io
Expand Down Expand Up @@ -58,7 +74,7 @@ path_check:
@bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(GOPATH_DELIMITER), ,$(GOPATH))))

deps: go_check gx_check path_check $(covertools_rule)
${gx_bin} --verbose install --global
${gx_bin} --verbose install --global >/dev/null 2>&1

covertools:
go get -u github.com/mattn/goveralls
Expand All @@ -71,7 +87,11 @@ covertools:
vendor: godep
godep save -r ./...

install build nofuse: deps
nofuse: GOTAGS += nofuse
nofuse: deps
$(MAKE) -C cmd/ipfs install

install build: deps
$(MAKE) -C cmd/ipfs $@

clean:
Expand Down
13 changes: 5 additions & 8 deletions cmd/ipfs/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
COMMIT := $(shell git rev-parse --short HEAD)
ldflags = "-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"
GOFLAGS += -ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(COMMIT)"

all: install

install:
go install -ldflags=$(ldflags)
go install $(GOFLAGS)

build:
go build -i -ldflags=$(ldflags)

nofuse:
go install -tags nofuse -ldflags=$(ldflags)
go build -i $(GOFLAGS)

clean:
go clean -ldflags=$(ldflags)
go clean $(GOFLAGS)

uninstall:
go clean -i -ldflags=$(ldflags)
go clean -i $(GOFLAGS)

0 comments on commit 650eeee

Please sign in to comment.