2013-11-09 17:47:19 -05:00
|
|
|
srcdir=@srcdir@
|
|
|
|
|
|
|
|
CFLAGS=@CFLAGS@
|
2014-09-07 11:17:35 -04:00
|
|
|
LDFLAGS=@LDFLAGS@ @OPENSSL_LDFLAGS@
|
|
|
|
CPPFLAGS=@CPPFLAGS@ @OPENSSL_INCLUDES@
|
2013-11-09 17:47:19 -05:00
|
|
|
DEFS=@DEFS@
|
2014-09-07 11:17:35 -04:00
|
|
|
COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-09-07 11:17:35 -04:00
|
|
|
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@ @OPENSSL_LIBS@
|
2014-08-14 18:16:01 -04:00
|
|
|
LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS}
|
2013-11-09 17:47:19 -05:00
|
|
|
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
|
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
DEP=${srcdir}/dep
|
|
|
|
AUTO=${srcdir}/auto
|
|
|
|
EXE=${srcdir}/bin
|
|
|
|
OBJ=${srcdir}/objs
|
2014-08-18 12:39:04 -04:00
|
|
|
LIB=${srcdir}/libs
|
|
|
|
DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${LIB} ${DEP}/auto ${OBJ}/auto
|
2014-08-12 08:20:00 -04:00
|
|
|
|
|
|
|
EXE_LIST=${EXE}/generate ${EXE}/tlc ${EXE}/telegram-cli
|
2014-08-18 12:39:04 -04:00
|
|
|
LIB_LIST=${LIB}/libtgl.a
|
2014-08-12 08:20:00 -04:00
|
|
|
|
2014-08-18 12:39:04 -04:00
|
|
|
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o
|
|
|
|
TGL_OBJECTS=${OBJ}/net.o ${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/auto/auto.o ${OBJ}/tgl.o ${OBJ}/updates.o
|
2014-08-12 08:20:00 -04:00
|
|
|
TLC_OBJECTS=${OBJ}/tlc.o ${OBJ}/tl-parser.o ${OBJ}/crc32.o
|
2014-09-29 08:11:48 -04:00
|
|
|
TLD_OBJECTS=${OBJ}/dump-tl-file.o
|
2014-08-12 08:20:00 -04:00
|
|
|
GENERATE_OBJECTS=${OBJ}/generate.o
|
|
|
|
COMMON_OBJECTS=${OBJ}/tools.o
|
2014-09-29 08:11:48 -04:00
|
|
|
OBJ_LIST=${TG_OBJECTS} ${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS} ${TLD_OBJECTS}
|
|
|
|
OBJ_C=${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${TGL_OBJECTS} ${TLD_OBJECTS}
|
2014-08-12 08:20:00 -04:00
|
|
|
|
2014-08-12 08:29:42 -04:00
|
|
|
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_LIST}))
|
|
|
|
DEPENDENCE_LIST=${DEPENDENCE}
|
2014-08-12 08:20:00 -04:00
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
INCLUDE=-I. -I${srcdir}
|
|
|
|
CC=@CC@
|
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
.SUFFIXES: .c .h .o
|
|
|
|
|
2014-08-18 12:39:04 -04:00
|
|
|
all: ${EXE_LIST} ${DIR_LIST} ${LIB_LIST}
|
2014-08-12 11:15:04 -04:00
|
|
|
create_dirs_and_headers: ${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h ${AUTO}/constants.h
|
2014-08-12 08:20:00 -04:00
|
|
|
create_dirs: ${DIR_LIST}
|
2014-09-29 08:11:48 -04:00
|
|
|
dump-tl: ${EXE}/dump-tl-file
|
2014-08-12 08:20:00 -04:00
|
|
|
|
|
|
|
${DIR_LIST}:
|
|
|
|
@test -d $@ || mkdir -p $@
|
|
|
|
|
|
|
|
-include ${DEPENDENCE_LIST}
|
|
|
|
|
2014-09-02 06:23:22 -04:00
|
|
|
${TG_OBJECTS} ${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-header.h
|
2014-08-22 08:00:33 -04:00
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
${TG_OBJECTS}: ${OBJ}/%.o: %.c | create_dirs_and_headers
|
|
|
|
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
|
|
|
|
|
|
|
${OBJ_C}: ${OBJ}/%.o: %.c | create_dirs
|
|
|
|
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
${EXE}/tlc: ${TLC_OBJECTS} ${COMMON_OBJECTS}
|
|
|
|
${CC} ${TLC_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-08-18 12:39:04 -04:00
|
|
|
${EXE}/telegram-cli: ${TG_OBJECTS} ${COMMON_OBJECTS} ${LIB}/libtgl.a
|
|
|
|
${CC} ${TG_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -L${LIB} -l tgl -o $@
|
|
|
|
|
|
|
|
${LIB}/libtgl.a: ${TGL_OBJECTS} ${COMMON_OBJECTS}
|
|
|
|
ar ruv $@ ${TGL_OBJECTS} ${COMMON_OBJECTS}
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
${EXE}/generate: ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
|
|
|
|
${CC} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
|
2014-08-12 05:59:59 -04:00
|
|
|
|
2014-08-12 11:15:04 -04:00
|
|
|
${AUTO}/scheme.tlo: ${AUTO}/scheme.tl ${EXE}/tlc
|
|
|
|
${EXE}/tlc -e $@ ${AUTO}/scheme.tl
|
|
|
|
|
2014-09-03 05:49:38 -04:00
|
|
|
${AUTO}/scheme.tl: ${srcdir}/scheme.tl ${srcdir}/encrypted_scheme.tl ${srcdir}/binlog.tl ${srcdir}/append.tl | ${AUTO}
|
2014-08-12 11:15:04 -04:00
|
|
|
cat $^ > $@
|
|
|
|
|
|
|
|
${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tlc
|
|
|
|
${EXE}/tlc -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false )
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate
|
|
|
|
${EXE}/generate ${AUTO}/scheme.tlo > $@
|
2014-08-12 05:59:59 -04:00
|
|
|
|
2014-08-12 08:20:00 -04:00
|
|
|
${AUTO}/auto-header.h: ${AUTO}/scheme.tlo ${EXE}/generate
|
|
|
|
${EXE}/generate -H ${AUTO}/scheme.tlo > $@
|
2013-11-09 17:47:19 -05:00
|
|
|
|
2014-08-22 09:49:11 -04:00
|
|
|
${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/gen_constants_h.awk
|
|
|
|
awk -f ${srcdir}/gen_constants_h.awk < $< > $@
|
2014-08-12 11:15:04 -04:00
|
|
|
|
2014-09-29 08:11:48 -04:00
|
|
|
${EXE}/dump-tl-file: ${OBJ}/auto/auto.o ${TLD_OBJECTS}
|
|
|
|
${CC} ${OBJ}/auto/auto.o ${TLD_OBJECTS} ${LINK_FLAGS} -o $@
|
|
|
|
|
2013-11-09 17:47:19 -05:00
|
|
|
clean:
|
2014-08-12 08:20:00 -04:00
|
|
|
rm -rf ${DIR_LIST} config.log config.status > /dev/null || echo "all clean"
|
2013-11-09 17:47:19 -05:00
|
|
|
|