Skip to content

Commit d7075c5

Browse files
committed
Makefile: change the artifact target to depend only on file targets for effective build suppression via timestamp checks.
Signed-off-by: Norio Nomura <[email protected]>
1 parent 8e84788 commit d7075c5

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,29 @@ force_build = $(if $(call compare_build_vars,$(1),$(call extract_build_vars,$(1)
194194
force: # placeholder for force build
195195

196196
# dependencies for limactl
197-
DEPENDENCIES_FOR_LIMACTL = $(call dependencis_for_cmd,limactl)
197+
LIMACTL_DEPS = $(call dependencis_for_cmd,limactl)
198198
ifeq ($(GOOS),darwin)
199-
DEPENDENCIES_FOR_LIMACTL += vz.entitlements
199+
LIMACTL_DEPS += vz.entitlements
200200
endif
201201

202202
# environment variables for limactl. this variable is used for checking force build.
203203
ENVS__output/bin/limactl$(exe) = CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) CC=$(CC)
204204

205-
_output/bin/limactl$(exe): $(DEPENDENCIES_FOR_LIMACTL) $$(call force_build,$$@)
205+
_output/bin/limactl$(exe): $(LIMACTL_DEPS) $$(call force_build,$$@)
206206
# The hostagent must be compiled with CGO_ENABLED=1 so that net.LookupIP() in the DNS server
207207
# calls the native resolver library and not the simplistic version in the Go library.
208208
$(ENVS_$@) $(GO_BUILD) -o $@ ./cmd/limactl
209209
ifeq ($(GOOS),darwin)
210210
codesign -f -v --entitlements vz.entitlements -s - $@
211211
endif
212212

213-
LIMA_CMDS = lima lima$(bat)
214-
lima: $(addprefix _output/bin/,$(LIMA_CMDS))
213+
LIMA_CMDS = $(sort lima lima$(bat)) # $(sort ...) deduplicates the list
214+
LIMA_DEPS = $(addprefix _output/bin/,$(LIMA_CMDS))
215+
lima: $(LIMA_DEPS)
215216

216217
HELPER_CMDS = nerdctl.lima apptainer.lima docker.lima podman.lima kubectl.lima
217-
helpers: $(addprefix _output/bin/,$(HELPER_CMDS))
218+
HELPERS_DEPS = $(addprefix _output/bin/,$(HELPER_CMDS))
219+
helpers: $(HELPERS_DEPS)
218220

219221
_output/bin/%: ./cmd/% | _output/bin
220222
cp -a $< $@
@@ -462,11 +464,17 @@ ARTIFACT_PATH_COMMON = _artifacts/lima-$(VERSION_TRIMMED)-$(ARTIFACT_OS)-$(ARTIF
462464

463465
artifact: $(addprefix $(ARTIFACT_PATH_COMMON),$(ARTIFACT_FILE_EXTENSIONS))
464466

467+
ARTIFACT_DES = _output/bin/limactl$(exe) $(LIMA_DEPS) $(HELPERS_DEPS) \
468+
$(NATIVE_GUESTAGENT) $(ADDITIONAL_GUESTAGENTS) \
469+
$(TEMPLATES) $(TEMPLATE_EXPERIMENTALS) _output/share/lima/examples \
470+
$(DOCUMENTATION) _output/share/doc/lima/templates _output/share/doc/lima/examples \
471+
_output/share/man/man1/limactl.1
472+
465473
# file targets
466-
$(ARTIFACT_PATH_COMMON).tar.gz: binaries | _artifacts
474+
$(ARTIFACT_PATH_COMMON).tar.gz: $(ARTIFACT_DES) | _artifacts
467475
$(TAR) -C _output/ --no-xattrs -czvf $@ ./
468476

469-
$(ARTIFACT_PATH_COMMON).zip: binaries | _artifacts
477+
$(ARTIFACT_PATH_COMMON).zip: $(ARTIFACT_DES) | _artifacts
470478
cd _output && $(ZIP) -r ../$@ *
471479

472480
# generate manpages using native limactl.

0 commit comments

Comments
 (0)