Skip to content

Commit

Permalink
[chore] Build .exe files by default on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti committed Sep 20, 2024
1 parent 2cbee82 commit 7558570
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,21 @@ generate-metrics:
otelcol:
go generate ./...
GO111MODULE=on CGO_ENABLED=0 go build -trimpath -o ./bin/otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) $(BUILD_INFO) ./cmd/otelcol
ln -sf otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) ./bin/otelcol
ifeq ($(OS), Windows_NT)
$(LINK_CMD) .\bin\otelcol$(EXTENSION) .\bin\otelcol_$(GOOS)_$(GOARCH)$(EXTENSION)
else
$(LINK_CMD) otelcol_$(GOOS)_$(GOARCH)$(EXTENSION) ./bin/otelcol$(EXTENSION)
endif

.PHONY: migratecheckpoint
migratecheckpoint:
go generate ./...
GO111MODULE=on CGO_ENABLED=0 go build -trimpath -o ./bin/migratecheckpoint_$(GOOS)_$(GOARCH)$(EXTENSION) $(BUILD_INFO) ./cmd/migratecheckpoint
ln -sf migratecheckpoint_$(GOOS)_$(GOARCH)$(EXTENSION) ./bin/migratecheckpoint
ifeq ($(OS), Windows_NT)
$(LINK_CMD) .\bin\migratecheckpoint$(EXTENSION) .\bin\migratecheckpoint_$(GOOS)_$(GOARCH)$(EXTENSION)
else
$(LINK_CMD) migratecheckpoint_$(GOOS)_$(GOARCH)$(EXTENSION) ./bin/migratecheckpoint$(EXTENSION)
endif

.PHONY: bundle.d
bundle.d:
Expand Down
3 changes: 3 additions & 0 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ ifeq ($(UNIX_SHELL_ON_WINDOWS),true)
# The backslash needs to be doubled so its passed correctly to the shell.
NORMALIZE_DIRS = sed -e 's/^/\\//' -e 's/://' -e 's/\\\\/\\//g' | sort
NUM_CORES := ${NUMBER_OF_PROCESSORS}
EXTENSION ?=.exe
LINK_CMD = cmd /c mklink /H
else
NORMALIZE_DIRS = sort
NUM_CORES := $(shell getconf _NPROCESSORS_ONLN)
LINK_CMD = ln -sf
endif

# SRC_ROOT is the top of the source tree.
Expand Down

0 comments on commit 7558570

Please sign in to comment.