diff --git a/src/Makefile b/src/Makefile index 72296aa..241293f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,6 +35,8 @@ WITH_SYSTEMDUNITS := yes endif endif +PLATFORM ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') + CFLAGS ?= -O3 CFLAGS += -std=gnu11 -D_GNU_SOURCE CFLAGS += -Wall -Wextra @@ -43,7 +45,7 @@ CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\"" ifeq ($(DEBUG_TOOLS),y) CFLAGS += -g endif -ifeq ($(shell uname -s),Linux) +ifeq ($(PLATFORM),linux) LIBMNL_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmnl 2>/dev/null) LIBMNL_LDLIBS := $(shell $(PKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) CFLAGS += $(LIBMNL_CFLAGS) @@ -72,17 +74,17 @@ endif install: wg @install -v -d "$(DESTDIR)$(BINDIR)" && install -m 0755 -v wg "$(DESTDIR)$(BINDIR)/wg" - @install -v -d "$(DESTDIR)$(MANDIR)/man8" && install -m 0644 -v wg.8 "$(DESTDIR)$(MANDIR)/man8/wg.8" + @install -v -d "$(DESTDIR)$(MANDIR)/man8" && install -m 0644 -v man/wg.8 "$(DESTDIR)$(MANDIR)/man8/wg.8" @[ "$(WITH_BASHCOMPLETION)" = "yes" ] || exit 0; \ install -v -d "$(DESTDIR)$(BASHCOMPDIR)" && install -m 0644 -v completion/wg.bash-completion "$(DESTDIR)$(BASHCOMPDIR)/wg" @[ "$(WITH_WGQUICK)" = "yes" ] || exit 0; \ - install -m 0755 -v wg-quick.bash "$(DESTDIR)$(BINDIR)/wg-quick" && install -m 0700 -v -d "$(DESTDIR)$(SYSCONFDIR)/wireguard" + install -m 0755 -v wg-quick/$(PLATFORM).bash "$(DESTDIR)$(BINDIR)/wg-quick" && install -m 0700 -v -d "$(DESTDIR)$(SYSCONFDIR)/wireguard" @[ "$(WITH_WGQUICK)" = "yes" ] || exit 0; \ - install -m 0644 -v wg-quick.8 "$(DESTDIR)$(MANDIR)/man8/wg-quick.8" + install -m 0644 -v man/wg-quick.8 "$(DESTDIR)$(MANDIR)/man8/wg-quick.8" @[ "$(WITH_WGQUICK)" = "yes" -a "$(WITH_BASHCOMPLETION)" = "yes" ] || exit 0; \ install -m 0644 -v completion/wg-quick.bash-completion "$(DESTDIR)$(BASHCOMPDIR)/wg-quick" @[ "$(WITH_WGQUICK)" = "yes" -a "$(WITH_SYSTEMDUNITS)" = "yes" ] || exit 0; \ - install -v -d "$(DESTDIR)$(SYSTEMDUNITDIR)" && install -m 0644 -v wg-quick@.service "$(DESTDIR)$(SYSTEMDUNITDIR)/wg-quick@.service" + install -v -d "$(DESTDIR)$(SYSTEMDUNITDIR)" && install -m 0644 -v systemd/wg-quick@.service "$(DESTDIR)$(SYSTEMDUNITDIR)/wg-quick@.service" help: @cat INSTALL diff --git a/src/wg-quick.8 b/src/man/wg-quick.8 similarity index 100% rename from src/wg-quick.8 rename to src/man/wg-quick.8 diff --git a/src/wg.8 b/src/man/wg.8 similarity index 100% rename from src/wg.8 rename to src/man/wg.8 diff --git a/src/wg-quick@.service b/src/systemd/wg-quick@.service similarity index 73% rename from src/wg-quick@.service rename to src/systemd/wg-quick@.service index ce6d70a..da5d787 100644 --- a/src/wg-quick@.service +++ b/src/systemd/wg-quick@.service @@ -6,8 +6,8 @@ Documentation=man:wg-quick(8) Documentation=man:wg(8) Documentation=https://www.wireguard.com/ Documentation=https://www.wireguard.com/quickstart/ -Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/wg-quick.8 -Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/wg.8 +Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8 +Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/man/wg.8 [Service] Type=oneshot diff --git a/src/wg-quick.bash b/src/wg-quick/linux.bash similarity index 100% rename from src/wg-quick.bash rename to src/wg-quick/linux.bash