@@ -50,6 +50,7 @@ GO_BUILD_FLAG_TAGS := $(addprefix -tags=,$(shell echo "$(GO_BUILDTAGS)"|tr " " "
50
50
GO_BUILD := $(GO ) build $(GO_BUILD_LDFLAGS ) $(GO_BUILD_FLAG_TAGS )
51
51
52
52
.NOTPARALLEL :
53
+ .SECONDEXPANSION :
53
54
54
55
.PHONY : all
55
56
all : binaries manpages
@@ -177,7 +178,7 @@ endif
177
178
# environment variables for limactl. this variable is used for checking force build.
178
179
ENVS__output/bin/limactl$(exe) = CGO_ENABLED=1 $(addprefix GOOS=,$(GOOS ) ) $(addprefix GOARCH=,$(GOARCH ) )
179
180
180
- _output/bin/limactl$(exe ) : $(DEPENDENCIES_FOR_LIMACTL ) $(call force_build,_output/bin/limactl $( exe ) )
181
+ _output/bin/limactl$(exe ) : $(DEPENDENCIES_FOR_LIMACTL ) $$ (call force_build,$$@ )
181
182
# The hostagent must be compiled with CGO_ENABLED=1 so that net.LookupIP() in the DNS server
182
183
# calls the native resolver library and not the simplistic version in the Go library.
183
184
$(ENVS_$@ ) $(GO_BUILD ) -o $@ ./cmd/limactl
@@ -229,11 +230,7 @@ ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)aarch64 = GOOS=linux GOARCH=arm64 CGO_ENABLE
229
230
ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)armv7l = GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0
230
231
ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)riscv64 = GOOS=linux GOARCH=riscv64 CGO_ENABLED=0
231
232
ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)x86_64 = GOOS=linux GOARCH=amd64 CGO_ENABLED=0
232
- $(LINUX_GUESTAGENT_PATH_COMMON ) aarch64 : $(call force_build,$(LINUX_GUESTAGENT_PATH_COMMON ) aarch64)
233
- $(LINUX_GUESTAGENT_PATH_COMMON ) armv7l : $(call force_build,$(LINUX_GUESTAGENT_PATH_COMMON ) armv7l)
234
- $(LINUX_GUESTAGENT_PATH_COMMON ) riscv64 : $(call force_build,$(LINUX_GUESTAGENT_PATH_COMMON ) riscv64)
235
- $(LINUX_GUESTAGENT_PATH_COMMON ) x86_64 : $(call force_build,$(LINUX_GUESTAGENT_PATH_COMMON ) x86_64)
236
- $(LINUX_GUESTAGENT_PATH_COMMON ) % : $(call dependencis_for_cmd,lima-guestagent) | _output/share/lima
233
+ $(LINUX_GUESTAGENT_PATH_COMMON ) % : $(call dependencis_for_cmd,lima-guestagent) $$(call force_build,$$@ ) | _output/share/lima
237
234
$(ENVS_$@ ) $(GO_BUILD ) -o $@ ./cmd/lima-guestagent
238
235
chmod 644 $@
239
236
ifeq ($(CONFIG_GUESTAGENT_COMPRESS ) ,y)
@@ -376,30 +373,37 @@ install-tools:
376
373
generate :
377
374
go generate ./...
378
375
379
- .PHONY : artifacts-darwin artifact-darwin-arm64 artifact-darwin-x86_64
376
+ .PHONY : artifacts-darwin
380
377
artifacts-darwin : artifact-darwin-x86_64 artifact-darwin-arm64
381
378
artifact-darwin-arm64 : ENVS=GOOS=darwin GOARCH=arm64
382
- artifact-darwin-arm64 : _artifacts/lima-$(VERSION_TRIMMED ) -Darwin-arm64.tar.gz
383
379
artifact-darwin-x86_64 : ENVS=GOOS=darwin GOARCH=amd64
384
- artifact-darwin-x86_64 : _artifacts/lima-$(VERSION_TRIMMED ) -Darwin-x86_64.tar.gz
385
380
386
- .PHONY : artifacts-linux artifact-linux-aarch64 artifact-linux-x86_64
381
+ .PHONY : artifacts-linux
387
382
artifacts-linux : artifact-linux-x86_64 artifact-linux-aarch64
388
383
artifact-linux-aarch64 : ENVS=GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc
389
- artifact-linux-aarch64 : _artifacts/lima-$(VERSION_TRIMMED ) -Linux-aarch64.tar.gz
390
384
artifact-linux-x86_64 : ENVS=GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc
391
- artifact-linux-x86_64 : _artifacts/lima-$(VERSION_TRIMMED ) -Linux-x86_64.tar.gz
392
385
393
- .PHONY : artifacts-windows artifact-windows-x86_64
386
+ .PHONY : artifacts-windows
394
387
artifacts-windows : artifact-windows-x86_64
395
388
artifact-windows-x86_64 : ENVS=GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc
396
- artifact-windows-x86_64 : _artifacts/lima-$(VERSION_TRIMMED ) -Windows-x86_64 .tar.gz
397
- cd _output && $( ZIP ) -r ../_artifacts/lima- $( VERSION_TRIMMED ) -Windows-x86_64.zip *
389
+ artifact-windows-% : _artifacts/lima-$(VERSION_TRIMMED ) -Windows-$$* .tar.gz _artifacts/lima- $( VERSION_TRIMMED ) -Windows- $$* .zip
390
+ @true # do nothing
398
391
392
+ # returns the capitalized string of $(1).
393
+ capitalize = $(shell bash -c 'word="$(1 ) "; echo $${word^}')
394
+ artifact-% : _artifacts/lima-$(VERSION_TRIMMED ) -$$(call capitalize,$$* ) .tar.gz
395
+ @true # do nothing
396
+
397
+ # avoid removing the artifacts on completion of the targets.
398
+ .PRECIOUS : _artifacts/lima-% .tar.gz _artifacts/lima-% .zip
399
399
_artifacts/lima-% .tar.gz : | _artifacts
400
400
$(ENVS ) make clean binaries
401
401
$(TAR ) -C _output/ -czvf $@ ./
402
402
403
+ _artifacts/lima-% .zip : | _artifacts
404
+ $(ENVS ) make clean binaries
405
+ cd _output && $(ZIP ) -r ../$@ *
406
+
403
407
MKDIR_TARGETS += _artifacts
404
408
405
409
.PHONY : artifacts-misc
0 commit comments