many fixes

This commit is contained in:
vvaltman 2015-04-16 16:42:44 +03:00
parent 01f5d9a3b6
commit 67ec7aa4b3
4 changed files with 24 additions and 14 deletions

View File

@ -21,7 +21,7 @@ EXE_LIST=${EXE}/telegram-cli
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/lua-tg.o 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@ CC=@CC@
.SUFFIXES: .SUFFIXES:
@ -29,7 +29,7 @@ CC=@CC@
.SUFFIXES: .c .h .o .SUFFIXES: .c .h .o
all: ${EXE_LIST} ${DIR_LIST} 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} create_dirs: ${DIR_LIST}
dump-tl: ${EXE}/dump-tl-file dump-tl: ${EXE}/dump-tl-file
@ -39,7 +39,7 @@ include ${srcdir}/Makefile.tgl
${DIR_LIST}: ${DIR_LIST}:
@test -d $@ || mkdir -p $@ @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=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_LIST}))
DEPENDENCE_LIST=${DEPENDENCE} DEPENDENCE_LIST=${DEPENDENCE}

View File

@ -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 TLD_OBJECTS=${OBJ}/dump-tl-file.o
GENERATE_OBJECTS=${OBJ}/generate.o GENERATE_OBJECTS=${OBJ}/generate.o
TGL_COMMON_OBJECTS=${OBJ}/tools.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 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 ${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 $@ $< ${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
${OBJ}/auto/auto.o: ${AUTO}/auto.c ${TGL_OBJECTS_AUTO}: ${OBJ}/auto/%.o: ${AUTO}/%.c | create_dirs
${CC} ${INCLUDE} ${COMPILE_FLAGS} -iquote ${srcdir}/tgl -c -MP -MD -MF ${DEP}/auto/auto.d -MQ ${OBJ}/auto/auto.o -o $@ $< ${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 $@ $^ ar ruv $@ $^
${EXE}/generate: ${GENERATE_OBJECTS} ${TGL_COMMON_OBJECTS} ${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 ${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tl-parser
${EXE}/tl-parser -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false ) ${EXE}/tl-parser -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false )
${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate ${AUTO}/auto-%.c: ${AUTO}/scheme.tlo ${EXE}/generate auto/constants.h ${AUTO}/auto-%.h | create_dirs_and_headers
${EXE}/generate ${AUTO}/scheme.tlo > $@ ${EXE}/generate ${AUTO}/scheme.tlo -g $(patsubst ${AUTO}/auto-%.c,%,$@) > $@ || rm $@
${AUTO}/auto-header.h: ${AUTO}/scheme.tlo ${EXE}/generate ${AUTO}/auto-%.h: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate -H ${AUTO}/scheme.tlo > $@ ${EXE}/generate ${AUTO}/scheme.tlo -g $(patsubst ${AUTO}/auto-%.h,%-header,$@) > $@ || rm $@
${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/tgl/gen_constants_h.awk ${AUTO}/constants.h: ${AUTO}/scheme2.tl ${srcdir}/tgl/gen_constants_h.awk
awk -f ${srcdir}/tgl/gen_constants_h.awk < $< > $@ awk -f ${srcdir}/tgl/gen_constants_h.awk < $< > $@

5
main.c
View File

@ -583,7 +583,7 @@ char *unix_socket;
void args_parse (int argc, char **argv) { void args_parse (int argc, char **argv) {
TLS = tgl_state_alloc (); TLS = tgl_state_alloc ();
int opt = 0; 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 #ifdef HAVE_LIBCONFIG
"c:p:" "c:p:"
#else #else
@ -595,6 +595,9 @@ void args_parse (int argc, char **argv) {
)) != -1) { )) != -1) {
switch (opt) { switch (opt) {
case 'g':
tgl_allocator = &tgl_allocator_debug;
break;
case 'u': case 'u':
set_default_username (optarg); set_default_username (optarg);
break; break;

2
tgl

@ -1 +1 @@
Subproject commit 76824c29a6dcb424e1109e691d31280a9cbaa954 Subproject commit d43fea298fa944ae261de39e7680548ae25a9cd0