Skip to content

Commit d1449b2

Browse files
authored
Merge pull request #1006 from docker/build-dmr-exe-windows
Build dmr.exe on Windows in build-dmr target
2 parents 2221f17 + 2020eb5 commit d1449b2

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,17 @@ DMR_LDFLAGS := -s -w \
6565
-X main.Version=$(DMR_VERSION) \
6666
-X github.com/docker/model-runner/cmd/cli/desktop.Version=$(DMR_VERSION)
6767

68+
# Add .exe on windows, nothing elsewhere
69+
DMR_EXE := dmr
70+
ifeq ($(OS),Windows_NT)
71+
DMR_EXE := dmr.exe
72+
endif
73+
6874
# build-dmr builds a native dmr binary. dmr has no cgo dependencies, so
6975
# CGO_ENABLED=0 keeps the binary statically linked and trivial to
7076
# cross-compile (see build-dmr-cross).
7177
build-dmr:
72-
CGO_ENABLED=0 go build -ldflags="$(DMR_LDFLAGS)" -o dmr ./cmd/dmr
78+
CGO_ENABLED=0 go build -ldflags="$(DMR_LDFLAGS)" -o $(DMR_EXE) ./cmd/dmr
7379

7480
# build-dmr-cross builds standalone dmr binaries for every platform we
7581
# publish packages for (see packaging/), into dist/dmr/<os>-<arch>/dmr.
@@ -108,7 +114,7 @@ run: build
108114
# Clean build artifacts
109115
clean:
110116
rm -f $(APP_NAME)
111-
rm -f dmr
117+
rm -f $(DMR_EXE)
112118
rm -f model-runner.sock
113119

114120
# Run tests

cmd/dmr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dmr rm ai/gemma3 # remove a local model
3737
## Building
3838

3939
```
40-
make build-dmr # native build, output ./dmr
40+
make build-dmr # native build, output ./dmr (or dmr.exe on Windows)
4141
make build-dmr-cross # cross-compile every published target into dist/dmr/<os>-<arch>/
4242
```
4343

0 commit comments

Comments
 (0)