summaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
blob: 57f0431c309164cd3ac2ce6c945a2dc4e5a7b41d (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
include prelude.mk

PKG_NAME ?= config-links
DESTDIR  ?=

$(eval $(call noexpand,PKG_NAME))
$(eval $(call noexpand,DESTDIR))

.PHONY: all
all:

.PHONY: test
test:
	./test/runner/main.sh

test/docker/%: DO
	cd test/docker && \
		DISTRO='$*' docker compose build --force-rm -q && \
		docker compose run --rm test && \
		docker compose down -v

# Xenial has bash 4.3, which doesn't support inherit_errexit, which is a good
# thing to test against.
#
# Keep the list distros synced with the GitHub actions workflow & Launchpad.
.PHONY: test/docker
test/docker: test/docker/xenial
test/docker: test/docker/bionic
test/docker: test/docker/focal
test/docker: test/docker/jammy
test/docker: test/docker/noble
test/docker: test/docker/resolute

.PHONY: install
install:
	install -D -m 0644 -t '$(call escape,$(DESTDIR)/usr/share/$(PKG_NAME))'     LICENSE.txt
	install -D -m 0644 -t '$(call escape,$(DESTDIR)/usr/share/doc/$(PKG_NAME))' README.md

	find bin -type f -exec install -D -m 0755 -t '$(call escape,$(DESTDIR)/usr/lib/$(PKG_NAME)/bin)' {} ';'
	find lib -type f -exec install -D -m 0644 -t '$(call escape,$(DESTDIR)/usr/lib/$(PKG_NAME)/lib)' {} ';'

	install -d '$(call escape,$(DESTDIR)/usr/bin)'
	find '$(call escape,$(DESTDIR)/usr/lib/$(PKG_NAME)/bin)' -type f -printf '%P\0' | \
	while IFS= read -d '' -r file; do \
		ln -s -- '$(call escape,/usr/lib/$(PKG_NAME)/bin/)'"$$file" '$(call escape,$(DESTDIR)/usr/bin)' ; \
	done