Add zsh completion script

Refer <https://www.gnu.org/software/automake/manual/automake.html#Third_002dParty-Makefiles>, use install-exec
This commit is contained in:
Wu Zhenyu 2023-04-05 18:30:55 +08:00
parent 1f04b93d35
commit 02409fba79
No known key found for this signature in database
GPG Key ID: 0E07E1F8C0EC10AD
2 changed files with 13 additions and 2 deletions

View File

@ -9,9 +9,11 @@ prefix = /usr/local
includedir = $(prefix)/include
libdir = $(prefix)/lib
confdir = $(prefix)/etc
datadir = $(prefix)/share
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
zshcompdir = $(datadir)/zsh/site-functions
SRCS = $(sort $(wildcard src/*.c))
OBJS = $(SRCS:.c=.o)
@ -46,7 +48,9 @@ CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\" -DINSTALL_PREFIX=\"$(prefix)\" -DDLL_NAME=\"
all: $(ALL_LIBS) $(ALL_TOOLS)
#install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(DESTDIR)$(LDSO_PATHNAME)
install:
install: install-exec install-config install-zsh-completion
install-exec:
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(libdir) $(DESTDIR)/$(confdir) $(DESTDIR)/$(includedir)
install $(INSTALL_FLAGS) 755 $(ALL_TOOLS) $(DESTDIR)/$(bindir)/
install $(INSTALL_FLAGS) 644 $(ALL_LIBS) $(DESTDIR)/$(libdir)/
@ -55,6 +59,10 @@ install-config:
install -d $(DESTDIR)/$(confdir)
install $(INSTALL_FLAGS) 644 src/proxychains.conf $(DESTDIR)/$(confdir)/
install-zsh-completion:
install -d $(DESTDIR)/$(zshcompdir)
install $(INSTALL_FLAGS) 644 completions/zsh/_proxychains4 -t $(DESTDIR)/$(zshcompdir)
clean:
rm -f $(ALL_LIBS)
rm -f $(ALL_TOOLS)
@ -70,6 +78,6 @@ $(LDSO_PATHNAME): $(LOBJS)
$(ALL_TOOLS): $(OBJS)
$(CC) src/main.o src/common.o -o $(PXCHAINS)
.PHONY: all clean install install-config
.PHONY: all clean install install-exec install-config install-zsh-completion
-include $(DEPS)

View File

@ -0,0 +1,3 @@
#compdef proxychains4
_arguments -s -S '1: :{_command_names -e}' '*:: :_normal'