wg: reorganize for multiplatform wg-quick
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									0b64881c7a
								
							
						
					
					
						commit
						08c78a65af
					
				
					 5 changed files with 9 additions and 7 deletions
				
			
		
							
								
								
									
										12
									
								
								src/Makefile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		Loading…
	
		Reference in a new issue