libssh2-tunnel/Makefile
2024-05-13 15:20:25 +08:00

34 lines
809 B
Makefile

CROSS_COMPILE ?=
CC := $(CROSS_COMPILE)gcc
STRIP := $(CROSS_COMPILE)strip
CFLAGS = -Wall -g -O3
LIB = -lssh2 -pthread
forward-tunnel = forward-tunnel
reverse-tunnel = reverse-tunnel
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
all:forward-tunnel reverse-tunnel
forward-tunnel: forward-tunnel.o
$(CC) $(CFLAGS) -o $(forward-tunnel) $^ $(SSH2_LIB) $(LIB)
$(STRIP) forward-tunnel
reverse-tunnel: reverse-tunnel.o
$(CC) $(CFLAGS) -o $(reverse-tunnel) $^ $(SSH2_LIB) $(LIB)
: $(STRIP) reverse-tunnel
.c.o:
$(CC) $(CFLAGS) -c $<
clean:
rm -rf *.o
rm reverse-tunnel forward-tunnel