49 lines
1.1 KiB
Makefile
49 lines
1.1 KiB
Makefile
|
srcdir=./tl-parser
|
||
|
|
||
|
CFLAGS=-g -O2
|
||
|
LDFLAGS=
|
||
|
CPPFLAGS=
|
||
|
COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC
|
||
|
|
||
|
EXTRA_LIBS=-lz
|
||
|
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}
|
||
|
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
|
||
|
|
||
|
DEP=dep
|
||
|
EXE=bin
|
||
|
OBJ=objs
|
||
|
DIR_LIST=${DEP} ${EXE} ${OBJ}
|
||
|
|
||
|
EXE_LIST=${EXE}/tl-parser
|
||
|
|
||
|
OBJECTS=${OBJ}/tl-parser.o ${OBJ}/tlc.o
|
||
|
|
||
|
DEPENDENCE=$(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJECTS}))
|
||
|
DEPENDENCE_LIST=${DEPENDENCE}
|
||
|
|
||
|
INCLUDE=-I. -I${srcdir}
|
||
|
CC=gcc
|
||
|
|
||
|
.SUFFIXES:
|
||
|
|
||
|
.SUFFIXES: .c .h .o
|
||
|
|
||
|
all: ${EXE_LIST} ${DIR_LIST} ${LIB_LIST}
|
||
|
create_dirs_and_headers: ${DIR_LIST}
|
||
|
create_dirs: ${DIR_LIST}
|
||
|
|
||
|
${DIR_LIST}:
|
||
|
@test -d $@ || mkdir -p $@
|
||
|
|
||
|
-include ${DEPENDENCE_LIST}
|
||
|
|
||
|
${OBJECTS}: ${OBJ}/%.o: ${srcdir}/%.c | create_dirs_and_headers
|
||
|
${CC} ${INCLUDE} ${COMPILE_FLAGS} -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
||
|
|
||
|
${EXE}/tl-parser: ${OBJECTS}
|
||
|
${CC} $^ ${LINK_FLAGS} -o $@
|
||
|
|
||
|
clean:
|
||
|
rm -rf ${DIR_LIST} config.log config.status > /dev/null || echo "all clean"
|
||
|
|