summaryrefslogtreecommitdiff
path: root/Makefile
blob: db4f325060c0480fc1aadf255265d7052239f287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SHELL = /bin/bash

all: config.db
.PHONY: all

clean:
	rm -f -- $(filter-out $(pkgfiles),$(wildcard *.pkg.tar.xz))
.PHONY: clean

pkgbuilds = $(sort $(wildcard *.PKGBUILD))
$(foreach p,$(pkgbuilds), $(eval $(shell BUILDFILE=$(abspath $p); . "$$BUILDFILE"; echo $(patsubst %.PKGBUILD,%,$p).pkgfile=$$pkgname-$$pkgver-$$pkgrel-any.pkg.tar.xz)))
$(foreach p,$(patsubst %.PKGBUILD,%,$(pkgbuilds)), \
  $(eval pkgfiles += $($p.pkgfile))                \
  $(eval $($p.pkgfile): $p.PKGBUILD)               )

%.pkg.tar.xz: common.sh
	makepkg -d -p $(filter %.PKGBUILD,$^)

%.db %.db.tar.gz %.files %.files.tar.gz: .var.pkgfiles $(pkgfiles)
	rm -f $*.db $*.db.tar.gz $*.files $*.files.tar.gz
	repo-add $*.db.tar.gz $(filter %.pkg.tar.xz,$^)
	touch --no-create --no-dereference $*.db $*.db.tar.gz $*.files $*.files.tar.gz

.var.%: FORCE
	@printf '%s' '$(subst ','\\'',$($*))' | sed 's/^/#/' | ./write-ifchanged $@
-include $(wildcard .var.*)
.PHONY: FORCE
.SECONDARY: