Skip to content

Commit 92ef952

Browse files
authored
Merge pull request #3438 from wolfi-dev/chore/speed-up-makefile
makefile: use wolfictl -t name-version to speed up makefile performance 875x
2 parents 17da42f + bfee6d4 commit 92ef952

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif
3434

3535
# The list of packages to be built. The order matters.
3636
# wolfictl determines the list and order
37-
PKGLIST ?= $(shell $(WOLFICTL) text --dir . --type name)
37+
PKG_FULL_LIST ?= $(shell $(WOLFICTL) text --dir . --type name-version)
3838

3939
all: ${KEY} .build-packages
4040

@@ -46,21 +46,25 @@ clean:
4646

4747
.PHONY: list list-yaml
4848
list:
49+
$(eval PKGLIST ?= $(shell $(WOLFICTL) text --dir . --type name))
4950
$(info $(PKGLIST))
5051
@printf ''
5152

5253
list-yaml:
54+
$(eval PKGLIST ?= $(shell $(WOLFICTL) text --dir . --type name))
5355
$(info $(addsuffix .yaml,$(PKGLIST)))
5456
@printf ''
5557

56-
.build-packages: $(addprefix package/,${PKGLIST})
58+
.build-packages: $(addsuffix .apk,$(addprefix packages/$(ARCH)/,${PKG_FULL_LIST}))
5759

5860
package/%:
5961
$(eval yamlfile := $*.yaml)
6062
$(eval pkgver := $(shell $(MELANGE) package-version $(yamlfile)))
61-
$(MAKE) yamlfile=$(yamlfile) pkgname=$* packages/$(ARCH)/$(pkgver).apk
63+
$(MAKE) packages/$(ARCH)/$(pkgver).apk
6264

6365
packages/$(ARCH)/%.apk: $(KEY)
66+
$(eval pkgname := $(word 1, $(subst -, , $*)))
67+
$(eval yamlfile := $(pkgname).yaml)
6468
@mkdir -p ./$(pkgname)/
6569
$(eval SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct --follow $(yamlfile)))
6670
@SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(MELANGE) build $(yamlfile) $(MELANGE_OPTS) --source-dir ./$(pkgname)/ --log-policy builtin:stderr,$(TARGETDIR)/buildlogs/$*.log

0 commit comments

Comments
 (0)