2017-05-23 15:13:49 +00:00
|
|
|
#
|
|
|
|
# Derived from FreeBSD src/share/mk/bsd.prog.mk
|
|
|
|
#
|
|
|
|
|
|
|
|
ifdef DEBUG_FLAGS
|
|
|
|
CFLAGS+=${DEBUG_FLAGS}
|
|
|
|
CXXFLAGS+=${DEBUG_FLAGS}
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef NO_SHARED
|
|
|
|
ifneq (${NO_SHARED},no)
|
|
|
|
ifneq (${NO_SHARED},NO)
|
|
|
|
LDFLAGS+= -static
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef PROG_CXX
|
|
|
|
PROG= ${PROG_CXX}
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef PROG
|
|
|
|
$(error PROG or PROG_CXX must be defined.)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef TOPDIR
|
|
|
|
$(error TOPDIR must be defined.)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef SRCS
|
|
|
|
ifdef PROG_CXX
|
|
|
|
SRCS= ${PROG}.cc
|
|
|
|
else
|
|
|
|
SRCS= ${PROG}.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-06-14 07:25:35 +00:00
|
|
|
HEADERS+= $(filter %.h,${SRCS})
|
|
|
|
OBJS+= $(patsubst %.c,%.o, $(filter %.c,${SRCS}))
|
|
|
|
OBJS+= $(patsubst %.cc,%.o, $(filter %.cc,${SRCS}))
|
2017-05-23 15:13:49 +00:00
|
|
|
|
|
|
|
ifeq ($(FF_DPDK),)
|
|
|
|
FF_DPDK=${TOPDIR}/dpdk/x86_64-native-linuxapp-gcc
|
|
|
|
endif
|
|
|
|
|
2017-05-26 19:29:29 +00:00
|
|
|
FF_PROG_CFLAGS:= -g -Wall -Werror -DFSTACK -std=gnu99
|
2017-06-06 08:52:52 +00:00
|
|
|
FF_PROG_CFLAGS+= -I${TOPDIR}/lib -I${TOPDIR}/tools/compat
|
2017-08-31 13:34:50 +00:00
|
|
|
FF_PROG_CFLAGS+= -include${TOPDIR}/tools/compat/compat.h
|
2017-06-06 08:52:52 +00:00
|
|
|
FF_PROG_CFLAGS+= -I${TOPDIR}/tools/compat/include -D__BSD_VISIBLE
|
2017-05-23 15:13:49 +00:00
|
|
|
FF_PROG_CFLAGS+= -include ${FF_DPDK}/include/rte_config.h
|
|
|
|
FF_PROG_CFLAGS+= -I${FF_DPDK}/include
|
|
|
|
|
2017-06-06 08:52:52 +00:00
|
|
|
FF_PROG_LIBS:= -L${TOPDIR}/tools/compat -Wl,--whole-archive -lffcompat
|
|
|
|
FF_PROG_LIBS+= -Wl,--no-whole-archive -L${FF_DPDK}/lib
|
|
|
|
FF_PROG_LIBS+= -Wl,--whole-archive -lrte_eal -lrte_mempool -lrte_ring
|
|
|
|
FF_PROG_LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -pthread
|
2017-05-23 15:13:49 +00:00
|
|
|
|
|
|
|
CFLAGS+= ${FF_PROG_CFLAGS}
|
|
|
|
CXXFLAGS+= ${FF_PROG_CFLAGS}
|
|
|
|
|
|
|
|
LIBS+= ${FF_PROG_LIBS}
|
|
|
|
|
2017-06-14 07:25:35 +00:00
|
|
|
CLEANFILES+= ${PROG} ${OBJS}
|
|
|
|
|
|
|
|
${PROG}: ${HEADERS} ${OBJS}
|
2017-05-23 15:13:49 +00:00
|
|
|
ifdef PROG_CXX
|
|
|
|
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
|
|
|
|
else
|
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
|
|
|
|
endif
|
|
|
|
|
|
|
|
clean:
|
2017-06-14 07:25:35 +00:00
|
|
|
@rm -f ${CLEANFILES}
|
2017-05-23 15:13:49 +00:00
|
|
|
|
|
|
|
all: ${PROG}
|