Skip to content

Commit

Permalink
add make install and make uninstall in f-tack's lib and tools, re…
Browse files Browse the repository at this point in the history
  • Loading branch information
jfb8856606 committed Jul 1, 2019
1 parent fdf61a3 commit 5af6625
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ lib/vnode_if_newproto.h
lib/vnode_if_typedef.h
app/nginx-1.11.10/objs/
app/nginx-1.11.10/Makefile
app/nginx-1.16.0/objs/
app/nginx-1.16.0/Makefile
dpdk/.ci/
dpdk/.travis.yml
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Currently, besides authorized DNS server of DNSPod, there are various products i
ifconfig eth0 down
python dpdk-devbind.py --bind=igb_uio eth0 # assuming that use 10GE NIC and eth0

# install DPDK
cd ../x86_64-native-linuxapp-gcc
make install

# On Ubuntu, use gawk instead of the default mawk.
#sudo apt-get install gawk # or execute `sudo update-alternatives --config awk` to choose gawk.

Expand All @@ -75,6 +79,13 @@ Currently, besides authorized DNS server of DNSPod, there are various products i
cd ../../lib/
make

# install F-STACK
# libfstack.a will be installed to /usr/local/lib
# ff_*.h will be installed to /usr/local/include
# start.sh will be installed to /usr/local/bin/ff_start
# config.ini will be installed to /etc/f-stack.conf
make install

#### Nginx

cd app/nginx-1.11.10
Expand Down
6 changes: 4 additions & 2 deletions app/micro_thread/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
########MAKEFILE##########

ifeq ($(FF_PATH),)
$(error variable FF_PATH is not set)
FF_PATH=/usr/local
$(warning FF_PATH environment variable not defined, default FF_PATH=/usr/local)
endif

ifeq ($(FF_DPDK),)
FF_DPDK= $(FF_PATH)/dpdk/x86_64-native-linuxapp-gcc
FF_DPDK=/usr/local
$(warning FF_DPDK environment variable not defined, default FF_DPDK=/usr/local)
endif

DEBUG= -g
Expand Down
8 changes: 4 additions & 4 deletions app/nginx-1.11.10/auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`


if [ ! $FF_PATH ]; then
echo "Please define FF_PATH environment variable"
exit 1
FF_PATH=/usr/local
echo "FF_PATH environment variable not defined, default FF_PATH=$FF_PATH"
fi

if [ ! $FF_DPDK ]; then
FF_DPDK=$FF_PATH/dpdk/x86_64-native-linuxapp-gcc
echo "FF_DPDK environment variable not defined, default:$FF_DPDK"
FF_DPDK=/usr/local
echo "FF_DPDK environment variable not defined, default FF_DPDK=$FF_DPDK"
fi

CORE_LIBS="$CORE_LIBS -L$FF_PATH/lib -Wl,--whole-archive,-lfstack,--no-whole-archive"
Expand Down
8 changes: 4 additions & 4 deletions app/nginx-1.16.0/auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`


if [ ! $FF_PATH ]; then
echo "Please define FF_PATH environment variable"
exit 1
FF_PATH=/usr/local
echo "FF_PATH environment variable not defined, default FF_PATH=$FF_PATH"
fi

if [ ! $FF_DPDK ]; then
FF_DPDK=$FF_PATH/dpdk/x86_64-native-linuxapp-gcc
echo "FF_DPDK environment variable not defined, default:$FF_DPDK"
FF_DPDK=/usr/local
echo "FF_DPDK environment variable not defined, default FF_DPDK=$FF_DPDK"
fi

CORE_LIBS="$CORE_LIBS -L$FF_PATH/lib -Wl,--whole-archive,-lfstack,--no-whole-archive"
Expand Down
7 changes: 5 additions & 2 deletions app/redis-3.2.8/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# Just use 'make dep', but this is only needed by developers.

ifeq ($(FF_PATH),)
$(error variable FF_PATH is not set)
FF_PATH=/usr/local
$(warning FF_PATH environment variable not defined, default FF_PATH=/usr/local)
endif

ifeq ($(FF_DPDK),)
FF_DPDK= $(FF_PATH)/dpdk/x86_64-native-linuxapp-gcc
FF_DPDK=/usr/local
$(warning FF_DPDK environment variable not defined, default FF_DPDK=/usr/local)
endif

release_hdr := $(shell sh -c './mkreleasehdr.sh')
Expand Down
37 changes: 37 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ S=${TOPDIR}/freebsd
MACHINE_INCLUDES_ROOT:=${CURDIR}/machine_include
OVERRIDE_INCLUDES_ROOT:=${CURDIR}/include
X86_INCLUDES=0
PREFIX=/usr/local
PREFIX_LIB=${PREFIX}/lib
PREFIX_INCLUDE=/usr/local/include
PREFIX_BIN=/usr/local/bin
F-STACK_CONF=/etc/f-stack.conf
F-STACK_VERSION=1.20

