Skip to content

Commit 2148f35

Browse files
committed
Fix Makefile to produce .exe binaries for Windows.
Closes prometheus-community#145
1 parent 6a9ddb2 commit 2148f35

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Makefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ endif
2525

2626
# By default this list is filtered down to some common platforms.
2727
platforms := $(subst /,-,$(shell go tool dist list | grep -e linux -e windows -e darwin | grep -e 386 -e amd64))
28-
PLATFORM_BINS := $(patsubst %,$(BINDIR)/$(BINARY)_$(VERSION_SHORT)_%/$(BINARY),$(platforms))
28+
PLATFORM_BINS_TMP := $(patsubst %,$(BINDIR)/$(BINARY)_$(VERSION_SHORT)_%/$(BINARY),$(platforms))
29+
PLATFORM_BINS := $(patsubst $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_windows-%/$(BINARY),$(BINDIR)/$(BINARY)_$(VERSION_SHORT)_windows-%/$(BINARY).exe,$(PLATFORM_BINS_TMP))
2930
PLATFORM_DIRS := $(patsubst %,$(BINDIR)/$(BINARY)_$(VERSION_SHORT)_%,$(platforms))
3031
PLATFORM_TARS := $(patsubst %,$(RELEASEDIR)/$(BINARY)_$(VERSION_SHORT)_%.tar.gz,$(platforms))
3132

3233
# These are evaluated on use, and so will have the correct values in the build
3334
# rule (https://vic.demuzere.be/articles/golang-makefile-crosscompile/)
34-
PLATFORMS_TEMP = $(subst -, ,$(patsubst $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_%/$(BINARY),%,$@))
35+
PLATFORMS_TEMP = $(subst /, ,$(subst -, ,$(patsubst $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_%,%,$@)))
3536
GOOS = $(word 1, $(PLATFORMS_TEMP))
3637
GOARCH = $(word 2, $(PLATFORMS_TEMP))
3738

38-
CURRENT_PLATFORM := $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_$(shell go env GOOS)-$(shell go env GOARCH)/$(BINARY)
39+
CURRENT_PLATFORM_TMP := $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_$(shell go env GOOS)-$(shell go env GOARCH)/$(BINARY)
40+
CURRENT_PLATFORM := $(patsubst $(BINDIR)/$(BINARY)_$(VERSION_SHORT)_windows-%/$(BINARY),$(BINDIR)/$(BINARY)_$(VERSION_SHORT)_windows-%/$(BINARY).exe,$(CURRENT_PLATFORM_TMP))
3941

4042
CONCURRENT_LINTERS ?=
4143
ifeq ($(CONCURRENT_LINTERS),)

0 commit comments

Comments
 (0)