TNT/Makefile
m1ngsama a4d67be103 Replace telnet with SSH and fix full-screen display
- Implement SSH server using libssh for secure connections
- Replace insecure telnet with encrypted SSH protocol
- Add automatic terminal size detection via PTY requests
- Support dynamic window resize (SIGWINCH handling)
- Fix UI display bug by using SSH channel instead of fd
- Update tui_clear_screen to work with SSH connections
- Add RSA host key auto-generation on first run
- Update README with SSH instructions and security notes
- Add libssh dependency to Makefile with auto-detection
- Remove all telnet-related code

Security improvements:
- All traffic now encrypted
- Host key authentication
- No more plaintext transmission
2025-11-24 16:48:14 +08:00

64 lines
1.4 KiB
Makefile

# TNT - TNT's Not Tunnel
# High-performance terminal chat server written in C
CC = gcc
CFLAGS = -Wall -Wextra -O2 -std=c11 -D_XOPEN_SOURCE=700
LDFLAGS = -pthread -lssh
INCLUDES = -Iinclude
# Detect libssh location (homebrew on macOS)
ifeq ($(shell uname), Darwin)
LIBSSH_PREFIX := $(shell brew --prefix libssh 2>/dev/null)
ifneq ($(LIBSSH_PREFIX),)
INCLUDES += -I$(LIBSSH_PREFIX)/include
LDFLAGS += -L$(LIBSSH_PREFIX)/lib
endif
endif
SRC_DIR = src
INC_DIR = include
OBJ_DIR = obj
SOURCES = $(wildcard $(SRC_DIR)/*.c)
OBJECTS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
TARGET = tnt
.PHONY: all clean install uninstall
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
@echo "Build complete: $(TARGET)"
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
clean:
rm -rf $(OBJ_DIR) $(TARGET)
@echo "Clean complete"
install: $(TARGET)
install -d $(DESTDIR)/usr/local/bin
install -m 755 $(TARGET) $(DESTDIR)/usr/local/bin/
uninstall:
rm -f $(DESTDIR)/usr/local/bin/$(TARGET)
# Development targets
debug: CFLAGS += -g -DDEBUG
debug: clean $(TARGET)
release: CFLAGS += -O3 -DNDEBUG
release: clean $(TARGET)
strip $(TARGET)
# Show build info
info:
@echo "Compiler: $(CC)"
@echo "Flags: $(CFLAGS)"
@echo "Sources: $(SOURCES)"
@echo "Objects: $(OBJECTS)"