Skip to content

Commit 8e84788

Browse files
committed
Makefile: modify the manpages and docsy targets to only run when building a native limactl.
Signed-off-by: Norio Nomura <[email protected]>
1 parent 54fa065 commit 8e84788

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,13 @@ else
338338
cp -aL $< $@
339339
endif
340340

341+
################################################################################
342+
# returns difference between GOOS GOARCH and GOHOSTOS GOHOSTARCH.
343+
cross_compiling = $(call diff,$(GOOS) $(GOARCH),$(GOHOSTOS) $(GOHOSTARCH))
344+
# returns true if cross_compiling is empty.
345+
native_compiling = $(if $(cross_compiling),,true)
346+
347+
################################################################################
341348
# _output/share/man/man1
342349
.PHONY: manpages
343350
# Set limactl.1 as explicit dependency.
@@ -346,8 +353,11 @@ endif
346353
manpages: _output/share/man/man1/limactl.1
347354
_output/share/man/man1/limactl.1: _output/bin/limactl$(exe)
348355
@mkdir -p _output/share/man/man1
356+
ifeq ($(native_compiling),true)
357+
# The manpages are generated by limactl, so the limactl binary must be native.
349358
$< generate-doc _output/share/man/man1 \
350359
--output _output --prefix $(PREFIX)
360+
endif
351361

352362
################################################################################
353363
.PHONY: docsy
@@ -357,8 +367,11 @@ _output/share/man/man1/limactl.1: _output/bin/limactl$(exe)
357367
docsy: website/_output/docsy/limactl.md
358368
website/_output/docsy/limactl.md: _output/bin/limactl$(exe)
359369
@mkdir -p website/_output/docsy
370+
ifeq ($(native_compiling),true)
371+
# The docs are generated by limactl, so the limactl binary must be native.
360372
$< generate-doc --type docsy website/_output/docsy \
361373
--output _output --prefix $(PREFIX)
374+
endif
362375

363376
################################################################################
364377
.PHONY: diagrams

0 commit comments

Comments
 (0)