Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Issue #93: apply -asmflags -trimpath=$(GOPATH) trick
Browse files Browse the repository at this point in the history
  • Loading branch information
bpicode committed Oct 29, 2017
1 parent 6fe3527 commit 2caae91
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH)))
PKGS := $(shell go list ./...)
GOFILES_NOVENDOR := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
FRITZCTL_VERSION ?= unknown
FRITZCTL_OUTPUT ?= fritzctl
BASH_COMPLETION_OUTPUT ?= "os/completion/fritzctl"
MAN_PAGE_OUTPUT ?= "os/man/fritzctl.1"
FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH)))
PKGS := $(shell go list ./...)
GOFILES_NOVENDOR := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
FRITZCTL_VERSION ?= unknown
FRITZCTL_OUTPUT ?= fritzctl
BASH_COMPLETION_OUTPUT ?= "os/completion/fritzctl"
MAN_PAGE_OUTPUT ?= "os/man/fritzctl.1"
DEPENDENCIES_GRAPH_OUTPUT ?= "dependencies.png"
LDFLAGS := --ldflags "-X github.com/bpicode/fritzctl/config.Version=$(FRITZCTL_VERSION)"
TESTFLAGS ?=
BUILDFLAGS := --ldflags "-X github.com/bpicode/fritzctl/config.Version=$(FRITZCTL_VERSION)" -asmflags -trimpath=$(GOPATH)
TESTFLAGS ?=

all: sysinfo deps build install test codequality completion_bash man

Expand Down Expand Up @@ -54,20 +54,20 @@ depgraph: deps

build:
@echo -n ">> BUILD, version = $(FRITZCTL_VERSION), output = $(FRITZCTL_OUTPUT)"
@go build -o $(FRITZCTL_OUTPUT) $(LDFLAGS)
@go build -o $(FRITZCTL_OUTPUT) $(BUILDFLAGS)
@$(call ok)

install:
@echo -n ">> INSTALL, version = $(FRITZCTL_VERSION)"
@go install $(LDFLAGS)
@go install $(BUILDFLAGS)
@$(call ok)

test: build
@echo ">> TEST, \"full-mode\": race detector on"
@echo "mode: count" > coverage-all.out
@$(foreach pkg, $(PKGS),\
echo -n " ";\
go test $(LDFLAGS) $(TESTFLAGS) -race -coverprofile=coverage.out -covermode=atomic $(pkg) || exit 1;\
go test $(BUILDFLAGS) $(TESTFLAGS) -race -coverprofile=coverage.out -covermode=atomic $(pkg) || exit 1;\
tail -n +2 coverage.out >> coverage-all.out;)
@go tool cover -html=coverage-all.out -o coverage-all.html

Expand All @@ -76,7 +76,7 @@ fasttest: build
@echo "mode: count" > coverage-all.out
@$(foreach pkg, $(PKGS),\
echo -n " ";\
go test $(LDFLAGS) $(TESTFLAGS) -coverprofile=coverage.out $(pkg) || exit 1;\
go test $(BUILDFLAGS) $(TESTFLAGS) -coverprofile=coverage.out $(pkg) || exit 1;\
tail -n +2 coverage.out >> coverage-all.out;)
@go tool cover -html=coverage-all.out

Expand Down Expand Up @@ -140,7 +140,7 @@ dist_all: dist_linux dist_darwin dist_win

define dist
@echo -n ">> BUILD, $(1)/$(2) "
@(GOOS=$(1) GOARCH=$(2) go build -o $(3) $(LDFLAGS))
@(GOOS=$(1) GOARCH=$(2) go build -o $(3) $(BUILDFLAGS))
@cp $(3) build/distributions/fritzctl-$(1)-$(2)$(4)
@cd build/distributions && shasum -a 256 "fritzctl-$(1)-$(2)$(4)" | tee "fritzctl-$(1)-$(2)$(4).sha256" | cut -b 1-64 | tr -d "\n"
@$(call ok)
Expand Down

0 comments on commit 2caae91

Please sign in to comment.