HOST_OS:=$(shell uname -s)

Expand Down Expand Up @@ -590,3 +596,34 @@ vnode_if_typedef.h:

include ${TOPDIR}/mk/kern.mk

install:
rm -rf ${PREFIX_LIB}/libfstack.a.${F-STACK_VERSION}
rm -rf ${PREFIX_LIB}/libfstack.a
rm -rf ${PREFIX_INCLUDE}/ff_config.h
rm -rf ${PREFIX_INCLUDE}/ff_api.h
rm -rf ${PREFIX_INCLUDE}/ff_event.h
rm -rf ${PREFIX_INCLUDE}/ff_errno.h
rm -rf ${PREFIX_INCLUDE}/ff_epoll.h
rm -rf ${PREFIX_BIN}/ff_start

cp -f libfstack.a ${PREFIX_LIB}/libfstack.a.${F-STACK_VERSION}
ln -sf ${PREFIX_LIB}/libfstack.a.${F-STACK_VERSION} ${PREFIX_LIB}/libfstack.a
cp -f ff_config.h ${PREFIX_INCLUDE}/ff_config.h
cp -f ff_api.h ${PREFIX_INCLUDE}/ff_api.h
cp -f ff_event.h ${PREFIX_INCLUDE}/ff_event.h
cp -f ff_errno.h ${PREFIX_INCLUDE}/ff_errno.h
cp -f ff_epoll.h ${PREFIX_INCLUDE}/ff_epoll.h
cp -f ${TOPDIR}/start.sh ${PREFIX_BIN}/ff_start
test -f '${F-STACK_CONF}' || cp -f ${TOPDIR}/config.ini ${F-STACK_CONF}

uninstall:
rm -rf ${PREFIX_LIB}/libfstack.a.${F-STACK_VERSION}
rm -rf ${PREFIX_LIB}/libfstack.a
rm -rf ${PREFIX_INCLUDE}/ff_config.h
rm -rf ${PREFIX_INCLUDE}/ff_api.h
rm -rf ${PREFIX_INCLUDE}/ff_event.h
rm -rf ${PREFIX_INCLUDE}/ff_errno.h
rm -rf ${PREFIX_INCLUDE}/ff_epoll.h
rm -rf ${PREFIX_BIN}/ff_start
rm -rf ${F-STACK_CONF}

19 changes: 19 additions & 0 deletions tools/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
SUBDIRS=compat libutil libmemstat libxo libnetgraph sysctl ifconfig route top netstat ngctl ipfw arp traffic
PREFIX_BIN=/usr/local/bin

all:
for d in $(SUBDIRS); do ( cd $$d; $(MAKE) all ) ; done

clean:
for d in $(SUBDIRS); do ( cd $$d; $(MAKE) clean ) ; done

install:
rm -rf ${PREFIX_BIN}/f-stack

cp -rf sbin/ ${PREFIX_BIN}/f-stack
ln -sf ${PREFIX_BIN}/f-stack/arp ${PREFIX_BIN}/ff_arp
ln -sf ${PREFIX_BIN}/f-stack/ifconfig ${PREFIX_BIN}/ff_ifconfig
ln -sf ${PREFIX_BIN}/f-stack/ipfw ${PREFIX_BIN}/ff_ipfw
ln -sf ${PREFIX_BIN}/f-stack/netstat ${PREFIX_BIN}/ff_netstat
ln -sf ${PREFIX_BIN}/f-stack/ngctl ${PREFIX_BIN}/ff_ngctl
ln -sf ${PREFIX_BIN}/f-stack/route ${PREFIX_BIN}/ff_route
ln -sf ${PREFIX_BIN}/f-stack/sysctl ${PREFIX_BIN}/ff_sysctl
ln -sf ${PREFIX_BIN}/f-stack/top ${PREFIX_BIN}/ff_top
ln -sf ${PREFIX_BIN}/f-stack/traffic ${PREFIX_BIN}/ff_traffic

uninstall:
rm -rf ${PREFIX_BIN}/f-stack
rm -rf ${PREFIX_BIN}/ff_*
8 changes: 8 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Introduction

Compile ff tools

make

Install ff tools, all ff tools will be installed to `/usr/local/bin/f-stack/`, and some soft link will be created in `/usr/local/bin`, such as `ff_top`,`ff_traffic`, etc.

make install

Directory `compat` implements an ipc library using dpdk `rte_ring` and ports some source files compatible with FreeBSD and Linux.

Directory `sbin` contains all the tools binary that compiled.
Expand Down

0 comments on commit 5af6625

Please sign in to comment.