File: Makefile

package info (click to toggle)
clatd 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 352 kB
  • sloc: perl: 821; makefile: 51; sh: 43
file content (68 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# clatd Makefile
#
# Copyright (C) 2025 Daniel Gröber <dxld@debian.org>
#
# SPDX-License-Identifier: MIT

DESTDIR=
PREFIX=/usr
SYSCONFDIR=/etc
BINDIR = $(PREFIX)/sbin
LIBDIR = $(PREFIX)/lib

SYSTEMCTL = systemctl

CLATD   = $(DESTDIR)$(BINDIR)/clatd
MANPAGE = $(DESTDIR)$(PREFIX)/share/man/man8/clatd.8
SYSTEMD_SYSSERVICEDIR = $(DESTDIR)$(LIBDIR)/systemd/system
NM_DISPATCHER = $(DESTDIR)$(LIBDIR)/NetworkManager/dispatcher.d/50-clatd

Q = @

all: clatd.8
.ONESHELL:

clatd.8: clatd.pod
	pod2man \
	  --name clatd \
	  --center "clatd - CLAT, SIIT-DC and IPv6-only with many XLAT engines" \
	  --section 8 \
	  $< $@

clean:
	-rm clatd.8

start: install
	$(SYSTEMCTL) --system daemon-reload
	$(SYSTEMCTL) --system -f --now enable clatd.service

stop:
	$(SYSTEMCTL) --system disable --now clatd.service

uninstall: stop
	-rm $(SYSTEMD_SYSSERVICE)/clatd.service \
	    $(SYSTEMD_SYSSERVICE)/clatd@.service \
	    $(NM_DISPATCHER)

install:
	install -D -m0755 clatd $(CLATD)
	install -D -m0644 clatd.8 $(MANPAGE)
	install -D -m0644 scripts/clatd.systemd $(SYSTEMD_SYSSERVICEDIR)/clatd.service
	install -D -m0644 scripts/clatd@.systemd $(SYSTEMD_SYSSERVICEDIR)/clatd@.service
	install -D -m0755 scripts/clatd.networkmanager $(NM_DISPATCHER)

DEB_PACKAGES = \
 perl-base perl-modules libnet-ip-perl libnet-dns-perl libjson-perl \
 iproute2 nftables tayga

RPM_PACKAGES = \
 perl perl-IPC-Cmd perl-Net-IP perl-Net-DNS perl-File-Temp perl-JSON \
 iproute nftables

installdeps:
	$(Q)prog_exists () { command -v $$@ >/dev/null 2>&1; }
	{ PKGS='$(DEB_PACKAGES)'; PKG=apt; prog_exists $$PKG; } || \
	{ PKGS='$(RPM_PACKAGES)'; PKG=dnf; prog_exists $$PKG; } || \
	{ PKGS='$(RPM_PACKAGES)'; PKG=yum; prog_exists $$PKG; } || \
        { PKG=false; echo 'ERROR: Failed to detect system package manager.'>&2;}
	$(DRY) $$PKG install -y $$PKGS