2021-09-30 11:34:02 +00:00
|
|
|
# # Derived from FreeBSD src/share/mk/bsd.prog.mk
|
2017-05-23 15:13:49 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-02-05 08:42:07 +00:00
|
|
|
ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
|
|
|
|
$(error "no installation of DPDK found, maybe you shuld export environment variable `PKG_CONFIG_PATH`")
|
|
|
|
endif
|
|
|
|
|
2017-05-23 15:13:49 +00:00
|
|
|
ifndef SRCS
|
|
|
|
ifdef PROG_CXX
|
|
|
|
SRCS= ${PROG}.cc
|
|
|
|
else
|
|
|
|
SRCS= ${PROG}.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-08-17 13:16:23 +00:00
|
|
|
PROGDIR= ${TOPDIR}/tools/sbin
|
|
|
|
|
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
|
|
|
|
2021-02-05 08:42:07 +00:00
|
|
|
PKGCONF ?= pkg-config
|
2017-05-23 15:13:49 +00:00
|
|
|
|
2021-02-05 08:42:07 +00:00
|
|
|
FF_PROG_CFLAGS:= -g -Wall -Werror -DFSTACK -std=gnu99 $(shell $(PKGCONF) --cflags libdpdk)
|
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
|
2021-09-30 11:34:02 +00:00
|
|
|
FF_PROG_CFLAGS+= -I${TOPDIR}/tools/libxo
|
2017-05-23 15:13:49 +00:00
|
|
|
|
2018-05-15 09:49:22 +00:00
|
|
|
FF_PROG_LIBS:= -L${TOPDIR}/tools/compat -Wl,--whole-archive,-lffcompat,--no-whole-archive
|
2021-02-05 08:42:07 +00:00
|
|
|
FF_PROG_LIBS+= $(shell $(PKGCONF) --static --libs libdpdk)
|
2018-05-15 09:49:22 +00:00
|
|
|
FF_PROG_LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -lpthread -lnuma
|
2017-05-23 15:13:49 +00:00
|
|
|
|
2017-11-14 08:34:53 +00:00
|
|
|
CFLAGS+= -Wno-unused-but-set-variable -Wno-unused-variable
|
2017-05-23 15:13:49 +00:00
|
|
|
CFLAGS+= ${FF_PROG_CFLAGS}
|
|
|
|
CXXFLAGS+= ${FF_PROG_CFLAGS}
|
|
|
|
|
2017-11-01 09:38:22 +00:00
|
|
|
CFLAGS+= $(foreach n,${LIBADD},-I${TOPDIR}/tools/lib${n})
|
|
|
|
LIBS+= $(foreach n,${LIBADD},-L${TOPDIR}/tools/lib${n} -l${n})
|
|
|
|
|
2021-02-05 08:42:07 +00:00
|
|
|
LIBS+= ${FF_PROG_LIBS}
|
|
|
|
|
2018-08-17 13:16:23 +00:00
|
|
|
CLEANFILES+= ${PROGDIR}/${PROG} ${OBJS}
|
2017-06-14 07:25:35 +00:00
|
|
|
|
|
|
|
${PROG}: ${HEADERS} ${OBJS}
|
2017-05-23 15:13:49 +00:00
|
|
|
ifdef PROG_CXX
|
2018-08-17 13:16:23 +00:00
|
|
|
${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS}
|
2017-05-23 15:13:49 +00:00
|
|
|
else
|
2018-08-17 13:16:23 +00:00
|
|
|
${CC} ${CFLAGS} ${LDFLAGS} -o ${PROGDIR}/${PROG} ${OBJS} ${LIBS}
|
2017-05-23 15:13:49 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
clean:
|
2017-06-14 07:25:35 +00:00
|
|
|
@rm -f ${CLEANFILES}
|
2017-05-23 15:13:49 +00:00
|
|
|
|
|
|
|
all: ${PROG}
|