LIBSSH=libssh-0.7.2 LIBSSH_URL=https://red.libssh.org/attachments/download/177/$(LIBSSH).tar.xz LIBSSH_LIB=ext/lib/libssh.a MSGPACK=msgpack-1.3.0 MSGPACK_URL=https://github.com/msgpack/msgpack-c/releases/download/cpp-1.3.0/$(MSGPACK).tar.gz MSGPACK_LIB=ext/lib/libmsgpack.a TMATE_CONFIGURE=PKG_CONFIG_PATH=./ext/lib/pkgconfig LIBC=$(shell gcc -print-file-name=libc.a) STATIC_LIBC_OBJECTS=fdelt_chk STATIC_COMPAT_OBJECTS=memcpy clock_gettime all: tmate dependencies: apt-get install build-essential cmake libssl-dev autoconf automake pkg-config libtool libevent-dev libncurses-dev zlib1g-dev downloads/$(notdir $(LIBSSH_URL)): mkdir -p downloads wget -O $@ $(LIBSSH_URL) $(LIBSSH)/.ready: downloads/$(notdir $(LIBSSH_URL)) tar xf $< touch $@ downloads/$(notdir $(MSGPACK_URL)): mkdir -p downloads wget -O $@ $(MSGPACK_URL) $(MSGPACK)/.ready: downloads/$(notdir $(MSGPACK_URL)) tar xf $< touch $@ $(LIBSSH_LIB): $(LIBSSH)/.ready mkdir -p $(LIBSSH)/build cd $(LIBSSH)/build; ([ -f Makefile ] || cmake -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/ext .. -DWITH_SFTP=OFF -DWITH_SERVER=OFF -DWITH_PCAP=OFF -DWITH_STATIC_LIB=ON -DWITH_GSSAPI=OFF) +make -C $(LIBSSH)/build install $(MSGPACK_LIB): $(MSGPACK)/.ready mkdir -p $(MSGPACK)/build cd $(MSGPACK)/build; ([ -f Makefile ] || cmake -DCMAKE_INSTALL_PREFIX:PATH=$(shell pwd)/ext ..) +make -C $(MSGPACK)/build install libc/%.o: mkdir -p libc cd libc; ar x $(LIBC) $(notdir $@) compat/%.o: compat/%.c gcc -c -o $@ $< tmate: $(MSGPACK_LIB) $(LIBSSH_LIB) $(patsubst %,libc/%.o,$(STATIC_LIBC_OBJECTS)) $(patsubst %,compat/%.o,$(STATIC_COMPAT_OBJECTS)) ./autogen.sh $(TMATE_CONFIGURE) ./configure --enable-static +make clean: rm -rf ext libc $(LIBSSH) $(MSGPACK) +make clean