From f6fbb2eec410fa56718ac7afd5b33802f88becf3 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 16 Jan 2024 04:19:15 +0300 Subject: [PATCH] happy-ish with the Makefile... Signed-off-by: Alex A. Naanou --- wireguard/templates/root/Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wireguard/templates/root/Makefile b/wireguard/templates/root/Makefile index 25c180c..3f306f1 100644 --- a/wireguard/templates/root/Makefile +++ b/wireguard/templates/root/Makefile @@ -1,3 +1,6 @@ +#---------------------------------------------------------------------- +# +#---------------------------------------------------------------------- INTERFACE := wg0 @@ -21,6 +24,8 @@ ALLOWED_IPS ?= ${ALLOWED_IPS} +#---------------------------------------------------------------------- + %_id: @ mkdir -p $$(dirname $@) wg genkey 2> /dev/null > $@ @@ -48,8 +53,6 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY) wg-quick up $(INTERFACE) -# XXX need to figure out a way to link this to the .config file without -# conflicting with the server's wg0.conf .PRECIOUS: %.wg %.wg: $(CLIENT_TPL) $(SERVER_CLIENT_TPL) \ %_id %_id.pub %_ip \ @@ -73,9 +76,9 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY) -e 's/\$${\CLIENT_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$*_id.pub")/g' \ -e 's/\$${\SERVER_PUBLIC_KEY}/$(shell sed -e 's/\//\\\//g' "$(SERVER_PUBLIC_KEY)")/g' \ >> "$(SERVER_CONF)" - make update $*.show +.PHONY: %.show %.show: %.wg @ [ "$(QRCODE)" == "1" ] \ && ( echo "# Profile: $*" \ @@ -84,15 +87,21 @@ $(SERVER_CONF): $(SERVER_TPL) $(SERVER_KEY) @ echo +.PHONY: %.client %.client: $(CLIENT_DIR)/%.wg update $(CLIENT_DIR)/%.show @ +#---------------------------------------------------------------------- + +.PHONY: update update: wg syncconf $(INTERFACE) <(wg-quick strip $(INTERFACE)) +.PHONY: server server: $(SERVER_CONF) +#----------------------------------------------------------------------