2023-03-24 17:48:25 +08:00
|
|
|
CROSS_COMPILE ?=
|
|
|
|
CC := $(CROSS_COMPILE)gcc
|
|
|
|
STRIP := $(CROSS_COMPILE)strip
|
|
|
|
CFLAGS = -Wall -g -O3
|
2024-01-02 18:28:44 +08:00
|
|
|
LIB = -lssh2 -pthread
|
|
|
|
forward-tunnel = forward-tunnel
|
|
|
|
reverse-tunnel = reverse-tunnel
|
2023-03-24 17:48:25 +08:00
|
|
|
|
2024-01-02 18:28:44 +08:00
|
|
|
ifeq ($(shell uname -o), GNU/Linux)
|
|
|
|
ifeq ($(shell lsb_release -si), Debian)
|
|
|
|
LIB += -static
|
|
|
|
SSH2_LIB := $(shell pkg-config --static --libs --cflags libssh2)
|
|
|
|
else
|
|
|
|
SSH2_LIB := $(shell pkg-config --libs --cflags libssh2)
|
|
|
|
endif
|
|
|
|
endif
|
2023-03-24 17:48:25 +08:00
|
|
|
|
|
|
|
all:forward-tunnel reverse-tunnel
|
|
|
|
|
2024-05-14 15:11:08 +08:00
|
|
|
forward-tunnel: forward-tunnel.o thpool.o
|
2024-01-02 18:28:44 +08:00
|
|
|
$(CC) $(CFLAGS) -o $(forward-tunnel) $^ $(SSH2_LIB) $(LIB)
|
2023-06-05 11:47:35 +08:00
|
|
|
$(STRIP) forward-tunnel
|
2023-03-24 17:48:25 +08:00
|
|
|
|
|
|
|
reverse-tunnel: reverse-tunnel.o
|
2024-01-02 18:28:44 +08:00
|
|
|
$(CC) $(CFLAGS) -o $(reverse-tunnel) $^ $(SSH2_LIB) $(LIB)
|
2024-05-13 15:20:25 +08:00
|
|
|
: $(STRIP) reverse-tunnel
|
2023-03-24 17:48:25 +08:00
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(CC) $(CFLAGS) -c $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf *.o
|
|
|
|
rm reverse-tunnel forward-tunnel
|