commit 1c19e26ee748339698f6d8cfb959eb6a70b77dea
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2026-05-31T17:39:31Z |
| subject | Fixing sudo make install & sudo make uninstall |
commit 1c19e26ee748339698f6d8cfb959eb6a70b77dea
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2026-05-31T17:39:31Z
Fixing sudo make install & sudo make uninstall
---
Makefile | 10 ++++++++--
docs/tinyproxy.conf.5.scd | 14 +++++++-------
mk/common.mk | 5 +----
mk/man.mk | 13 +++++++++----
4 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
index ef9f582..1d4887c 100644
--- a/Makefile
+++ b/Makefile
@@ -28,10 +28,16 @@ endif
test: $(BIN)
$(TEST_FLAGS) python3 -m tests.run_tests $(BIN)
-clean:
+clean: clean-man
rm -rf $(BIN_DIR)
distclean: clean clean-libevent
rm -rf $(BUILD_DIR)
-.PHONY: all clean distclean test strip
+install: install-man $(BIN)
+ cp -a bin/tinyproxy /usr/local/bin/tinyproxy
+
+uninstall: uninstall-man $(BIN)
+ rm -f /usr/local/bin/tinyproxy
+
+.PHONY: all clean distclean test strip install uninstall
diff --git a/docs/tinyproxy.conf.5.scd b/docs/tinyproxy.conf.5.scd
index 46490b9..24b44d9 100644
--- a/docs/tinyproxy.conf.5.scd
+++ b/docs/tinyproxy.conf.5.scd
@@ -35,16 +35,16 @@ connect_timeout=SECONDS
Default: 5
broadcast_reply=listen
- UDP only. Send upstream replies back to the original client from the listening endpoint.
+ UDP only. Send upstream replies back to the original client from the listening endpoint.
broadcast_reply=upstream
- UDP/IPv4 only. Forward broadcast requests to the configured upstream and
- send upstream replies back to the original client using raw IPv4 packets
- whose source address and port are the upstream endpoint.
+ UDP/IPv4 only. Forward broadcast requests to the configured upstream and
+ send upstream replies back to the original client using raw IPv4 packets
+ whose source address and port are the upstream endpoint.
- This lets broadcast-based discovery advertise the upstream address directly,
- so clients can connect to the upstream after discovery instead of sending
- gameplay traffic through tinyproxy. Linux only; requires CAP_NET_RAW.
+ This lets broadcast-based discovery advertise the upstream address directly,
+ so clients can connect to the upstream after discovery instead of sending
+ gameplay traffic through tinyproxy. Linux only; requires CAP_NET_RAW.
# ENDPOINTS
diff --git a/mk/common.mk b/mk/common.mk
index 9fe120e..5abe399 100644
--- a/mk/common.mk
+++ b/mk/common.mk
@@ -10,6 +10,7 @@ PROJECT_ROOT ?= $(CURDIR)
SRC_DIR ?= $(PROJECT_ROOT)/src
BIN_DIR ?= $(PROJECT_ROOT)/bin
BUILD_DIR ?= $(PROJECT_ROOT)/build
+STATIC ?= 0
EXEEXT :=
WINDOWS_LDLIBS :=
@@ -29,17 +30,14 @@ CPPFLAGS += -I$(SRC_DIR)
UNAME_S := $(shell uname)
ifeq ($(UNAME_S),Darwin)
-STATIC ?= 0
CFLAGS += -pthread
CFLAGS += -Wno-gnu-zero-variadic-macro-arguments
LDFLAGS += -Wl,-dead_strip
TEST_FLAGS := CONCURRENCY=1000 TOTAL=1000 FD_LIMIT=2560
else ifeq ($(OS),Windows_NT)
-STATIC ?= 0
LDFLAGS += -Wl,--gc-sections
TEST_FLAGS := CONCURRENCY=100 TOTAL=100 FD_LIMIT=512
else ifeq ($(UNAME_S),FreeBSD)
-STATIC ?= 0
CFLAGS += -pthread
CFLAGS += -Wno-gnu-zero-variadic-macro-arguments
CPPFLAGS += -I/usr/local/include
@@ -48,7 +46,6 @@ LDFLAGS += -L/usr/local/lib
LDFLAGS += -Wl,--gc-sections
TEST_FLAGS :=
else
-STATIC ?= 1
CFLAGS += -pthread
LDFLAGS += -Wl,--gc-sections
TEST_FLAGS :=
diff --git a/mk/man.mk b/mk/man.mk
index 49eda49..a4d27bb 100644
--- a/mk/man.mk
+++ b/mk/man.mk
@@ -5,7 +5,12 @@ MAN_SCD := docs/tinyproxy.1.scd \
docs/tinyproxy.7.scd
MAN := $(MAN_SCD:.scd=)
-MAN_DIST := $(PROJECT_ROOT)/dist
+
+ifeq ($(shell id -u),0)
+MAN_DIST ?=
+else
+MAN_DIST ?= $(PROJECT_ROOT)/dist
+endif
.PHONY: man clean-man install-man uninstall-man
@@ -26,9 +31,9 @@ install-man: man
$(MAN_DIST)/usr/share/man/man7/tinyproxy.7
uninstall-man:
- rm -f $(DESTDIR)$(PREFIX)/share/man/man1/tinyproxy.1
- rm -f $(DESTDIR)$(PREFIX)/share/man/man5/tinyproxy.conf.5
- rm -f $(DESTDIR)$(PREFIX)/share/man/man7/tinyproxy.7
+ rm -f $(MAN_DIST)/share/man/man1/tinyproxy.1
+ rm -f $(MAN_DIST)/share/man/man5/tinyproxy.conf.5
+ rm -f $(MAN_DIST)/share/man/man7/tinyproxy.7
clean-man:
rm -f $(MAN)