diff --git a/Makefile.in b/Makefile.in index 340c069..e9f0144 100644 --- a/Makefile.in +++ b/Makefile.in @@ -21,7 +21,7 @@ EXE_LIST=${EXE}/telegram-cli TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o -INCLUDE=-I. -I${srcdir} +INCLUDE=-I. -I${srcdir} -I${srcdir}/tgl CC=@CC@ .SUFFIXES: @@ -29,7 +29,7 @@ CC=@CC@ .SUFFIXES: .c .h .o all: ${EXE_LIST} ${DIR_LIST} -create_dirs_and_headers: ${DIR_LIST} ${AUTO}/auto.c ${AUTO}/auto-header.h ${AUTO}/constants.h +create_dirs_and_headers: ${DIR_LIST} ${AUTO}/auto-skip.h ${AUTO}/auto-fetch.h ${AUTO}/auto-store.h ${AUTO}/auto-autocomplete.h ${AUTO}/auto-types.h create_dirs: ${DIR_LIST} dump-tl: ${EXE}/dump-tl-file @@ -39,7 +39,7 @@ include ${srcdir}/Makefile.tgl ${DIR_LIST}: @test -d $@ || mkdir -p $@ -OBJ_LIST=${TG_OBJECTS} ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${GENERATE_OBJECTS} ${TL_PARSER_OBJECTS} +OBJ_LIST=${TG_OBJECTS} ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${GENERATE_OBJECTS} ${TL_PARSER_OBJECTS} ${TGL_OBJECTS_AUTO} DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_LIST})) DEPENDENCE_LIST=${DEPENDENCE} diff --git a/Makefile.tgl b/Makefile.tgl index adf65d0..8dbc9b5 100644 --- a/Makefile.tgl +++ b/Makefile.tgl @@ -1,4 +1,8 @@ -TGL_OBJECTS=${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/tgl.o ${OBJ}/updates.o ${OBJ}/tgl-net.o ${OBJ}/tgl-timers.o ${OBJ}/tg-mime-types.o ${OBJ}/mtproto-utils.o +TGL_OBJECTS=${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/tgl.o ${OBJ}/updates.o ${OBJ}/tgl-net.o ${OBJ}/tgl-timers.o ${OBJ}/tg-mime-types.o ${OBJ}/mtproto-utils.o + +TGL_OBJECTS_AUTO=${OBJ}/auto/auto-skip.o ${OBJ}/auto/auto-fetch.o ${OBJ}/auto/auto-store.o ${OBJ}/auto/auto-autocomplete.o ${OBJ}/auto/auto-types.o ${OBJ}/auto/auto-fetch-ds.o ${OBJ}/auto/auto-free-ds.o ${OBJ}/auto/auto-store-ds.o + + TLD_OBJECTS=${OBJ}/dump-tl-file.o GENERATE_OBJECTS=${OBJ}/generate.o TGL_COMMON_OBJECTS=${OBJ}/tools.o @@ -10,15 +14,18 @@ TGL_OBJ_C=${GENERATE_OBJECTS} ${TGL_COMMON_OBJECTS} ${TGL_OBJECTS} ${TLD_OBJECTS dump-tl: ${EXE}/dump-tl-file -${OBJ}/auto/auto.o ${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-header.h +${TGL_OBJECTS}: ${AUTO}/constants.h ${AUTO}/auto-skip.h ${AUTO}/auto-fetch.h ${AUTO}/auto-store.h ${AUTO}/auto-autocomplete.h ${AUTO}/auto-types.h ${AUTO}/auto-fetch-ds.h ${AUTO}/auto-free-ds.h ${AUTO}/auto-store-ds.h ${TGL_OBJ_C}: ${OBJ}/%.o: ${srcdir}/tgl/%.c | create_dirs ${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $< -${OBJ}/auto/auto.o: ${AUTO}/auto.c - ${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/auto/auto.d -MQ ${OBJ}/auto/auto.o -o $@ $< +${TGL_OBJECTS_AUTO}: ${OBJ}/auto/%.o: ${AUTO}/%.c | create_dirs + ${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $< -${LIB}/libtgl.a: ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${OBJ}/auto/auto.o +#${OBJ}/auto/auto.o: ${AUTO}/auto.c +# ${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/auto/auto.d -MQ ${OBJ}/auto/auto.o -o $@ $< + +${LIB}/libtgl.a: ${TGL_OBJECTS} ${TGL_COMMON_OBJECTS} ${TGL_OBJECTS_AUTO} ar ruv $@ $^ ${EXE}/generate: ${GENERATE_OBJECTS} ${TGL_COMMON_OBJECTS} @@ -33,11 +40,11 @@ ${AUTO}/scheme.tl: ${srcdir}/tgl/scheme.tl ${srcdir}/tgl/encrypted_scheme.tl ${s ${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tl-parser ${EXE}/tl-parser -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false ) -${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate - ${EXE}/generate ${AUTO}/scheme.tlo > $@ +${AUTO}/auto-%.c: ${AUTO}/scheme.tlo ${EXE}/generate auto/constants.h ${AUTO}/auto-%.h | create_dirs_and_headers + ${EXE}/generate ${AUTO}/scheme.tlo -g $(patsubst ${AUTO}/auto-%.c,%,$@) > $@ || rm $@ -${AUTO}/auto-header.h: ${AUTO}/scheme.tlo ${EXE}/generate - ${EXE}/generate -H ${AUTO}/scheme.tlo > $@ +${AUTO}/auto-%.h: ${AUTO}/scheme.tlo ${EXE}/generate + ${EXE}/generate ${AUTO}/scheme.tlo -g $(patsubst ${AUTO}/auto-%.h,%-header,$@) > $@ || rm $@ ${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/tgl/gen_constants_h.awk awk -f ${srcdir}/tgl/gen_constants_h.awk < $< > $@ diff --git a/main.c b/main.c index 8fe7da1..4caf4ef 100644 --- a/main.c +++ b/main.c @@ -583,7 +583,7 @@ char *unix_socket; void args_parse (int argc, char **argv) { TLS = tgl_state_alloc (); int opt = 0; - while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:I6" + while ((opt = getopt (argc, argv, "u:hk:vNl:fEwWCRdL:DU:G:qP:S:e:I6g" #ifdef HAVE_LIBCONFIG "c:p:" #else @@ -595,6 +595,9 @@ void args_parse (int argc, char **argv) { )) != -1) { switch (opt) { + case 'g': + tgl_allocator = &tgl_allocator_debug; + break; case 'u': set_default_username (optarg); break; diff --git a/tgl b/tgl index 76824c2..d43fea2 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 76824c29a6dcb424e1109e691d31280a9cbaa954 +Subproject commit d43fea298fa944ae261de39e7680548ae25a9cd0