@@ -80,10 +80,10 @@ help-targets:
80
80
@echo ' - helpers : Copy nerdctl.lima, apptainer.lima, docker.lima, podman.lima, and kubectl.lima'
81
81
@echo
82
82
@echo ' Targets for files in _output/share/lima/:'
83
- @echo ' - guestagents : Build guestagents for archs enabled by CONFIG_GUESTAGENT_ARCHS_ *'
83
+ @echo ' - guestagents : Build guestagents for archs enabled by CONFIG_GUESTAGENT_ARCH_ *'
84
84
@echo ' - native-guestagent : Build guestagent for native arch'
85
85
@echo ' - additional-guestagents : Build guestagents for archs other than native arch'
86
- @echo ' - <arch>-guestagent : Build guestagent for <arch>: $(sort $(GUESTAGENT_ARCHS ))'
86
+ @echo ' - <arch>-guestagent : Build guestagent for <arch>: $(sort $(LINUX_GUESTAGENT_ARCHS ))'
87
87
@echo
88
88
@echo ' Targets for files in _output/share/lima/templates/:'
89
89
@echo ' - templates : Copy templates'
@@ -256,27 +256,30 @@ LINUX_GUESTAGENT_PATH_COMMON = _output/share/lima/lima-guestagent.Linux-
256
256
257
257
# How to add architecture specific guestagent:
258
258
# 1. Add the architecture to GUESTAGENT_ARCHS
259
- # 2. Add ENVS_$(LINUX_GUESTAGENT_PATH_COMMON )<arch> to set GOOS, GOARCH, and other necessary environment variables
260
- GUESTAGENT_ARCHS = aarch64 armv7l riscv64 x86_64
259
+ # 2. Add ENVS_$(*_GUESTAGENT_PATH_COMMON )<arch> to set GOOS, GOARCH, and other necessary environment variables
260
+ LINUX_GUESTAGENT_ARCHS = aarch64 armv7l riscv64 x86_64
261
261
262
- ALL_GUESTAGENTS_NOT_COMPRESSED = $(addprefix $(LINUX_GUESTAGENT_PATH_COMMON ) ,$(GUESTAGENT_ARCHS ) )
262
+ ifeq ($(CONFIG_GUESTAGENT_OS_LINUX ) ,y)
263
+ ALL_GUESTAGENTS_NOT_COMPRESSED += $(addprefix $(LINUX_GUESTAGENT_PATH_COMMON ) ,$(LINUX_GUESTAGENT_ARCHS ) )
264
+ endif
263
265
ifeq ($(CONFIG_GUESTAGENT_COMPRESS ) ,y)
264
266
$(info Guestagents are unzipped each time to check the build configuration; they may be gunzipped afterward.)
265
267
gz =.gz
266
268
endif
267
269
268
270
ALL_GUESTAGENTS = $(addsuffix $(gz ) ,$(ALL_GUESTAGENTS_NOT_COMPRESSED ) )
269
271
270
- # guestagent path for the given architectures. it may has .gz extension if CONFIG_GUESTAGENT_COMPRESS is enabled.
271
- # $(1): list of architectures
272
- guestaget_path = $(foreach arch,$(1 ) ,$(LINUX_GUESTAGENT_PATH_COMMON )$(arch )$(gz ) )
273
-
274
- NATIVE_GUESTAGENT_ARCH = $(shell uname -m | sed -e s/arm64/aarch64/)
275
- NATIVE_GUESTAGENT = $(call guestaget_path,$(NATIVE_GUESTAGENT_ARCH ) )
276
- ADDITIONAL_GUESTAGENT_ARCHS = $(filter-out $(NATIVE_GUESTAGENT_ARCH ) ,$(GUESTAGENT_ARCHS ) )
277
- ADDITIONAL_GUESTAGENTS = $(call guestaget_path,$(ADDITIONAL_GUESTAGENT_ARCHS ) )
272
+ # guestagent path for the given platform. it may has .gz extension if CONFIG_GUESTAGENT_COMPRESS is enabled.
273
+ # $(1): operating system (os)
274
+ # $(2): list of architectures
275
+ guestagent_path = $(foreach arch,$(2 ) ,$($(1 ) _GUESTAGENT_PATH_COMMON)$(arch )$(gz ) )
278
276
279
277
ifeq ($(CONFIG_GUESTAGENT_OS_LINUX ) ,y)
278
+ NATIVE_GUESTAGENT_ARCH = $(shell uname -m | sed -e s/arm64/aarch64/)
279
+ NATIVE_GUESTAGENT = $(call guestagent_path,LINUX,$(NATIVE_GUESTAGENT_ARCH ) )
280
+ ADDITIONAL_GUESTAGENT_ARCHS = $(filter-out $(NATIVE_GUESTAGENT_ARCH ) ,$(LINUX_GUESTAGENT_ARCHS ) )
281
+ ADDITIONAL_GUESTAGENTS = $(call guestagent_path,LINUX,$(ADDITIONAL_GUESTAGENT_ARCHS ) )
282
+ endif
280
283
281
284
# config_guestagent_arch returns expanded value of CONFIG_GUESTAGENT_ARCH_<arch>
282
285
# $(1): architecture
@@ -285,18 +288,19 @@ config_guestagent_arch = $(filter y,$(CONFIG_GUESTAGENT_ARCH_$(shell echo $(1)|t
285
288
286
289
# guestagent_path_enabled_by_config returns the path to the guestagent binary for the given architecture,
287
290
# or an empty string if the CONFIG_GUESTAGENT_ARCH_<arch> is not set.
288
- guestagent_path_enabled_by_config = $(if $(call config_guestagent_arch,$(1 ) ) ,$(call guestaget_path ,$(1 ) ) )
291
+ guestagent_path_enabled_by_config = $(if $(call config_guestagent_arch,$(2 ) ) ,$(call guestagent_path ,$(1 ) , $( 2 ) ) )
289
292
293
+ ifeq ($(CONFIG_GUESTAGENT_OS_LINUX ) ,y)
290
294
# apply CONFIG_GUESTAGENT_ARCH_*
291
- GUESTAGENTS = $(foreach arch,$(GUESTAGENT_ARCHS ) ,$(call guestagent_path_enabled_by_config,$(arch ) ) )
295
+ GUESTAGENTS + = $(foreach arch,$(LINUX_GUESTAGENT_ARCHS ) ,$(call guestagent_path_enabled_by_config,LINUX ,$(arch ) ) )
292
296
endif
293
297
294
298
.PHONY : guestagents native-guestagent additional-guestagents
295
299
guestagents : $(GUESTAGENTS )
296
300
native-guestagent : $(NATIVE_GUESTAGENT )
297
301
additional-guestagents : $(ADDITIONAL_GUESTAGENTS )
298
302
% -guestagent :
299
- @[ " $( findstring $( * ) ,$( GUESTAGENT_ARCHS ) ) " == " $( * ) " ] && make $(call guestaget_path ,$* )
303
+ @[ " $( findstring $( * ) ,$( LINUX_GUESTAGENT_ARCHS ) ) " == " $( * ) " ] && make $(call guestagent_path,LINUX ,$* )
300
304
301
305
# environment variables for linx-guestagent. these variable are used for checking force build.
302
306
ENVS_$(LINUX_GUESTAGENT_PATH_COMMON)aarch64 = CGO_ENABLED=0 GOOS=linux GOARCH=arm64
0 commit comments