tg/Makefile.in
2014-08-13 01:22:15 +00:00

83 lines
2.6 KiB
Makefile

srcdir=@srcdir@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
DEP=${srcdir}/dep
AUTO=${srcdir}/auto
EXE=${srcdir}/bin
OBJ=${srcdir}/objs
DIR_LIST=${DEP} ${AUTO} ${EXE} ${OBJ} ${DEP}/auto ${OBJ}/auto
EXE_LIST=${EXE}/generate ${EXE}/tlc ${EXE}/telegram-cli
TG_OBJECTS=${OBJ}/main.o ${OBJ}/loop.o ${OBJ}/interface.o ${OBJ}/net.o ${OBJ}/mtproto-common.o ${OBJ}/mtproto-client.o ${OBJ}/queries.o ${OBJ}/structures.o ${OBJ}/binlog.o ${OBJ}/lua-tg.o ${OBJ}/auto/auto.o
TLC_OBJECTS=${OBJ}/tlc.o ${OBJ}/tl-parser.o ${OBJ}/crc32.o
GENERATE_OBJECTS=${OBJ}/generate.o
COMMON_OBJECTS=${OBJ}/tools.o
OBJ_LIST=${TG_OBJECTS} ${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
OBJ_C=${TLC_OBJECTS} ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJ_LIST}))
DEPENDENCE_LIST=${DEPENDENCE}
INCLUDE=-I. -I${srcdir}
CC=@CC@
.SUFFIXES:
.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: ${DIR_LIST}
${DIR_LIST}:
@test -d $@ || mkdir -p $@
-include ${DEPENDENCE_LIST}
${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 $@ $<
${EXE}/tlc: ${TLC_OBJECTS} ${COMMON_OBJECTS}
${CC} ${TLC_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
${EXE}/telegram-cli: ${TG_OBJECTS} ${COMMON_OBJECTS}
${CC} ${TG_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
${EXE}/generate: ${GENERATE_OBJECTS} ${COMMON_OBJECTS}
${CC} ${GENERATE_OBJECTS} ${COMMON_OBJECTS} ${LINK_FLAGS} -o $@
${AUTO}/scheme.tlo: ${AUTO}/scheme.tl ${EXE}/tlc
${EXE}/tlc -e $@ ${AUTO}/scheme.tl
${AUTO}/scheme.tl: ${srcdir}/scheme.tl ${srcdir}/binlog.tl ${srcdir}/append.tl
cat $^ > $@
${AUTO}/scheme2.tl: ${AUTO}/scheme.tl ${EXE}/tlc
${EXE}/tlc -E ${AUTO}/scheme.tl 2> $@ || ( cat $@ && rm $@ && false )
${AUTO}/auto.c: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate ${AUTO}/scheme.tlo > $@
${AUTO}/auto-header.h: ${AUTO}/scheme.tlo ${EXE}/generate
${EXE}/generate -H ${AUTO}/scheme.tlo > $@
${AUTO}/constants.h: ${AUTO}/scheme2.tl
awk -f ${srcdir}/gen_constants_h.awk < $^ > $@
clean:
rm -rf ${DIR_LIST} config.log config.status > /dev/null || echo "all clean"