reaction/Makefile

45 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

CC ?= gcc
2024-01-06 23:52:16 +01:00
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
2024-01-10 10:49:10 +01:00
SYSTEMDDIR ?= /etc/systemd
2024-01-06 23:52:16 +01:00
all: reaction.linux reaction.freebsd ip46tables nft46
clean:
rm -f reaction.linux reaction.freebsd ip46tables nft46 reaction.deb deb reaction.minisig ip46tables.minisig reaction.deb.minisig nft46.minisig
2024-02-05 12:00:00 +01:00
ip46tables: helpers_c/ip46tables.c
$(CC) -s -static helpers_c/ip46tables.c -o ip46tables
nft46: helpers_c/nft46.c
$(CC) -s -static helpers_c/nft46.c -o nft46
reaction.linux: app/* reaction.go go.mod go.sum
GOOS=linux CGO_ENABLED=0 go build -buildvcs=false -ldflags "-s -X main.version=`git tag --sort=v:refname | tail -n1` -X main.commit=`git rev-parse --short HEAD`" -o reaction.linux
2024-03-30 17:50:51 +01:00
reaction.freebsd: app/* reaction.go go.mod go.sum
GOOS=freebsd CGO_ENABLED=0 go build -buildvcs=false -ldflags "-s -X main.version=`git tag --sort=v:refname | tail -n1` -X main.commit=`git rev-parse --short HEAD`" -o reaction.freebsd
2024-02-05 12:00:00 +01:00
reaction.deb: reaction ip46tables nft46
chmod +x reaction ip46tables nft46
mkdir -p deb/reaction/usr/bin/ deb/reaction/usr/sbin/ deb/reaction/lib/systemd/system/
2024-02-05 12:00:00 +01:00
cp reaction ip46tables nft46 deb/reaction/usr/bin/
cp config/reaction.debian.service deb/reaction/lib/systemd/system/reaction.service
cp -r DEBIAN/ deb/reaction/DEBIAN
sed -e "s/LAST_TAG/`git tag --sort=v:refname | tail -n1`/" -e "s/Version: v/Version: /" -i deb/reaction/DEBIAN/*
cd deb && dpkg-deb --root-owner-group --build reaction
mv deb/reaction.deb reaction.deb
rm -rf deb/
2024-01-04 12:00:00 +01:00
2024-02-05 12:00:00 +01:00
signatures: reaction.deb reaction ip46tables nft46
minisign -Sm ip46tables nft46 reaction reaction.deb
2024-01-04 12:00:00 +01:00
2024-01-06 23:52:16 +01:00
install: all
2024-01-10 12:00:00 +01:00
install -m755 reaction $(DESTDIR)$(BINDIR)
install -m755 ip46tables $(DESTDIR)$(BINDIR)
2024-02-05 12:00:00 +01:00
install -m755 nft46 $(DESTDIR)$(BINDIR)
2024-01-10 10:49:10 +01:00
install_systemd: install
2024-01-10 12:00:00 +01:00
install -m644 config/reaction.debian.service $(SYSTEMDDIR)/system/reaction.service
sed -i 's#/usr/bin#$(DESTDIR)$(BINDIR)#' $(SYSTEMDDIR)/system/reaction.service