| 1 | |
| 2 | |
| 3 | |
| 4 | PREFIX ?= /usr/local |
| 5 | DEST := $(shell echo "$(DESTDIR)/$(PREFIX)" | sed 's:///*:/:g; s://*$$::') |
| 6 | |
| 7 | GITHUB_ACTIONS ?= false |
| 8 | |
| 9 | GO ?= go |
| 10 | CP ?= cp |
| 11 | TAR ?= tar |
| 12 | ZIP ?= zip |
| 13 | PLANTUML ?= plantuml |
| 14 | |
| 15 | GOARCH ?= $(shell $(GO) env GOARCH) |
| 16 | GOHOSTARCH := $(shell $(GO) env GOHOSTARCH) |
| 17 | GOHOSTOS := $(shell $(GO) env GOHOSTOS) |
| 18 | GOOS ?= $(shell $(GO) env GOOS) |
| 19 | ifeq ($(GOOS),windows) |
| 20 | bat = .bat |
| 21 | exe = .exe |
| 22 | endif |
| 23 | |
| 24 | ifeq ($(GOOS),darwin) |
| 25 | MACOS_SDK_VERSION = $(shell xcrun --show-sdk-version | cut -d . -f 1) |
| 26 | |
| 27 | |
| 28 | ifeq ($(MACOS_SDK_VERSION),) |
| 29 | MACOS_SDK_VERSION = $(shell readlink /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk | sed -E -e "s/^MacOSX//" -e "s/\.[0-9]+\.sdk//") |
| 30 | endif |
| 31 | endif |
| 32 | |
| 33 | DEFAULT_ADDITIONAL_DRIVERS := |
| 34 | ifeq ($(GOOS),darwin) |
| 35 | ifeq ($(GOARCH),arm64) |
| 36 | ifeq ($(shell test $(MACOS_SDK_VERSION) -ge 14; echo $$?),0) |
| 37 | |
| 38 | DEFAULT_ADDITIONAL_DRIVERS += krunkit |
| 39 | endif |
| 40 | endif |
| 41 | endif |
| 42 | ADDITIONAL_DRIVERS ?= $(DEFAULT_ADDITIONAL_DRIVERS) |
| 43 | |
| 44 | GO_BUILDTAGS ?= |
| 45 | ifeq ($(GOOS),darwin) |
| 46 | ifeq ($(shell test $(MACOS_SDK_VERSION) -lt 13; echo $$?),0) |
| 47 | |
| 48 | GO_BUILDTAGS += no_vz |
| 49 | endif |
| 50 | endif |
| 51 | |
| 52 | ifeq ($(GOHOSTOS),windows) |
| 53 | WINVER_MAJOR=$(shell powershell.exe "[System.Environment]::OSVersion.Version.Major") |
| 54 | ifeq ($(WINVER_MAJOR),10) |
| 55 | WINVER_BUILD=$(shell powershell.exe "[System.Environment]::OSVersion.Version.Build") |
| 56 | WINVER_BUILD_HIGH_ENOUGH=$(shell powershell.exe $(WINVER_BUILD) -ge 19041) |
| 57 | ifeq ($(WINVER_BUILD_HIGH_ENOUGH),False) |
| 58 | GO_BUILDTAGS += no_wsl |
| 59 | endif |
| 60 | endif |
| 61 | endif |
| 62 | |
| 63 | PACKAGE := github.com/lima-vm/lima/v2 |
| 64 | |
| 65 | VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags 2>/dev/null) |
| 66 | VERSION_TRIMMED := $(VERSION:v%=%) |
| 67 | |
| 68 | ifeq ($(VERSION),) |
| 69 | $(error VERSION could not be determined. Build from a git repo or run: make VERSION=vX.Y.Z) |
| 70 | endif |
| 71 | |
| 72 | |
| 73 | |
| 74 | DEBUG ?= |
| 75 | GO_BUILD_GCFLAGS ?= |
| 76 | KEEP_DWARF ?= |
| 77 | KEEP_SYMBOLS ?= |
| 78 | ifeq ($(DEBUG),1) |
| 79 | |
| 80 | GO_BUILD_GCFLAGS = -gcflags="all=-N -l" |
| 81 | |
| 82 | KEEP_DWARF = 1 |
| 83 | |
| 84 | KEEP_SYMBOLS = 1 |
| 85 | endif |
| 86 | |
| 87 | GO_BUILD_LDFLAGS_W := true |
| 88 | ifeq ($(KEEP_DWARF),1) |
| 89 | GO_BUILD_LDFLAGS_W = false |
| 90 | endif |
| 91 | |
| 92 | GO_BUILD_LDFLAGS_S := true |
| 93 | ifeq ($(KEEP_SYMBOLS),1) |
| 94 | GO_BUILD_LDFLAGS_S = false |
| 95 | endif |
| 96 | |
| 97 | |
| 98 | |
| 99 | GO_BUILD_LDFLAGS := -ldflags="-s=$(GO_BUILD_LDFLAGS_S) -w=$(GO_BUILD_LDFLAGS_W) -X $(PACKAGE)/pkg/version.Version=$(VERSION)" |
| 100 | |
| 101 | |
| 102 | GO_BUILD_FLAG_TAGS := $(addprefix -tags=,$(shell echo "$(GO_BUILDTAGS)"|tr " " "\n"|paste -sd "," -)) |
| 103 | GO_BUILD := $(strip $(GO) build $(GO_BUILD_GCFLAGS) $(GO_BUILD_LDFLAGS) $(GO_BUILD_FLAG_TAGS)) |
| 104 | |
| 105 | |
| 106 | |
| 107 | .NOTPARALLEL: |
| 108 | .SECONDEXPANSION: |
| 109 | |
| 110 | |
| 111 | .PHONY: all |
| 112 | all: binaries manpages |
| 113 | |
| 114 | |
| 115 | |
| 116 | .PHONY: help |
| 117 | help: |
| 118 | @echo ' binaries - Build all binaries' |
| 119 | @echo ' manpages - Build manual pages' |
| 120 | @echo |
| 121 | @echo ' help-variables - Show Makefile variables' |
| 122 | @echo ' help-targets - Show additional Makefile targets' |
| 123 | |
| 124 | .PHONY: help-variables |
| 125 | help-variables: |
| 126 | @echo ' |
| 127 | @echo |
| 128 | @echo '- PREFIX (directory) : Installation prefix (default: /usr/local)' |
| 129 | @echo '- KEEP_DWARF (1 or 0) : Whether to keep DWARF information (default: 0)' |
| 130 | @echo '- KEEP_SYMBOLS (1 or 0) : Whether to keep symbols (default: 0)' |
| 131 | @echo '- DEBUG (1 or 0) : Whether to build with debug information (default: 0)' |
| 132 | |
| 133 | .PHONY: help-targets |
| 134 | help-targets: |
| 135 | @echo ' |
| 136 | @echo |
| 137 | @echo 'Targets for files in _output/bin/:' |
| 138 | @echo '- limactl : Build limactl, and lima' |
| 139 | @echo '- lima : Copy lima, and lima.bat' |
| 140 | @echo '- helpers : Copy nerdctl.lima, apptainer.lima, docker.lima, podman.lima, and kubectl.lima' |
| 141 | @echo |
| 142 | @echo 'Targets for files in _output/libexec/lima/:' |
| 143 | @echo '- limactl-plugins : Build limactl-* CLI plugins' |
| 144 | @echo '- lima-privileged-net : Build the privileged network helper (Linux only)' |
| 145 | @echo |
| 146 | @echo 'Targets for files in _output/share/lima/:' |
| 147 | @echo '- guestagents : Build guestagents' |
| 148 | @echo '- native-guestagent : Build guestagent for native arch' |
| 149 | @echo '- additional-guestagents : Build guestagents for archs other than native arch' |
| 150 | @echo '- <arch>-guestagent : Build guestagent for <arch>: $(sort $(LINUX_GUESTAGENT_ARCHS))' |
| 151 | @echo |
| 152 | @echo 'Targets for files in _output/share/lima/templates/:' |
| 153 | @echo '- templates : Copy templates' |
| 154 | @echo '- template_experimentals : Copy experimental templates to experimental/' |
| 155 | @echo '- default_template : Copy default.yaml template' |
| 156 | @echo '- update-templates : Update templates' |
| 157 | @echo |
| 158 | @echo 'Targets for files in _output/share/doc/lima:' |
| 159 | @echo '- documentation : Copy documentation to _output/share/doc/lima' |
| 160 | @echo '- create-links-in-doc-dir : Create some symlinks pointing ../../lima/templates' |
| 161 | @echo |
| 162 | @echo ' |
| 163 | @echo ' |
| 164 | |
| 165 | .PHONY: help-artifact |
| 166 | help-artifact: |
| 167 | @echo ' |
| 168 | @echo |
| 169 | @echo 'Targets to building multiple archs artifacts for GOOS:' |
| 170 | @echo '- artifacts : Build artifacts for current OS and supported archs' |
| 171 | @echo '- artifacts-<GOOS> : Build artifacts for supported archs and <GOOS>: darwin, linux, or windows' |
| 172 | @echo |
| 173 | @echo 'Targets to building GOOS and ARCH (GOARCH, or uname -m) specific artifacts:' |
| 174 | @echo '- artifact : Build artifacts for current GOOS and GOARCH' |
| 175 | @echo '- artifact-<GOOS> : Build artifacts for current GOARCH and <GOOS>: darwin, linux, or windows' |
| 176 | @echo '- artifact-<ARCH> : Build artifacts for current GOOS with <ARCH>: amd64, arm64, x86_64, or aarch64' |
| 177 | @echo '- artifact-<GOOS>-<ARCH> : Build artifacts for <GOOS> and <ARCH>' |
| 178 | @echo |
| 179 | @echo ' |
| 180 | @echo ' |
| 181 | @echo ' |
| 182 | @echo |
| 183 | @echo 'Targets for miscellaneous artifacts:' |
| 184 | @echo '- artifacts-jsonschema : Build artifacts for schema-limayaml.json' |
| 185 | @echo '- artifacts-misc : Build artifacts for go.mod, go.sum, and vendor' |
| 186 | |
| 187 | |
| 188 | |
| 189 | exe: _output/bin/limactl$(exe) |
| 190 | |
| 191 | .PHONY: minimal native |
| 192 | minimal: clean limactl native-guestagent default_template |
| 193 | native: clean limactl limactl-plugins lima-privileged-net helpers native-guestagent templates template_experimentals additional-drivers |
| 194 | |
| 195 | |
| 196 | |
| 197 | CONFIG_GUESTAGENT_OS_LINUX=y |
| 198 | CONFIG_GUESTAGENT_OS_DARWIN= |
| 199 | ifeq ($(GOOS),darwin) |
| 200 | ifeq ($(GOARCH),arm64) |
| 201 | CONFIG_GUESTAGENT_OS_DARWIN=y |
| 202 | endif |
| 203 | endif |
| 204 | CONFIG_GUESTAGENT_ARCH_X8664=y |
| 205 | CONFIG_GUESTAGENT_ARCH_AARCH64=y |
| 206 | CONFIG_GUESTAGENT_ARCH_ARMV7L=y |
| 207 | CONFIG_GUESTAGENT_ARCH_PPC64LE=y |
| 208 | CONFIG_GUESTAGENT_ARCH_RISCV64=y |
| 209 | CONFIG_GUESTAGENT_ARCH_S390X=y |
| 210 | CONFIG_GUESTAGENT_COMPRESS=y |
| 211 | |
| 212 | |
| 213 | .PHONY: binaries |
| 214 | binaries: limactl helpers limactl-plugins lima-privileged-net guestagents \ |
| 215 | templates template_experimentals \ |
| 216 | documentation create-links-in-doc-dir |
| 217 | |
| 218 | |
| 219 | |
| 220 | .PHONY: limactl lima helpers |
| 221 | limactl: _output/bin/limactl$(exe) lima |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | find_files_excluding_dir_and_test = $(shell find $(1) ! -type d ! -name '*_test.go') |
| 227 | FILES_IN_PKG = $(call find_files_excluding_dir_and_test, ./pkg) |
| 228 | |
| 229 | |
| 230 | dependencies_for_cmd = go.mod $(call find_files_excluding_dir_and_test, ./cmd/$(1)) $(FILES_IN_PKG) |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | extract_build_vars = $(shell \ |
| 240 | ($(GO) version -m $(1) 2>&- || echo $(1):) | \ |
| 241 | awk 'FNR==1{print "GOVERSION="$$2}$$2~/^(CGO|GO|-gcflags|-ldflags|-tags).*=.+$$/{sub("^.*"$$2,$$2); print $$0}' \ |
| 242 | ) |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | keys_in_build_vars = $(filter-out -%,$(shell for i in $(1); do echo $${i%%=*}; done)) |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | go_build_vars = $(shell \ |
| 253 | $(ENVS_$(1)) $(GO) env $(2) | \ |
| 254 | awk '/ /{print "\""$$0"\""; next}{print}' | \ |
| 255 | for k in $(2); do read -r v && echo "$$k=$${v}"; done \ |
| 256 | ) $(GO_BUILD_GCFLAGS) $(GO_BUILD_LDFLAGS) $(GO_BUILD_FLAG_TAGS) |
| 257 | |
| 258 | |
| 259 | diff = $(filter-out $(2),$(1))$(filter-out $(1),$(2)) |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | compare_build_vars = $(call diff,$(call go_build_vars,$(1),$(call keys_in_build_vars,$(2))),$(2)) |
| 265 | |
| 266 | |
| 267 | |
| 268 | force_build = $(if $(call compare_build_vars,$(1),$(call extract_build_vars,$(1))),force,) |
| 269 | |
| 270 | |
| 271 | |
| 272 | gunzip_if_exists = $(shell f=$(1); f=$${f%.gz}; test -f "$${f}.gz" && (set -x; gunzip -f "$${f}.gz") ; echo "$${f}") |
| 273 | |
| 274 | |
| 275 | |
| 276 | force_build_with_gunzip = $(call force_build,$(call gunzip_if_exists,$(1))) |
| 277 | |
| 278 | force: # placeholder for force build |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | LIMACTL_DEPS = $(call dependencies_for_cmd,limactl) |
| 285 | ifeq ($(GOOS),darwin) |
| 286 | LIMACTL_DEPS += vz.entitlements |
| 287 | endif |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | ENVS__output/bin/limactl$(exe) = CGO_ENABLED=1 GOOS="$(GOOS)" GOARCH="$(GOARCH)" CC="$(CC)" |
| 294 | |
| 295 | LIMACTL_DRIVER_TAGS := |
| 296 | ifneq (,$(findstring vz,$(ADDITIONAL_DRIVERS))) |
| 297 | LIMACTL_DRIVER_TAGS += external_vz |
| 298 | endif |
| 299 | ifneq (,$(findstring qemu,$(ADDITIONAL_DRIVERS))) |
| 300 | LIMACTL_DRIVER_TAGS += external_qemu |
| 301 | endif |
| 302 | ifneq (,$(findstring wsl2,$(ADDITIONAL_DRIVERS))) |
| 303 | LIMACTL_DRIVER_TAGS += external_wsl2 |
| 304 | endif |
| 305 | |
| 306 | GO_BUILDTAGS ?= |
| 307 | GO_BUILDTAGS_LIMACTL := $(strip $(GO_BUILDTAGS) $(LIMACTL_DRIVER_TAGS)) |
| 308 | |
| 309 | _output/bin/limactl$(exe): $(LIMACTL_DEPS) $$(call force_build,$$@) |
| 310 | ifneq ($(GOOS),windows) |
| 311 | @rm -rf _output/bin/limactl.exe |
| 312 | else |
| 313 | @rm -rf _output/bin/limactl |
| 314 | endif |
| 315 | $(ENVS_$@) $(GO_BUILD) -tags '$(GO_BUILDTAGS_LIMACTL)' -o $@ ./cmd/limactl |
| 316 | ifeq ($(GOOS),darwin) |
| 317 | codesign -f -v --entitlements vz.entitlements -s - $@ |
| 318 | endif |
| 319 | |
| 320 | LIBEXEC_LIMA := _output/libexec/lima |
| 321 | |
| 322 | |
| 323 | LIBEXEC_LIMA_PRIVILEGED := $(LIBEXEC_LIMA)/privileged |
| 324 | |
| 325 | limactl-plugins: $(LIBEXEC_LIMA)/limactl-mcp$(exe) $(LIBEXEC_LIMA)/limactl-url-fedora-rawhide |
| 326 | |
| 327 | $(LIBEXEC_LIMA)/limactl-mcp$(exe): $(call dependencies_for_cmd,limactl-mcp) $$(call force_build,$$@) |
| 328 | @mkdir -p $(LIBEXEC_LIMA) |
| 329 | $(ENVS_$@) $(GO_BUILD) -o $@ ./cmd/limactl-mcp |
| 330 | |
| 331 | |
| 332 | |
| 333 | .PHONY: lima-privileged-net |
| 334 | ifeq ($(GOOS),linux) |
| 335 | lima-privileged-net: $(LIBEXEC_LIMA_PRIVILEGED)/lima-privileged-net |
| 336 | else |
| 337 | lima-privileged-net: |
| 338 | endif |
| 339 | |
| 340 | $(LIBEXEC_LIMA_PRIVILEGED)/lima-privileged-net: $(call dependencies_for_cmd,lima-privileged-net) $$(call force_build,$$@) |
| 341 | @mkdir -p $(LIBEXEC_LIMA_PRIVILEGED) |
| 342 | $(ENVS_$@) $(GO_BUILD) -o $@ ./cmd/lima-privileged-net |
| 343 | |
| 344 | $(LIBEXEC_LIMA)/limactl-url-fedora-rawhide: cmd/limactl-url-fedora-rawhide |
| 345 | cp -aL $< $@ |
| 346 | |
| 347 | .PHONY: additional-drivers |
| 348 | additional-drivers: |
| 349 | @mkdir -p $(LIBEXEC_LIMA) |
| 350 | @for drv in $(ADDITIONAL_DRIVERS); do \ |
| 351 | echo "Building $$drv as external"; \ |
| 352 | if [ "$(GOOS)" = "windows" ]; then \ |
| 353 | $(GO_BUILD) -o $(LIBEXEC_LIMA)/lima-driver-$$drv.exe ./cmd/lima-driver-$$drv || exit 1; \ |
| 354 | else \ |
| 355 | $(GO_BUILD) -o $(LIBEXEC_LIMA)/lima-driver-$$drv ./cmd/lima-driver-$$drv || exit 1; \ |
| 356 | fi; \ |
| 357 | if [ "$$drv" = "vz" ] && [ "$(GOOS)" = "darwin" ]; then \ |
| 358 | codesign -f -v --entitlements vz.entitlements -s - $(LIBEXEC_LIMA)/lima-driver-vz; \ |
| 359 | fi; \ |
| 360 | done |
| 361 | |
| 362 | LIMA_CMDS = $(sort lima lima$(bat)) |
| 363 | LIMA_DEPS = $(addprefix _output/bin/,$(LIMA_CMDS)) |
| 364 | lima: $(LIMA_DEPS) |
| 365 | |
| 366 | HELPER_CMDS = nerdctl.lima apptainer.lima docker.lima podman.lima kubectl.lima |
| 367 | HELPERS_DEPS = $(addprefix _output/bin/,$(HELPER_CMDS)) |
| 368 | helpers: $(HELPERS_DEPS) |
| 369 | |
| 370 | _output/bin/%: ./cmd/% | _output/bin |
| 371 | cp -a $< $@ |
| 372 | |
| 373 | MKDIR_TARGETS += _output/bin |
| 374 | |
| 375 | |
| 376 | |
| 377 | LINUX_GUESTAGENT_PATH_COMMON = _output/share/lima/lima-guestagent.Linux- |
| 378 | DARWIN_GUESTAGENT_PATH_COMMON = _output/share/lima/lima-guestagent.Darwin- |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | LINUX_GUESTAGENT_ARCHS = aarch64 armv7l ppc64le riscv64 s390x x86_64 |
| 384 | DARWIN_GUESTAGENT_ARCHS = aarch64 |
| 385 | |
| 386 | ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y) |
| 387 | ALL_GUESTAGENTS_NOT_COMPRESSED += $(addprefix $(LINUX_GUESTAGENT_PATH_COMMON),$(LINUX_GUESTAGENT_ARCHS)) |
| 388 | endif |
| 389 | ifeq ($(CONFIG_GUESTAGENT_OS_DARWIN),y) |
| 390 | ALL_GUESTAGENTS_NOT_COMPRESSED += $(addprefix $(DARWIN_GUESTAGENT_PATH_COMMON),$(DARWIN_GUESTAGENT_ARCHS)) |
| 391 | endif |
| 392 | ifeq ($(CONFIG_GUESTAGENT_COMPRESS),y) |
| 393 | gz=.gz |
| 394 | endif |
| 395 | |
| 396 | ALL_GUESTAGENTS = $(addsuffix $(gz),$(ALL_GUESTAGENTS_NOT_COMPRESSED)) |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | guestagent_path = $(foreach arch,$(2),$($(1)_GUESTAGENT_PATH_COMMON)$(arch)$(gz)) |
| 402 | |
| 403 | ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y) |
| 404 | NATIVE_GUESTAGENT_ARCH = $(shell echo $(GOARCH) | sed -e s/arm64/aarch64/ -e s/arm/armv7l/ -e s/amd64/x86_64/) |
| 405 | NATIVE_GUESTAGENT = $(call guestagent_path,LINUX,$(NATIVE_GUESTAGENT_ARCH)) |
| 406 | ADDITIONAL_GUESTAGENT_ARCHS = $(filter-out $(NATIVE_GUESTAGENT_ARCH),$(LINUX_GUESTAGENT_ARCHS)) |
| 407 | ADDITIONAL_GUESTAGENTS = $(call guestagent_path,LINUX,$(ADDITIONAL_GUESTAGENT_ARCHS)) |
| 408 | endif |
| 409 | ifeq ($(CONFIG_GUESTAGENT_OS_DARWIN),y) |
| 410 | ifeq ($(GOARCH),arm64) |
| 411 | NATIVE_GUESTAGENT_ARCH = aarch64 |
| 412 | NATIVE_GUESTAGENT += $(call guestagent_path,DARWIN,$(NATIVE_GUESTAGENT_ARCH)) |
| 413 | endif |
| 414 | endif |
| 415 | |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | config_guestagent_arch = $(filter y,$(CONFIG_GUESTAGENT_ARCH_$(shell echo $(1)|tr -d _|tr a-z A-Z))) |
| 421 | |
| 422 | |
| 423 | |
| 424 | guestagent_path_enabled_by_config = $(if $(call config_guestagent_arch,$(2)),$(call guestagent_path,$(1),$(2))) |
| 425 | |
| 426 | ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y) |
| 427 | |
| 428 | GUESTAGENTS += $(foreach arch,$(LINUX_GUESTAGENT_ARCHS),$(call guestagent_path_enabled_by_config,LINUX,$(arch))) |
| 429 | endif |
| 430 | ifeq ($(CONFIG_GUESTAGENT_OS_DARWIN),y) |
| 431 | GUESTAGENTS += $(call guestagent_path,DARWIN,aarch64) |
| 432 | endif |
| 433 | |
| 434 | .PHONY: guestagents native-guestagent additional-guestagents |
| 435 | guestagents: $(GUESTAGENTS) |
| 436 | native-guestagent: $(NATIVE_GUESTAGENT) |
| 437 | additional-guestagents: $(ADDITIONAL_GUESTAGENTS) |
| 438 | %-guestagent: |
| 439 | @[ "$(findstring $(*),$(LINUX_GUESTAGENT_ARCHS))" == "$(*)" ] && make $(call guestagent_path,LINUX,$*) |
| 440 | @[ "$(findstring $(*),$(DARWIN_GUESTAGENT_ARCHS))" == "$(*)" ] && make $(call guestagent_path,DARWIN,$*) |
| 441 | |
| 442 | |
| 443 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)aarch64 = CGO_ENABLED=0 GOOS=linux GOARCH=arm64 |
| 444 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)armv7l = CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 |
| 445 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)ppc64le = CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le |
| 446 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)riscv64 = CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 |
| 447 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)s390x = CGO_ENABLED=0 GOOS=linux GOARCH=s390x |
| 448 | ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)x86_64 = CGO_ENABLED=0 GOOS=linux GOARCH=amd64 |
| 449 | ENVS_$(DARWIN_GUESTAGENT_PATH_COMMON)aarch64 = CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 |
| 450 | $(ALL_GUESTAGENTS_NOT_COMPRESSED): $(call dependencies_for_cmd,lima-guestagent) $$(call force_build_with_gunzip,$$@) | _output/share/lima |
| 451 | $(ENVS_$@) $(GO_BUILD) -o $@ ./cmd/lima-guestagent |
| 452 | chmod 644 $@ |
| 453 | $(LINUX_GUESTAGENT_PATH_COMMON)%.gz: $(LINUX_GUESTAGENT_PATH_COMMON)% $$(call force_build_with_gunzip,$$@) |
| 454 | @set -x; gzip -n $< |
| 455 | $(DARWIN_GUESTAGENT_PATH_COMMON)%.gz: $(DARWIN_GUESTAGENT_PATH_COMMON)% $$(call force_build_with_gunzip,$$@) |
| 456 | @set -x; gzip -n $< |
| 457 | |
| 458 | MKDIR_TARGETS += _output/share/lima |
| 459 | |
| 460 | |
| 461 | |
| 462 | TEMPLATES = $(addprefix _output/share/lima/templates/,$(filter-out experimental,$(notdir $(wildcard templates/*)))) |
| 463 | TEMPLATE_DEFAULTS = ${addprefix _output/share/lima/templates/_default/,$(notdir $(wildcard templates/_default/*))} |
| 464 | TEMPLATE_IMAGES = $(addprefix _output/share/lima/templates/_images/,$(notdir $(wildcard templates/_images/*))) |
| 465 | TEMPLATE_EXPERIMENTALS = $(addprefix _output/share/lima/templates/experimental/,$(notdir $(wildcard templates/experimental/*))) |
| 466 | |
| 467 | .PHONY: default_template templates template_experimentals |
| 468 | default_template: _output/share/lima/templates/default.yaml |
| 469 | templates: $(TEMPLATES) $(TEMPLATE_DEFAULTS) $(TEMPLATE_IMAGES) |
| 470 | template_experimentals: $(TEMPLATE_EXPERIMENTALS) |
| 471 | |
| 472 | $(TEMPLATES): | _output/share/lima/templates |
| 473 | $(TEMPLATE_DEFAULTS): | _output/share/lima/templates/_default |
| 474 | $(TEMPLATE_IMAGES): | _output/share/lima/templates/_images |
| 475 | $(TEMPLATE_EXPERIMENTALS): | _output/share/lima/templates/experimental |
| 476 | MKDIR_TARGETS += _output/share/lima/templates _output/share/lima/templates/_default _output/share/lima/templates/_images _output/share/lima/templates/experimental |
| 477 | |
| 478 | _output/share/lima/templates/%: templates/% |
| 479 | cp -aL $< $@ |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | force_link = $(if $(filter windows,$(GOOS)),force,$(shell test ! -L $(1) && echo force)) |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | TEMPLATES_TO_BE_UPDATED = $(filter-out $(wildcard templates/_images/fedora*.yaml),$(wildcard templates/_images/*.yaml)) |
| 491 | |
| 492 | .PHONY: update-templates |
| 493 | update-templates: $(TEMPLATES_TO_BE_UPDATED) |
| 494 | ./hack/update-template.sh $^ |
| 495 | |
| 496 | |
| 497 | |
| 498 | DOCUMENTATION = $(addprefix _output/share/doc/lima/,$(wildcard *.md) LICENSE SECURITY.md VERSION) |
| 499 | |
| 500 | .PHONY: documentation |
| 501 | documentation: $(DOCUMENTATION) |
| 502 | |
| 503 | _output/share/doc/lima/SECURITY.md: | _output/share/doc/lima |
| 504 | echo "Moved to https://github.com/lima-vm/.github/blob/main/SECURITY.md" > $@ |
| 505 | |
| 506 | _output/share/doc/lima/VERSION: | _output/share/doc/lima |
| 507 | echo $(VERSION) > $@ |
| 508 | |
| 509 | _output/share/doc/lima/%: % | _output/share/doc/lima |
| 510 | cp -aL $< $@ |
| 511 | |
| 512 | MKDIR_TARGETS += _output/share/doc/lima |
| 513 | |
| 514 | .PHONY: create-links-in-doc-dir |
| 515 | create-links-in-doc-dir: _output/share/doc/lima/templates |
| 516 | _output/share/doc/lima/templates: _output/share/lima/templates $$(call force_link,$$@) |
| 517 | |
| 518 | rm -rf $@ |
| 519 | ifneq ($(GOOS),windows) |
| 520 | ln -sf ../../lima/templates $@ |
| 521 | else |
| 522 | |
| 523 | cp -aL $< $@ |
| 524 | endif |
| 525 | |
| 526 | |
| 527 | |
| 528 | cross_compiling = $(call diff,$(GOOS) $(GOARCH),$(GOHOSTOS) $(GOHOSTARCH)) |
| 529 | |
| 530 | native_compiling = $(if $(cross_compiling),,true) |
| 531 | |
| 532 | |
| 533 | |
| 534 | .PHONY: manpages |
| 535 | |
| 536 | |
| 537 | |
| 538 | manpages: _output/share/man/man1/limactl.1 |
| 539 | _output/share/man/man1/limactl.1: _output/bin/limactl$(exe) |
| 540 | @mkdir -p _output/share/man/man1 |
| 541 | ifeq ($(native_compiling),true) |
| 542 | |
| 543 | $< generate-doc _output/share/man/man1 \ |
| 544 | --output _output --prefix $(PREFIX) |
| 545 | endif |
| 546 | |
| 547 | |
| 548 | .PHONY: docsy |
| 549 | |
| 550 | |
| 551 | |
| 552 | docsy: website/_output/docsy/limactl.md website/_output/docsy-mcp/mcp.md |
| 553 | website/_output/docsy/limactl.md: _output/bin/limactl$(exe) |
| 554 | @mkdir -p website/_output/docsy |
| 555 | ifeq ($(native_compiling),true) |
| 556 | |
| 557 | $< generate-doc --type docsy website/_output/docsy \ |
| 558 | --output _output --prefix $(PREFIX) |
| 559 | endif |
| 560 | website/_output/docsy-mcp/mcp.md: _output/libexec/lima/limactl-mcp$(exe) |
| 561 | @mkdir -p website/_output/docsy-mcp |
| 562 | ifeq ($(native_compiling),true) |
| 563 | $< generate-doc website/_output/docsy-mcp |
| 564 | endif |
| 565 | |
| 566 | |
| 567 | default-template.yaml: _output/bin/limactl$(exe) templates/default.yaml \ |
| 568 | _output/share/lima/templates/_images/ubuntu.yaml \ |
| 569 | _output/share/lima/templates/_default/mounts.yaml |
| 570 | ifeq ($(native_compiling),true) |
| 571 | $< tmpl copy --embed-all templates/default.yaml $@ |
| 572 | endif |
| 573 | |
| 574 | schema-limayaml.json: _output/bin/limactl$(exe) templates/default.yaml default-template.yaml |
| 575 | ifeq ($(native_compiling),true) |
| 576 | |
| 577 | $< generate-jsonschema --schemafile $@ templates/default.yaml default-template.yaml |
| 578 | endif |
| 579 | |
| 580 | .PHONY: check-jsonschema |
| 581 | check-jsonschema: schema-limayaml.json templates/default.yaml default-template.yaml |
| 582 | check-jsonschema --schemafile schema-limayaml.json templates/default.yaml default-template.yaml |
| 583 | |
| 584 | |
| 585 | .PHONY: diagrams |
| 586 | diagrams: docs/lima-sequence-diagram.png |
| 587 | docs/lima-sequence-diagram.png: docs/images/lima-sequence-diagram.puml |
| 588 | $(PLANTUML) ./docs/images/lima-sequence-diagram.puml |
| 589 | |
| 590 | |
| 591 | .PHONY: install |
| 592 | install: uninstall |
| 593 | mkdir -p "$(DEST)" |
| 594 | |
| 595 | ( cd _output && $(TAR) c * | $(TAR) -xv --no-same-owner -C "$(DEST)" ) |
| 596 | if [ "$(shell uname -s )" != "Linux" -a ! -e "$(DEST)/bin/nerdctl" ]; then ln -sf nerdctl.lima "$(DEST)/bin/nerdctl"; fi |
| 597 | if [ "$(shell uname -s )" != "Linux" -a ! -e "$(DEST)/bin/apptainer" ]; then ln -sf apptainer.lima "$(DEST)/bin/apptainer"; fi |
| 598 | |
| 599 | .PHONY: uninstall |
| 600 | uninstall: |
| 601 | @test -f "$(DEST)/bin/lima" || echo "lima not found in $(DEST) prefix" |
| 602 | rm -rf \ |
| 603 | "$(DEST)/bin/lima" \ |
| 604 | "$(DEST)/bin/lima$(bat)" \ |
| 605 | "$(DEST)/bin/limactl$(exe)" \ |
| 606 | "$(DEST)/bin/nerdctl.lima" \ |
| 607 | "$(DEST)/bin/apptainer.lima" \ |
| 608 | "$(DEST)/bin/docker.lima" \ |
| 609 | "$(DEST)/bin/podman.lima" \ |
| 610 | "$(DEST)/bin/kubectl.lima" \ |
| 611 | "$(DEST)/share/man/man1/lima.1" \ |
| 612 | "$(DEST)/share/man/man1/limactl"*".1" \ |
| 613 | "$(DEST)/share/lima" \ |
| 614 | "$(DEST)/share/doc/lima" \ |
| 615 | "$(DEST)/libexec/lima/limactl-mcp$(exe)" \ |
| 616 | "$(DEST)/libexec/lima/limactl-url-fedora-rawhide" \ |
| 617 | "$(DEST)/libexec/lima/lima-driver-qemu$(exe)" \ |
| 618 | "$(DEST)/libexec/lima/lima-driver-vz$(exe)" \ |
| 619 | "$(DEST)/libexec/lima/lima-driver-wsl2$(exe)" \ |
| 620 | "$(DEST)/libexec/lima/lima-driver-krunkit$(exe)" \ |
| 621 | "$(DEST)/libexec/lima/privileged/lima-privileged-net" |
| 622 | if [ "$$(readlink "$(DEST)/bin/nerdctl")" = "nerdctl.lima" ]; then rm "$(DEST)/bin/nerdctl"; fi |
| 623 | if [ "$$(readlink "$(DEST)/bin/apptainer")" = "apptainer.lima" ]; then rm "$(DEST)/bin/apptainer"; fi |
| 624 | |
| 625 | .PHONY: check-generated |
| 626 | check-generated: |
| 627 | git diff --exit-code || \ |
| 628 | (echo "Please run 'make generate' when making changes to proto files and check-in the generated file changes" && false) |
| 629 | |
| 630 | .PHONY: bats |
| 631 | bats: native limactl-plugins |
| 632 | PATH=$$PWD/_output/bin:$$PATH ./hack/bats/lib/bats-core/bin/bats --timing ./hack/bats/tests |
| 633 | |
| 634 | |
| 635 | .PHONY: nobin |
| 636 | nobin: |
| 637 | $(GO) run -modfile=./hack/tools/go.mod github.com/jandubois/nobin --allow-emoji --allow-escape --gitignore --skip-ext pb.desc --skip 'website/static/images/**/*.{gif,png}' --skip 'docs/reports/**/*.pdf' |
| 638 | |
| 639 | .PHONY: editorconfig-checker |
| 640 | editorconfig-checker: |
| 641 | $(GO) run -modfile=./hack/tools/go.mod github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker |
| 642 | |
| 643 | .PHONY: golangci-lint |
| 644 | golangci-lint: |
| 645 | $(GO) run -modfile=./hack/tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint run ./... |
| 646 | |
| 647 | .PHONY: yamllint |
| 648 | yamllint: |
| 649 | yamllint . |
| 650 | |
| 651 | .PHONY: ls-lint |
| 652 | ls-lint: |
| 653 | ls-lint |
| 654 | |
| 655 | .PHONY: shellcheck |
| 656 | shellcheck: |
| 657 | find . -name '*.sh' ! -path "./.git/*" | xargs shellcheck |
| 658 | |
| 659 | .PHONY: shfmt |
| 660 | shfmt: |
| 661 | find . -name '*.sh' ! -path "./.git/*" | xargs $(GO) run -modfile=./hack/tools/go.mod mvdan.cc/sh/v3/cmd/shfmt -s -d |
| 662 | |
| 663 | CYCLONEDX_GOMOD = $(GO) run -modfile=./hack/tools/go.mod github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod |
| 664 | CYCLONEDX_GOMOD_FLAGS = -licenses -short-purls |
| 665 | |
| 666 | .PHONY: sbom |
| 667 | sbom: sbom-mod sbom-app |
| 668 | |
| 669 | .PHONY: sbom-mod |
| 670 | sbom-mod: |
| 671 | rm -rf vendor |
| 672 | GOOS="$(GOHOSTOS)" GOARCH="$(GOHOSTARCH)" GOFLAGS="" \ |
| 673 | $(CYCLONEDX_GOMOD) mod $(CYCLONEDX_GOMOD_FLAGS) -json -output bom.json -type library |
| 674 | |
| 675 | SBOM_OS = $(call capitalize,$(GOOS)) |
| 676 | SBOM_ARCH = $(call to_uname_m,$(GOARCH)) |
| 677 | |
| 678 | .PHONY: sbom-app |
| 679 | sbom-app: |
| 680 | ifeq ($(native_compiling),true) |
| 681 | rm -rf vendor |
| 682 | $(CYCLONEDX_GOMOD) app $(CYCLONEDX_GOMOD_FLAGS) -json -output limactl.$(SBOM_OS)-$(SBOM_ARCH).bom.json -main cmd/limactl |
| 683 | $(CYCLONEDX_GOMOD) app $(CYCLONEDX_GOMOD_FLAGS) -json -output limactl-mcp.$(SBOM_OS)-$(SBOM_ARCH).bom.json -main cmd/limactl-mcp |
| 684 | $(CYCLONEDX_GOMOD) app $(CYCLONEDX_GOMOD_FLAGS) -json -output lima-guestagent.$(SBOM_OS)-$(SBOM_ARCH).bom.json -main cmd/lima-guestagent |
| 685 | endif |
| 686 | |
| 687 | .PHONY: go-licenses |
| 688 | go-licenses: |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | go-licenses check --include_tests --ignore github.com/hashicorp/hcl/v2 --ignore github.com/segmentio/asm ./... --allowed_licenses=$$(cat ./hack/allowed-licenses.txt) |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | GOMODJAIL = $(GO) run -modfile=./hack/tools/go.mod github.com/AkihiroSuda/gomodjail/v2/cmd/gomodjail |
| 710 | |
| 711 | |
| 712 | |
| 713 | .PHONY: gomodjail |
| 714 | gomodjail: |
| 715 | ifeq ($(GOHOSTOS),windows) |
| 716 | @echo "Skipped: gomodjail does not support Windows hosts" |
| 717 | else |
| 718 | $(GOMODJAIL) analyze --goos=linux --goarch=amd64 ./... |
| 719 | $(GOMODJAIL) analyze --goos=linux --goarch=arm64 ./... |
| 720 | endif |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | .PHONY: gomodjail-fix |
| 726 | gomodjail-fix: |
| 727 | ifeq ($(GOHOSTOS),windows) |
| 728 | @echo "Skipped: gomodjail does not support Windows hosts" |
| 729 | else |
| 730 | $(GOMODJAIL) fix --goos=linux --goarch=amd64 ./... |
| 731 | $(GOMODJAIL) fix --goos=linux --goarch=arm64 ./... |
| 732 | endif |
| 733 | |
| 734 | .PHONY: gosocialcheck |
| 735 | gosocialcheck: |
| 736 | -$(GO) run -modfile=./hack/tools/go.mod github.com/AkihiroSuda/gosocialcheck/cmd/gosocialcheck run --gha=$(GITHUB_ACTIONS) ./... |
| 737 | TODO: |
| 738 | |
| 739 | .PHONY: ltag |
| 740 | ltag: |
| 741 | $(GO) run -modfile=./hack/tools/go.mod github.com/containerd/ltag -t ./hack/ltag --check --excludes "vendor _output" -v |
| 742 | |
| 743 | .PHONY: protolint |
| 744 | protolint: |
| 745 | $(GO) run -modfile=./hack/tools/go.mod github.com/yoheimuta/protolint/cmd/protolint . |
| 746 | |
| 747 | |
| 748 | .PHONY: lint |
| 749 | lint: check-generated nobin editorconfig-checker golangci-lint yamllint ls-lint shellcheck shfmt go-licenses gomodjail gosocialcheck ltag protolint |
| 750 | |
| 751 | .PHONY: clean |
| 752 | clean: |
| 753 | rm -rf _output vendor |
| 754 | |
| 755 | .PHONY: install-protoc-tools |
| 756 | install-protoc-tools: |
| 757 | go install -modfile=./hack/tools/go.mod google.golang.org/protobuf/cmd/protoc-gen-go |
| 758 | go install -modfile=./hack/tools/go.mod google.golang.org/grpc/cmd/protoc-gen-go-grpc |
| 759 | |
| 760 | .PHONY: generate |
| 761 | generate: |
| 762 | go generate ./... |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | .PHONY: artifact |
| 768 | |
| 769 | |
| 770 | capitalize = $(shell echo "$(1)"|awk '{print toupper(substr($$0,1,1)) tolower(substr($$0,2))}') |
| 771 | |
| 772 | |
| 773 | to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/x86_64/' | sed 's/arm64/aarch64/')) |
| 774 | |
| 775 | ARTIFACT_FILE_EXTENSIONS := .tar.gz |
| 776 | |
| 777 | ifeq ($(GOOS),darwin) |
| 778 | |
| 779 | to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/x86_64/')) |
| 780 | else ifeq ($(GOOS),windows) |
| 781 | |
| 782 | to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/AMD64/' | sed 's/arm64/ARM64/')) |
| 783 | |
| 784 | ARTIFACT_FILE_EXTENSIONS := .zip |
| 785 | else ifeq ($(GOOS),linux) |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | CC := $(shell \ |
| 791 | if command -v $(call to_uname_m,$(GOARCH))-redhat-linux-gcc >/dev/null 2>&1; then \ |
| 792 | echo $(call to_uname_m,$(GOARCH))-redhat-linux-gcc; \ |
| 793 | elif command -v $(call to_uname_m,$(GOARCH))-linux-gnu-gcc >/dev/null 2>&1; then \ |
| 794 | echo $(call to_uname_m,$(GOARCH))-linux-gnu-gcc; \ |
| 795 | else \ |
| 796 | echo gcc; \ |
| 797 | fi) |
| 798 | endif |
| 799 | |
| 800 | |
| 801 | ARTIFACT_OS = $(call capitalize,$(GOOS)) |
| 802 | ARTIFACT_UNAME_M = $(call to_uname_m,$(GOARCH)) |
| 803 | ARTIFACT_PATH_COMMON = _artifacts/lima-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M) |
| 804 | ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON = _artifacts/lima-additional-guestagents-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIFACT_UNAME_M) |
| 805 | |
| 806 | artifact: $(addprefix $(ARTIFACT_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS)) \ |
| 807 | $(addprefix $(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS)) |
| 808 | |
| 809 | ARTIFACT_DES = _output/bin/limactl$(exe) limactl-plugins $(LIMA_DEPS) $(HELPERS_DEPS) \ |
| 810 | $(NATIVE_GUESTAGENT) \ |
| 811 | $(TEMPLATES) $(TEMPLATE_IMAGES) $(TEMPLATE_DEFAULTS) $(TEMPLATE_EXPERIMENTALS) \ |
| 812 | additional-drivers \ |
| 813 | $(DOCUMENTATION) _output/share/doc/lima/templates \ |
| 814 | _output/share/man/man1/limactl.1 |
| 815 | |
| 816 | |
| 817 | $(ARTIFACT_PATH_COMMON).tar.gz: $(ARTIFACT_DES) | _artifacts |
| 818 | $(TAR) -C _output/ --no-xattrs -czvf $@ ./ |
| 819 | |
| 820 | $(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON).tar.gz: |
| 821 | FIXME: |
| 822 | make clean additional-guestagents |
| 823 | $(TAR) -C _output/ --no-xattrs -czvf $@ ./ |
| 824 | |
| 825 | $(ARTIFACT_PATH_COMMON).zip: $(ARTIFACT_DES) | _artifacts |
| 826 | cd _output && $(ZIP) -r ../$@ * |
| 827 | |
| 828 | $(ARTIFACT_ADDITIONAL_GUESTAGENTS_PATH_COMMON).zip: |
| 829 | make clean additional-guestagents |
| 830 | cd _output && $(ZIP) -r ../$@ * |
| 831 | |
| 832 | |
| 833 | manpages-using-native-limactl: GOOS = $(GOHOSTOS) |
| 834 | manpages-using-native-limactl: GOARCH = $(GOHOSTARCH) |
| 835 | manpages-using-native-limactl: manpages |
| 836 | |
| 837 | |
| 838 | |
| 839 | generate_manpages_if_needed = $(if $(filter $(if $(1),$(1),$(GOOS)),$(GOHOSTOS)),,manpages-using-native-limactl) |
| 840 | |
| 841 | |
| 842 | artifact_goarchs = arm64 amd64 |
| 843 | goarchs_native_and_others = $(GOHOSTARCH) $(filter-out $(GOHOSTARCH),$(artifact_goarchs)) |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | .PHONY: artifacts artifacts-darwin artifacts-linux artifacts-windows |
| 849 | artifacts: $$(addprefix artifact-$$(GOOS)-,$$(goarchs_native_and_others)) |
| 850 | artifacts-darwin: $$(call generate_manpages_if_needed,darwin) $$(addprefix artifact-darwin-,$$(goarchs_native_and_others)) |
| 851 | artifacts-linux: $$(call generate_manpages_if_needed,linux) $$(addprefix artifact-linux-,$$(goarchs_native_and_others)) |
| 852 | FIXME: |
| 853 | artifacts-windows: $$(call generate_manpages_if_needed,windows) $$(addprefix artifact-windows-,$$(goarchs_native_and_others)) |
| 854 | |
| 855 | |
| 856 | artifact-darwin% artifact-darwin: GOOS = darwin |
| 857 | artifact-linux% artifact-linux: GOOS = linux |
| 858 | artifact-windows% artifact-windows: GOOS = windows |
| 859 | artifact-%-amd64 artifact-%-x86_64 artifact-amd64 artifact-x86_64: GOARCH = amd64 |
| 860 | artifact-%-arm64 artifact-%-aarch64 artifact-arm64 artifact-aarch64: GOARCH = arm64 |
| 861 | |
| 862 | |
| 863 | artifact-%: $$(call generate_manpages_if_needed) |
| 864 | make clean artifact GOOS=$(GOOS) GOARCH=$(GOARCH) |
| 865 | |
| 866 | .PHONY: artifacts-jsonschema |
| 867 | artifacts-jsonschema: schema-limayaml.json | _artifacts |
| 868 | $(CP) $^ _artifacts/ |
| 869 | |
| 870 | .PHONY: artifacts-misc |
| 871 | artifacts-misc: sbom | _artifacts |
| 872 | go mod vendor |
| 873 | $(TAR) --no-xattrs -czf _artifacts/lima-$(VERSION_TRIMMED)-go-mod-vendor.tar.gz go.mod go.sum vendor |
| 874 | $(TAR) --no-xattrs -czf _artifacts/lima-$(VERSION_TRIMMED)-sbom.tar.gz *bom.json |
| 875 | |
| 876 | MKDIR_TARGETS += _artifacts |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | $(MKDIR_TARGETS): |
| 882 | mkdir -p $@ |