Skip to content

Commit 49da0c6

Browse files
committed
correct cygwin path resolution
1 parent 1cf647f commit 49da0c6

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ test-release:
2020
goreleaser --skip-publish --snapshot --rm-dist
2121

2222
## toolbox - start
23+
## Current working directory
24+
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
2325
## Location to install dependencies to
24-
LOCALBIN ?= $(shell test -s "cygpath -m $$(pwd)" || pwd)/bin
26+
LOCALBIN ?= $(LOCALDIR)/bin
2527
$(LOCALBIN):
2628
mkdir -p $(LOCALBIN)
2729

@@ -56,7 +58,7 @@ update-toolbox-tools:
5658
$(LOCALBIN)/semver \
5759
$(LOCALBIN)/golangci-lint \
5860
$(LOCALBIN)/deepcopy-gen
59-
toolbox makefile -f $$(pwd)/Makefile \
61+
toolbox makefile -f $(LOCALDIR)/Makefile \
6062
github.com/bakito/semver \
6163
github.com/golangci/golangci-lint/cmd/golangci-lint \
6264
k8s.io/code-generator/cmd/[email protected]/kubernetes/code-generator

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ toolbox makefile -f ./Makefile \
8383

8484
```Makefile
8585
## toolbox - start
86+
## Current working directory
87+
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
8688
## Location to install dependencies to
87-
LOCALBIN ?= $(shell test -s "cygpath -m $$(pwd)" || pwd)/bin
89+
LOCALBIN ?= $(LOCALDIR)/bin
8890
$(LOCALBIN):
8991
mkdir -p $(LOCALBIN)
9092

@@ -119,7 +121,7 @@ update-toolbox-tools:
119121
$(LOCALBIN)/semver \
120122
$(LOCALBIN)/toolbox \
121123
$(LOCALBIN)/controller-gen
122-
toolbox makefile -f $$(pwd)/Makefile \
124+
toolbox makefile -f $(LOCALDIR)/Makefile \
123125
github.com/bakito/semver \
124126
github.com/bakito/toolbox \
125127
sigs.k8s.io/controller-tools/cmd/[email protected]/kubernetes-sigs/controller-tools

pkg/makefile/Makefile.tpl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
## Current working directory
2+
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
13
## Location to install dependencies to
2-
LOCALBIN ?= $(shell test -s "cygpath -m $$(pwd)" || pwd)/bin
4+
LOCALBIN ?= $(LOCALDIR)/bin
35
$(LOCALBIN):
46
mkdir -p $(LOCALBIN)
57

@@ -27,6 +29,6 @@ update-toolbox-tools:
2729
@rm -f{{- range .Tools }} \
2830
$(LOCALBIN)/{{.Name}}
2931
{{- end }}
30-
toolbox makefile -f $$(pwd)/Makefile{{- range .Tools }} \
32+
toolbox makefile -f $(LOCALDIR)/Makefile{{- range .Tools }} \
3133
{{.Tool}}
3234
{{- end }}

testdata/Makefile.content.expected

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
...
22

33
## toolbox - start
4+
## Current working directory
5+
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
46
## Location to install dependencies to
5-
LOCALBIN ?= $(shell test -s "cygpath -m $$(pwd)" || pwd)/bin
7+
LOCALBIN ?= $(LOCALDIR)/bin
68
$(LOCALBIN):
79
mkdir -p $(LOCALBIN)
810

@@ -37,7 +39,7 @@ update-toolbox-tools:
3739
$(LOCALBIN)/semver \
3840
$(LOCALBIN)/toolbox \
3941
$(LOCALBIN)/controller-gen
40-
toolbox makefile -f $$(pwd)/Makefile \
42+
toolbox makefile -f $(LOCALDIR)/Makefile \
4143
github.com/bakito/semver \
4244
github.com/bakito/toolbox \
4345
sigs.k8s.io/controller-tools/cmd/[email protected]/kubernetes-sigs/controller-tools

testdata/Makefile.expected

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## toolbox - start
2+
## Current working directory
3+
LOCALDIR ?= $(shell which cygpath > /dev/null 2>&1 && cygpath -m $$(pwd) || pwd)
24
## Location to install dependencies to
3-
LOCALBIN ?= $(shell test -s "cygpath -m $$(pwd)" || pwd)/bin
5+
LOCALBIN ?= $(LOCALDIR)/bin
46
$(LOCALBIN):
57
mkdir -p $(LOCALBIN)
68

@@ -35,7 +37,7 @@ update-toolbox-tools:
3537
$(LOCALBIN)/semver \
3638
$(LOCALBIN)/toolbox \
3739
$(LOCALBIN)/controller-gen
38-
toolbox makefile -f $$(pwd)/Makefile \
40+
toolbox makefile -f $(LOCALDIR)/Makefile \
3941
github.com/bakito/semver \
4042
github.com/bakito/toolbox \
4143
sigs.k8s.io/controller-tools/cmd/[email protected]/kubernetes-sigs/controller-tools

0 commit comments

Comments
 (0)