@@ -29,10 +29,10 @@ VERSION=$(shell cat VERSION)
2929RELEASE =$(shell cat RELEASE)
3030
3131# Current directory
32- CURRENTDIR =$(dir $( realpath $( firstword $( MAKEFILE_LIST ) ) ) )
32+ CURRENTDIR =$(CURDIR ) /
3333
3434# Target directory
35- TARGETDIR =$( CURRENTDIR ) target
35+ TARGETDIR =target
3636
3737# Directory where to store binary utility tools
3838BINUTIL =$(TARGETDIR ) /binutil
4646# GO lang path
4747ifeq ($(GOPATH ) ,)
4848 # extract the GOPATH
49- GOPATH=$(firstword $(subst /src/, ,$(CURRENTDIR)) )
49+ GOPATH=$(shell echo "$(CURDIR)" | sed 's| /src/.*||' )
5050endif
5151
5252# Add the GO binary dir in the PATH
@@ -61,11 +61,11 @@ ifeq ($(DOCKER),)
6161endif
6262
6363# Common commands
64- GO=GOPATH =$(GOPATH ) GOPRIVATE=$(CVSPATH ) $(shell which go)
64+ GO=GOPATH =" $(GOPATH ) " GOPRIVATE=$(CVSPATH ) $(shell which go)
6565GOVERSION =${shell go version | grep -Eo '(go[0-9]+.[0-9]+)'}
6666GOFMT =$(shell which gofmt)
6767GOTEST =$(GO ) test
68- GODOC=GOPATH =$(GOPATH ) $(shell which godoc)
68+ GODOC=GOPATH =" $(GOPATH ) " $(shell which godoc)
6969GOLANGCILINT =$(BINUTIL ) /golangci-lint
7070GOLANGCILINTVERSION =v2.12.2
7171
@@ -79,7 +79,7 @@ GOPKGS=$(shell $(GO) list $(SRCDIR)/...)
7979ifeq ($(strip $(DEVMODE ) ) ,LOCAL)
8080 TESTEXTRACMD=&& $(GO) tool cover -func=$(TARGETDIR)/report/coverage.out
8181else
82- TESTEXTRACMD=2>&1 | tee >(PATH=$(GOPATH)/bin:$(PATH) go-junit-report > $(TARGETDIR)/test/report.xml); test $${PIPESTATUS[0]} -eq 0
82+ TESTEXTRACMD=2>&1 | tee >(PATH=" $(GOPATH)/bin:$(PATH)" go-junit-report > $(TARGETDIR)/test/report.xml); test $${PIPESTATUS[0]} -eq 0
8383endif
8484
8585
129129# Remove any build artifact
130130.PHONY : clean
131131clean :
132- rm -rf $(TARGETDIR )
132+ rm -rf " $( TARGETDIR) "
133133
134134# Generate the coverage report
135135.PHONY : coverage
136136coverage : ensuretarget
137- $(GO ) tool cover -html=$(TARGETDIR ) /report/coverage.out -o $(TARGETDIR ) /report/coverage.html
137+ $(GO ) tool cover -html=" $( TARGETDIR) /report/coverage.out" -o " $( TARGETDIR) /report/coverage.html"
138138
139139# Build everything inside a Docker container
140140.PHONY : dbuild
141141dbuild : dockerdev
142- @mkdir -p $(TARGETDIR )
143- @rm -rf $(TARGETDIR ) /*
144- @echo 0 > $(TARGETDIR ) /make.exit
145- CVSPATH=$(CVSPATH ) VENDOR=$(LCVENDOR ) PROJECT=$(PROJECT ) MAKETARGET=' $(MAKETARGET)' DOCKERTAG=' $(DOCKERTAG)' $(CURRENTDIR ) dockerbuild.sh
142+ @mkdir -p " $( TARGETDIR) "
143+ @rm -rf " $( TARGETDIR) /" *
144+ @echo 0 > " $( TARGETDIR) /make.exit"
145+ CVSPATH=$(CVSPATH ) VENDOR=$(LCVENDOR ) PROJECT=$(PROJECT ) MAKETARGET=' $(MAKETARGET)' DOCKERTAG=' $(DOCKERTAG)' " $( CURRENTDIR) dockerbuild.sh"
146146 @exit ` cat $( TARGETDIR) /make.exit`
147147
148148# Get the test dependencies
149149.PHONY : deps
150150deps : ensuretarget
151- curl --silent --show-error --fail --location " https://golangci-lint.run/install.sh" | sh -s -- -b $(BINUTIL ) $(GOLANGCILINTVERSION )
151+ curl --silent --show-error --fail --location " https://golangci-lint.run/install.sh" | sh -s -- -b " $( BINUTIL) " $(GOLANGCILINTVERSION )
152152
153153# Build a base development Docker image
154154.PHONY : dockerdev
155155dockerdev :
156- $(DOCKER ) build --pull --tag ${LCVENDOR} /dev_${PROJECT} --file ./resources/docker/Dockerfile.dev ./resources/docker/
156+ $(DOCKER ) build --pull --tag " ${LCVENDOR} /dev_${PROJECT} " --file ./resources/docker/Dockerfile.dev ./resources/docker/
157157
158158# Create the trget directories if missing
159159.PHONY : ensuretarget
160160ensuretarget :
161- @mkdir -p $(TARGETDIR ) /test
162- @mkdir -p $(TARGETDIR ) /report
163- @mkdir -p $(TARGETDIR ) /binutil
161+ @mkdir -p " $( TARGETDIR) /test"
162+ @mkdir -p " $( TARGETDIR) /report"
163+ @mkdir -p " $( TARGETDIR) /binutil"
164164
165165# Format the source code
166166.PHONY : format
167167format :
168- @find $(SRCDIR ) -type f -name " *.go" -exec $(GOFMT ) -s -w {} \;
168+ @find " $( SRCDIR) " -type f -name " *.go" -exec $(GOFMT ) -s -w {} \;
169169
170170# Generate test mocks
171171.PHONY : generate
172172generate :
173- @find $(SRCDIR ) -type f -name " *mock_test.go" -exec rm {} \;
173+ @find " $( SRCDIR) " -type f -name " *mock_test.go" -exec rm {} \;
174174 $(GO ) generate $(GOPKGS )
175175
176176# Execute multiple linter tools
177177.PHONY : linter
178178linter :
179179 @echo -e " \n\n>>> START: Static code analysis <<<\n\n"
180- $(GOLANGCILINT ) run --max-issues-per-linter 0 --max-same-issues 0 $(SRCDIR ) /...
180+ $(GOLANGCILINT ) run --max-issues-per-linter 0 --max-same-issues 0 " $( SRCDIR) /..."
181181 @echo -e " \n\n>>> END: Static code analysis <<<\n\n"
182182
183183# Download dependencies
0 commit comments