wireguard-setup/Makefile

43 lines
1.4 KiB
Makefile

CFLAGS = -std=gnu99 -pie -fPIC -pedantic -Wno-imports -Wunused -Wno-missing-field-initializers -Wextra -Wunreachable-code -O3
all: wireguard_mount wireguard_resolve enter_vpn
wireguard_mount: src/wireguard-mount.c
mkdir -p bin
gcc $(CFLAGS) -o bin/wireguard-mount src/wireguard-mount.c -lsystemd
wireguard_resolve: src/resolve.c src/resolve.s
mkdir -p bin
gcc -shared -o bin/wireguard-resolve.so -nostdlib -fPIC src/resolve.c src/resolve.s
enter_vpn: src/enter_vpn.c
mkdir -p bin
gcc $(CFLAGS) -o bin/enter_vpn src/enter_vpn.c
format: src scripts
clang-format -i src/*.c
ruff --fix scripts
black scripts
install_mount: systemd bin
mkdir -p /snacks/wireguard/bin
cp bin/wireguard-mount /snacks/wireguard/bin/wireguard-mount
cp systemd/wireguard-mount.service /etc/systemd/system/wireguard-mount.service
chmod -R 755 /snacks/wireguard
systemctl daemon-reload
systemctl enable wireguard-mount
systemctl start wireguard-mount
install_basic: systemd scripts bin
mkdir -p /snacks/wireguard/bin
mkdir -p /snacks/wireguard/scripts
cp bin/wireguard-resolve.so /snacks/wireguard/bin/wireguard-resolve.so
cp systemd/vpnclient-wg-basic.service /etc/systemd/system/vpnclient-wg-basic.service
cp scripts/connect_basic.py /snacks/wireguard/scripts/connect_basic.py
cp scripts/inner_basic.sh /snacks/wireguard/scripts/inner_basic.sh
chmod -R 755 /snacks/wireguard
systemctl daemon-reload