Skip to content

Commit

Permalink
Fix makefiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Feb 12, 2018
1 parent ea9b02e commit 82c073b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 63 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,5 @@ ip6/applications/bin/

*.cmd

*.d
*.d
ip6/applications/dpdk/
29 changes: 18 additions & 11 deletions includes/setup_includes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ if [[ $DPDK ]]; then
while true;
do
read -r -p "Please specify the interface to bind to:" iface
ifconfig $iface > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "Initializing the DPDK..."
break;
if [[ $iface ]]; then
ifconfig $iface > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "Initializing the DPDK..."
break;
else
echo "Device not found, please retry..."
fi
else
echo "Device not found, please retry..."
echo "Not binding to an interface."
break;
fi
done
git submodule update --init dpdk
Expand All @@ -58,14 +63,16 @@ if [[ $DPDK ]]; then
echo 0 > /proc/sys/kernel/randomize_va_space
modprobe uio
insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
ifconfig enp66s0f0 down
usertools/dpdk-devbind.py --bind=igb_uio enp66s0f0
if [[ $iface ]]; then
ifconfig $iface down
usertools/dpdk-devbind.py --bind=igb_uio $iface
fi
cd ..
else
git submodule update mininet
git submodule update p4
git submodule update nanomsg
git submodule update thrift
git submodule update --init mininet
git submodule update --init p4
git submodule update --init nanomsg
git submodule update --init thrift

##### Optional Installs
sudo apt-get install -y bison
Expand Down
15 changes: 7 additions & 8 deletions ip6/default.mk
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MAKE_ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
srcExt = c
srcDir = $(ROOT_DIR)/applications
srcDir = $(MAKE_ROOT)/applications
objDir = $(srcDir)/obj
binDir = $(srcDir)/bin
libDir = $(ROOT_DIR)/lib
app := server testing rmem_test busexmp
libDir = $(MAKE_ROOT)/lib

# a list of c files we do not want to compile
filter:= $(libDir)/dpdkstack.c

sources := $(shell find "$(libDir)" -name '*.$(srcExt)')
sources_filtered := $(filter-out $(filter), $(sources))
srcDirs := $(shell find . -name '*.$(srcExt)' -exec dirname {} \; | uniq)
objects := $(patsubst $(ROOT_DIR)/%.$(srcExt), $(objDir)/%.o, $(sources_filtered))
objects := $(patsubst $(MAKE_ROOT)/%.$(srcExt), $(objDir)/%.o, $(sources_filtered))

all: $(app)
all: $(apps)
-rm -r $(objDir)

$(app): % : $(binDir)/%
$(apps): % : $(binDir)/%


$(binDir)/%: buildrepo $(objects)
Expand All @@ -27,7 +26,7 @@ $(binDir)/%: buildrepo $(objects)

$(objDir)/%.o: %.$(srcExt)
@echo "Building $@ ... "
@$(CC) $(CFLAGS) $(ROOT_DIR)/$< -o $@
@$(CC) $(CFLAGS) $(MAKE_ROOT)/$< -o $@

clean:
@echo "Cleaning..."
Expand Down
34 changes: 6 additions & 28 deletions ip6/dpdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,14 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MAKE_ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
srcExt = c
srcDir = $(ROOT_DIR)/applications
objDir = $(srcDir)/obj
binDir = $(srcDir)/bin
libDir = $(ROOT_DIR)/lib
app := server testing test_rmem
#userfaultfd_measure_pagefault dsm_wc rmem_test

srcDir = $(MAKE_ROOT)/applications
libDir = $(MAKE_ROOT)/lib
sources := $(shell find "$(libDir)" -name '*.$(srcExt)')

RTE_SDK=$(ROOT_DIR)/../includes/dpdk

RTE_SDK=$(MAKE_ROOT)/../includes/dpdk
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
Expand All @@ -48,25 +44,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc

include $(RTE_SDK)/mk/rte.vars.mk

# binary name
APP = testing

COMMON_DIR = ../../common

# all source are stored in SRCS-y
SRCS-y := ${srcDir}/testing.c ${sources}

#CFLAGS += -O0
#CFLAGS += -O3
#CFLAGS += -g
#CFLAGS += -DPRIVATE_COUNTER
#CFLAGS += -DSHARED_COUNTER
#CFLAGS += -DSHARED_LOCK
#CFLAGS += -DUDP_DBG
#CFLAGS += -DTHROTTLE_TX
#CFLAGS += $(WERROR_FLAGS)
CFLAGS += -Wno-unused-parameter

CFLAGS += -I${COMMON_DIR}
SRCS-y := ${srcDir}/${APP}.c ${sources}

include $(RTE_SDK)/mk/rte.extapp.mk
34 changes: 19 additions & 15 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
MAKE_DIR = $(PWD)
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MSG_DIR := $(ROOT_DIR)/ip6/
MAKE_ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
MSG_DIR := $(MAKE_ROOT)/ip6/

CC = gcc
CFLAGS += -c -Wextra -Wall -Wall -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS += -std=gnu11 -pedantic
CFGLAS += -oFast # performance flags
CFLAGS += -DRAW_SOCK
# CFLAGS += -Wstrict-prototypes -Wmissing-prototypes

LDFLAGS := -lpcap -pthread -lm -lrt

export MAKE_DIR CC CFLAGS LDFLAGS
apps := server testing rmem_test busexmp

export apps CC CFLAGS LDFLAGS
all:
@echo $(ROOT_DIR)
@rm -rf $(ROOT_DIR)/ip6/build
@echo $(MAKE_ROOT)
@rm -rf $(MAKE_ROOT)/ip6/build
@$(MAKE) -C $(MSG_DIR) -f default.mk
@find $(ROOT_DIR)/ip6/ -name '*.o*' -delete
@find $(MAKE_ROOT)/ip6/ -name '*.o*' -delete

dpdk: $(apps)
@find $(MAKE_ROOT)/ip6/ -name '*.o*' -delete
@rm -rf $(MAKE_ROOT)/ip6/build

$(apps):
# binary name
$(MAKE) -C $(MSG_DIR) -f dpdk.mk O=applications/dpdk/ APP=$@
@find $(MAKE_ROOT)/ip6/ -name '*.o*' -delete

dpdk:
@find $(ROOT_DIR)/ip6/ -name '*.o*' -delete
@rm -rf $(ROOT_DIR)/ip6/build
@$(MAKE) -C $(MSG_DIR) -f dpdk.mk
@find $(ROOT_DIR)/ip6/ -name '*.o*' -delete

.PHONY: clean dpdk
clean:
@$(MAKE) -C $(MSG_DIR) clean
@find $(ROOT_DIR)/ip6/ -name '*.o*' -delete
@rm -rf $(ROOT_DIR)/ip6/build
@find $(MAKE_ROOT)/ip6/ -name '*.o*' -delete
@rm -rf $(MAKE_ROOT)/ip6/build

0 comments on commit 82c073b

Please sign in to comment.