gllvm/examples/tor_and_its_dependencies/Makefile

108 lines
2.8 KiB
Makefile
Raw Normal View History

2018-05-25 23:59:56 +02:00
#iam wrote this monstrosity
THISDIR= $(shell pwd)
ZLIB=zlib-1.2.11
ZLIB_TARBALL=${ZLIB}.tar.gz
ZLIB_URL=https://zlib.net/${ZLIB_TARBALL}
ZLIB_INSTALL=${THISDIR}/install/zlib
LIBEVENT=libevent-2.1.8-stable
LIBEVENT_TARBALL=${LIBEVENT}.tar.gz
LIBEVENT_URL=https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/${LIBEVENT_TARBALL}
LIBEVENT_INSTALL=${THISDIR}/install/libevent
OPENSSL=openssl-1.1.0h
OPENSSL_TARBALL=${OPENSSL}.tar.gz
OPENSSL_URL=https://www.openssl.org/source/${OPENSSL_TARBALL}
OPENSSL_INSTALL=${THISDIR}/install/openssl
TOR=tor-0.3.3.6
TOR_TARBALL=${TOR}.tar.gz
TOR_URL=https://www.torproject.org/dist/${TOR_TARBALL}
TOR_INSTALL=${THISDIR}/install/tor
#LLVMCC=wllvm
#LLVMGET=extract-bc
LLVMCC=gclang
LLVMGET=get-bc
2018-05-26 00:34:33 +02:00
BITCODE = libz.a.bc libssl.a.bc libevent.a.bc tor.bc
2018-05-25 23:59:56 +02:00
2018-05-26 01:49:52 +02:00
all: tor.bc
#${BITCODE}
2018-05-25 23:59:56 +02:00
${TOR_TARBALL}:
wget ${TOR_URL}
${TOR}: ${TOR_TARBALL}
tar xvfz ${TOR_TARBALL}
${TOR_INSTALL}/bin/tor: ${TOR}
2018-05-26 01:49:52 +02:00
cd ${TOR}; CC=${LLVMCC} ./configure; make && make install
#on linux we should try this:
# cd ${TOR}; CC=${LLVMCC} ./configure --disable-dependency-tracking --enable-static-tor --with-openssl-dir=${OPENSSL_INSTALL} --with-libevent-dir=${LIBEVENT_INSTALL}/lib --with-zlib-dir=${ZLIB_INSTALL} --prefix=${TOR_INSTALL}; make && make install
2018-05-25 23:59:56 +02:00
tor.bc: ${TOR_INSTALL}/bin/tor
2018-05-26 00:34:33 +02:00
cd ${TOR_INSTALL}/bin; ${LLVMGET} tor; mv tor.bc ${THISDIR}
2018-05-25 23:59:56 +02:00
${ZLIB_TARBALL}:
wget ${ZLIB_URL}
${ZLIB}: ${ZLIB_TARBALL}
tar xvfz ${ZLIB_TARBALL}
${ZLIB_INSTALL}/lib/libz.a: ${ZLIB}
cd ${ZLIB}; CC=${LLVMCC} ./configure --prefix=${ZLIB_INSTALL}; make && make install
libz.a.bc: ${ZLIB_INSTALL}/lib/libz.a
cd ${ZLIB_INSTALL}/lib; ${LLVMGET} -b libz.a; mv libz.a.bc ${THISDIR}
${OPENSSL_TARBALL}:
wget ${OPENSSL_URL}
${OPENSSL}: ${OPENSSL_TARBALL}
tar xvfz ${OPENSSL_TARBALL}
${OPENSSL_INSTALL}/lib/libssl.a: ${OPENSSL}
cd ${OPENSSL}; CC=${LLVMCC} ./config --prefix=${OPENSSL_INSTALL} --openssldir=${OPENSSL_INSTALL}; make && make install
libssl.a.bc: ${OPENSSL_INSTALL}/lib/libssl.a
cd ${OPENSSL_INSTALL}/lib; ${LLVMGET} -b libssl.a; mv libssl.a.bc ${THISDIR}
${LIBEVENT_TARBALL}:
wget ${LIBEVENT_URL}
${LIBEVENT}: ${LIBEVENT_TARBALL}
tar xvfz ${LIBEVENT_TARBALL}
${LIBEVENT_INSTALL}/lib/libevent.a: ${LIBEVENT}
cd ${LIBEVENT}; CC=${LLVMCC} CFLAGS="-I${OPENSSL_INSTALL}/include" LDFLAGS="-L${OPENSSL_INSTALL}/lib" ./configure --prefix=${LIBEVENT_INSTALL}; make && make install
libevent.a.bc: ${LIBEVENT_INSTALL}/lib/libevent.a
cd ${LIBEVENT_INSTALL}/lib; ${LLVMGET} -b libevent.a; mv libevent.a.bc ${THISDIR}
clean:
rm ${BITCODE}
make -C ${ZLIB} clean
make -C ${LIBEVENT} clean
make -C ${OPENSSL} clean
make -C ${TOR} clean
very_clean: clean
rm -rf install ${TOR} ${ZLIB} ${OPENSSL} ${LIBEVENT}
spotless: very_clean
rm -rf ${TOR_TARBALL} ${ZLIB_TARBALL} ${OPENSSL_TARBALL} ${LIBEVENT_TARBALL}