diff options
Diffstat (limited to 'src/spdk/dpdk/mk')
70 files changed, 4109 insertions, 0 deletions
diff --git a/src/spdk/dpdk/mk/arch/arm/rte.vars.mk b/src/spdk/dpdk/mk/arch/arm/rte.vars.mk new file mode 100644 index 00000000..27b11476 --- /dev/null +++ b/src/spdk/dpdk/mk/arch/arm/rte.vars.mk @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C) 2015 RehiveTech. All rights reserved. + +ARCH ?= arm +CROSS ?= + +CPU_CFLAGS ?= -marm -munaligned-access +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= -felf + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf32-littlearm +RTE_OBJCOPY_ARCH = arm + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/arch/arm64/rte.vars.mk b/src/spdk/dpdk/mk/arch/arm64/rte.vars.mk new file mode 100644 index 00000000..a75b80c2 --- /dev/null +++ b/src/spdk/dpdk/mk/arch/arm64/rte.vars.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2015 Cavium, Inc +# + +# +# arch: +# +# - define ARCH variable (overridden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overridden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - may override any previously defined variable +# +# examples for CONFIG_RTE_ARCH: i686, x86_64, x86_64_32 +# + +ARCH ?= arm64 +# common arch dir in eal headers +ARCH_DIR := arm +CROSS ?= + +CPU_CFLAGS ?= +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= -felf + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf64-littleaarch64 +RTE_OBJCOPY_ARCH = aarch64 + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/arch/i686/rte.vars.mk b/src/spdk/dpdk/mk/arch/i686/rte.vars.mk new file mode 100644 index 00000000..3f48f674 --- /dev/null +++ b/src/spdk/dpdk/mk/arch/i686/rte.vars.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# arch: +# +# - define ARCH variable (overridden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overridden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - may override any previously defined variable +# +# examples for CONFIG_RTE_ARCH: i686, x86_64, x86_64_32 +# + +ARCH ?= i386 +# common arch dir in eal headers +ARCH_DIR := x86 +CROSS ?= + +CPU_CFLAGS ?= -m32 +CPU_LDFLAGS ?= -melf_i386 +CPU_ASFLAGS ?= -felf + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf32-i386 +RTE_OBJCOPY_ARCH = i386 + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/arch/ppc_64/rte.vars.mk b/src/spdk/dpdk/mk/arch/ppc_64/rte.vars.mk new file mode 100644 index 00000000..ef3ba1dc --- /dev/null +++ b/src/spdk/dpdk/mk/arch/ppc_64/rte.vars.mk @@ -0,0 +1,44 @@ +# BSD LICENSE +# +# Copyright (C) IBM Corporation 2014. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of IBM Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# 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. + + +ARCH ?= powerpc +CROSS ?= + +CPU_CFLAGS ?= -m64 +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= -felf64 + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf64-powerpcle +RTE_OBJCOPY_ARCH = powerpc:common64 + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/arch/x86_64/rte.vars.mk b/src/spdk/dpdk/mk/arch/x86_64/rte.vars.mk new file mode 100644 index 00000000..e1689be9 --- /dev/null +++ b/src/spdk/dpdk/mk/arch/x86_64/rte.vars.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# arch: +# +# - define ARCH variable (overridden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overridden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - may override any previously defined variable +# +# examples for CONFIG_RTE_ARCH: i686, x86_64, x86_64_32 +# + +ARCH ?= x86_64 +# common arch dir in eal headers +ARCH_DIR := x86 +CROSS ?= + +CPU_CFLAGS ?= -m64 +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= -felf64 + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf64-x86-64 +RTE_OBJCOPY_ARCH = i386:x86-64 + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/arch/x86_x32/rte.vars.mk b/src/spdk/dpdk/mk/arch/x86_x32/rte.vars.mk new file mode 100644 index 00000000..c59b37a2 --- /dev/null +++ b/src/spdk/dpdk/mk/arch/x86_x32/rte.vars.mk @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# arch: +# +# - define ARCH variable (overridden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overridden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - may override any previously defined variable +# +# examples for CONFIG_RTE_ARCH: i686, x86_64, x86_64_32 +# + +ARCH ?= x86_64 +ARCH_DIR := x86 +CROSS ?= + +CPU_CFLAGS ?= -mx32 +CPU_LDFLAGS ?= -melf32_x86_64 +#CPU_ASFLAGS ?= -felf64 +# x32 is supported by Linux distribution with gcc4.8 and newer in some +# cases there is backported support in gcc4.6 +ifneq ($(shell echo | $(CC) $(CPU_CFLAGS) -E - 2>/dev/null 1>/dev/null && echo 0), 0) + $(error This version of GCC does not support x32 ABI) +endif + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS + +RTE_OBJCOPY_TARGET = elf32-x86-64 +RTE_OBJCOPY_ARCH = i386:x86-64 + +export RTE_OBJCOPY_TARGET RTE_OBJCOPY_ARCH diff --git a/src/spdk/dpdk/mk/exec-env/bsdapp/rte.app.mk b/src/spdk/dpdk/mk/exec-env/bsdapp/rte.app.mk new file mode 100644 index 00000000..a2af7266 --- /dev/null +++ b/src/spdk/dpdk/mk/exec-env/bsdapp/rte.app.mk @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +exec-env-appinstall: + @true + +exec-env-appclean: + @true diff --git a/src/spdk/dpdk/mk/exec-env/bsdapp/rte.vars.mk b/src/spdk/dpdk/mk/exec-env/bsdapp/rte.vars.mk new file mode 100644 index 00000000..cec08840 --- /dev/null +++ b/src/spdk/dpdk/mk/exec-env/bsdapp/rte.vars.mk @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# exec-env: +# +# - define EXECENV_CFLAGS variable (overridden by cmdline) +# - define EXECENV_LDFLAGS variable (overridden by cmdline) +# - define EXECENV_ASFLAGS variable (overridden by cmdline) +# - may override any previously defined variable +# +# examples for RTE_EXEC_ENV: linuxapp, bsdapp +# +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXECENV_CFLAGS = -pthread -fPIC +else +EXECENV_CFLAGS = -pthread +endif + +EXECENV_LDFLAGS = +EXECENV_LDLIBS = -lexecinfo +EXECENV_ASFLAGS = + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXECENV_LDLIBS += -lgcc_s +endif + +# force applications to link with gcc/icc instead of using ld +LINK_USING_CC := 1 + +BSDMAKE=/usr/bin/make + +export EXECENV_CFLAGS EXECENV_LDFLAGS EXECENV_ASFLAGS diff --git a/src/spdk/dpdk/mk/exec-env/linuxapp/rte.app.mk b/src/spdk/dpdk/mk/exec-env/linuxapp/rte.app.mk new file mode 100644 index 00000000..a2af7266 --- /dev/null +++ b/src/spdk/dpdk/mk/exec-env/linuxapp/rte.app.mk @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +exec-env-appinstall: + @true + +exec-env-appclean: + @true diff --git a/src/spdk/dpdk/mk/exec-env/linuxapp/rte.vars.mk b/src/spdk/dpdk/mk/exec-env/linuxapp/rte.vars.mk new file mode 100644 index 00000000..3129edc8 --- /dev/null +++ b/src/spdk/dpdk/mk/exec-env/linuxapp/rte.vars.mk @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# exec-env: +# +# - define EXECENV_CFLAGS variable (overridden by cmdline) +# - define EXECENV_LDFLAGS variable (overridden by cmdline) +# - define EXECENV_ASFLAGS variable (overridden by cmdline) +# - may override any previously defined variable +# +# examples for RTE_EXEC_ENV: linuxapp, bsdapp +# +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXECENV_CFLAGS = -pthread -fPIC +else +EXECENV_CFLAGS = -pthread +endif + +EXECENV_LDLIBS = +EXECENV_ASFLAGS = + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXECENV_LDLIBS += -lgcc_s +endif + +# force applications to link with gcc/icc instead of using ld +LINK_USING_CC := 1 + +# For shared libraries +EXECENV_LDFLAGS += -export-dynamic +# Add library to the group to resolve symbols +EXECENV_LDLIBS += -ldl + +export EXECENV_CFLAGS EXECENV_LDFLAGS EXECENV_ASFLAGS EXECENV_LDLIBS diff --git a/src/spdk/dpdk/mk/internal/rte.build-post.mk b/src/spdk/dpdk/mk/internal/rte.build-post.mk new file mode 100644 index 00000000..a6b6a9a4 --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.build-post.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# build helper .mk + +# fast way, no need to do prebuild and postbuild +ifeq ($(PREBUILD)$(POSTBUILD),) + +_postbuild: $(_BUILD) + @touch _postbuild + +else # slower way + +_prebuild: $(PREBUILD) + @touch _prebuild + +ifneq ($(_BUILD),) +$(_BUILD): _prebuild +else +_BUILD = _prebuild +endif + +_build: $(_BUILD) + @touch _build + +ifneq ($(POSTBUILD),) +$(POSTBUILD): _build +else +POSTBUILD = _build +endif + +_postbuild: $(POSTBUILD) + @touch _postbuild +endif
\ No newline at end of file diff --git a/src/spdk/dpdk/mk/internal/rte.build-pre.mk b/src/spdk/dpdk/mk/internal/rte.build-pre.mk new file mode 100644 index 00000000..137612f1 --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.build-pre.mk @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +_BUILD_TARGETS := _prebuild _build _postbuild + +comma := , +linkerprefix = $(subst -Wl$(comma)-L,-L,$(addprefix -Wl$(comma),$1)) diff --git a/src/spdk/dpdk/mk/internal/rte.clean-post.mk b/src/spdk/dpdk/mk/internal/rte.clean-post.mk new file mode 100644 index 00000000..77685edd --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.clean-post.mk @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# clean helper .mk + +# fast way, no need to do preclean and postclean +ifeq ($(PRECLEAN)$(POSTCLEAN),) + +_postclean: $(_CLEAN) + @touch _postclean + +else # slower way + +_preclean: $(PRECLEAN) + @touch _preclean + +ifneq ($(_CLEAN),) +$(_CLEAN): _preclean +else +_CLEAN = _preclean +endif + +_clean: $(_CLEAN) + @touch _clean + +ifneq ($(POSTCLEAN),) +$(POSTCLEAN): _clean +else +POSTCLEAN = _clean +endif + +_postclean: $(POSTCLEAN) + @touch _postclean +endif diff --git a/src/spdk/dpdk/mk/internal/rte.clean-pre.mk b/src/spdk/dpdk/mk/internal/rte.clean-pre.mk new file mode 100644 index 00000000..e21607bf --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.clean-pre.mk @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +_CLEAN_TARGETS := _preclean _clean _postclean diff --git a/src/spdk/dpdk/mk/internal/rte.compile-post.mk b/src/spdk/dpdk/mk/internal/rte.compile-post.mk new file mode 100644 index 00000000..01525bee --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.compile-post.mk @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# no rule no build these files +$(DEPS-y) $(CMDS-y): diff --git a/src/spdk/dpdk/mk/internal/rte.compile-pre.mk b/src/spdk/dpdk/mk/internal/rte.compile-pre.mk new file mode 100644 index 00000000..a734cbbd --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.compile-pre.mk @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# Common to rte.lib.mk, rte.app.mk, rte.obj.mk +# + +SRCS-all := $(SRCS-y) $(SRCS-n) $(SRCS-) + +# convert source to obj file +src2obj = $(strip $(patsubst %.c,%.o,\ + $(patsubst %.S,%_s.o,$(1)))) + +# add a dot in front of the file name +dotfile = $(strip $(foreach f,$(1),\ + $(join $(dir $f),.$(notdir $f)))) + +# convert source/obj files into dot-dep filename (does not +# include .S files) +src2dep = $(strip $(call dotfile,$(patsubst %.c,%.o.d, \ + $(patsubst %.S,,$(1))))) +obj2dep = $(strip $(call dotfile,$(patsubst %.o,%.o.d,$(1)))) + +# convert source/obj files into dot-cmd filename +src2cmd = $(strip $(call dotfile,$(patsubst %.c,%.o.cmd, \ + $(patsubst %.S,%_s.o.cmd,$(1))))) +obj2cmd = $(strip $(call dotfile,$(patsubst %.o,%.o.cmd,$(1)))) + +OBJS-y := $(call src2obj,$(SRCS-y)) +OBJS-n := $(call src2obj,$(SRCS-n)) +OBJS- := $(call src2obj,$(SRCS-)) +OBJS-all := $(filter-out $(SRCS-all),$(OBJS-y) $(OBJS-n) $(OBJS-)) + +DEPS-y := $(call src2dep,$(SRCS-y)) +DEPS-n := $(call src2dep,$(SRCS-n)) +DEPS- := $(call src2dep,$(SRCS-)) +DEPS-all := $(DEPS-y) $(DEPS-n) $(DEPS-) +DEPSTMP-all := $(DEPS-all:%.d=%.d.tmp) + +CMDS-y := $(call src2cmd,$(SRCS-y)) +CMDS-n := $(call src2cmd,$(SRCS-n)) +CMDS- := $(call src2cmd,$(SRCS-)) +CMDS-all := $(CMDS-y) $(CMDS-n) $(CMDS-) + +-include $(DEPS-y) $(CMDS-y) + +# command to compile a .c file to generate an object +ifeq ($(USE_HOST),1) +C_TO_O = $(HOSTCC) -Wp,-MD,$(call obj2dep,$(@)).tmp $(HOST_CPPFLAGS) $(HOST_CFLAGS) \ + $(CFLAGS_$(@)) $(HOST_EXTRA_CPPFLAGS) $(HOST_EXTRA_CFLAGS) -o $@ -c $< +C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight +C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)"," HOSTCC $(@)") +else +C_TO_O = $(CC) -Wp,-MD,$(call obj2dep,$(@)).tmp $(CPPFLAGS) $(CFLAGS) \ + $(CFLAGS_$(@)) $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< +C_TO_O_STR = $(subst ','\'',$(C_TO_O)) #'# fix syntax highlight +C_TO_O_DISP = $(if $(V),"$(C_TO_O_STR)"," CC $(@)") +endif +EXPERIMENTAL_CHECK = $(RTE_SDK)/buildtools/check-experimental-syms.sh +CHECK_EXPERIMENTAL = $(EXPERIMENTAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@ + +PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c +PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@.pmd.o $@.pmd.c +PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@ +PMDINFO_TO_O = if grep -q 'RTE_PMD_REGISTER_.*(.*)' $<; then \ + echo "$(if $V,$(PMDINFO_GEN), PMDINFO $@.pmd.c)" && \ + $(PMDINFO_GEN) && \ + echo "$(if $V,$(PMDINFO_CC), CC $@.pmd.o)" && \ + $(PMDINFO_CC) && \ + echo "$(if $V,$(PMDINFO_LD), LD $@)" && \ + $(PMDINFO_LD) && \ + mv -f $@.o $@; fi +C_TO_O_CMD = 'cmd_$@ = $(C_TO_O_STR)' +C_TO_O_DO = @set -e; \ + echo $(C_TO_O_DISP); \ + $(C_TO_O) && \ + $(PMDINFO_TO_O) && \ + $(CHECK_EXPERIMENTAL) && \ + echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \ + sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \ + rm -f $(call obj2dep,$(@)).tmp + +# return an empty string if string are equal +compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1))) + +# return a non-empty string if the dst file does not exist +file_missing = $(call compare,$(wildcard $@),$@) + +# return a non-empty string if cmdline changed +cmdline_changed = $(call compare,$(strip $(cmd_$@)),$(strip $(1))) + +# return a non-empty string if a dependency file does not exist +depfile_missing = $(call compare,$(wildcard $(dep_$@)),$(dep_$@)) + +# return an empty string if no prereq is newer than target +# - $^ -> names of all the prerequisites +# - $(wildcard $^) -> every existing prereq +# - $(filter-out $(wildcard $^),$^) -> every prereq that don't +# exist (filter-out removes existing ones from the list) +# - $? -> names of all the prerequisites newer than target +depfile_newer = $(strip $(filter-out FORCE,$? \ + $(filter-out $(wildcard $^),$^))) + +# return 1 if parameter is a non-empty string, else 0 +boolean = $(if $1,1,0) + +# +# Compile .c file if needed +# Note: dep_$$@ is from the .d file and DEP_$$@ can be specified by +# user (by default it is empty) +# +.SECONDEXPANSION: +%.o: %.c $$(wildcard $$(dep_$$@)) $$(DEP_$$(@)) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(C_TO_O))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer))") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(C_TO_O)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(C_TO_O_DO)) + +# command to assemble a .S file to generate an object +ifeq ($(USE_HOST),1) +S_TO_O = $(CPP) $(HOST_CPPFLAGS) $($(@)_CPPFLAGS) $(HOST_EXTRA_CPPFLAGS) $< $(@).tmp && \ + $(HOSTAS) $(HOST_ASFLAGS) $($(@)_ASFLAGS) $(HOST_EXTRA_ASFLAGS) -o $@ $(@).tmp +S_TO_O_STR = $(subst ','\'',$(S_TO_O)) #'# fix syntax highlight +S_TO_O_DISP = $(if $(V),"$(S_TO_O_STR)"," HOSTAS $(@)") +else +S_TO_O = $(CPP) $(CPPFLAGS) $($(@)_CPPFLAGS) $(EXTRA_CPPFLAGS) $< -o $(@).tmp && \ + $(AS) $(ASFLAGS) $($(@)_ASFLAGS) $(EXTRA_ASFLAGS) -o $@ $(@).tmp +S_TO_O_STR = $(subst ','\'',$(S_TO_O)) #'# fix syntax highlight +S_TO_O_DISP = $(if $(V),"$(S_TO_O_STR)"," AS $(@)") +endif + +S_TO_O_CMD = "cmd_$@ = $(S_TO_O_STR)" +S_TO_O_DO = @set -e; \ + echo $(S_TO_O_DISP); \ + $(S_TO_O) && \ + echo $(S_TO_O_CMD) > $(call obj2cmd,$(@)) + +# +# Compile .S file if needed +# Note: DEP_$$@ can be specified by user (by default it is empty) +# +%_s.o: %.S $$(DEP_$$@) FORCE + @[ ! -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(S_TO_O_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(S_TO_O_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(S_TO_O_DO)) diff --git a/src/spdk/dpdk/mk/internal/rte.extvars.mk b/src/spdk/dpdk/mk/internal/rte.extvars.mk new file mode 100644 index 00000000..98c86062 --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.extvars.mk @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# directory where sources are located +# +ifdef S +ifeq ("$(origin S)", "command line") +RTE_SRCDIR := $(abspath $(S)) +endif +endif +RTE_SRCDIR ?= $(CURDIR) +export RTE_SRCDIR + +# +# Makefile to call once $(RTE_OUTPUT) is created +# +ifdef M +ifeq ("$(origin M)", "command line") +RTE_EXTMK := $(abspath $(M)) +endif +endif +RTE_EXTMK ?= $(RTE_SRCDIR)/$(notdir $(firstword $(MAKEFILE_LIST))) +export RTE_EXTMK + +# RTE_SDK_BIN must point to .config, include/ and lib/. +RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET) +ifeq ($(wildcard $(RTE_SDK_BIN)/.config),) +$(error Cannot find .config in $(RTE_SDK_BIN)) +endif + +# +# Output files wil go in a separate directory: default output is +# $(RTE_SRCDIR)/build +# Output dir can be given as command line using "O=" +# +ifdef O +ifeq ("$(origin O)", "command line") +RTE_OUTPUT := $(abspath $(O)) +endif +endif +RTE_OUTPUT ?= $(RTE_SRCDIR)/build +export RTE_OUTPUT + +# if we are building an external application, include SDK +# configuration and include project configuration if any +include $(RTE_SDK_BIN)/.config +ifneq ($(wildcard $(RTE_OUTPUT)/.config),) + include $(RTE_OUTPUT)/.config +endif +# remove double-quotes from config names +RTE_ARCH := $(CONFIG_RTE_ARCH:"%"=%) +RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%) +RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%) +RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%) diff --git a/src/spdk/dpdk/mk/internal/rte.install-post.mk b/src/spdk/dpdk/mk/internal/rte.install-post.mk new file mode 100644 index 00000000..a1aa0ca4 --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.install-post.mk @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# install helper .mk + +# +# generate rules to install files in RTE_OUTPUT. +# +# arg1: relative install dir in RTE_OUTPUT +# arg2: relative file name in a source dir (VPATH) +# +define install_rule +$(addprefix $(RTE_OUTPUT)/$(1)/,$(notdir $(2))): $(2) + @echo " INSTALL-FILE $(addprefix $(1)/,$(notdir $(2)))" + @[ -d $(RTE_OUTPUT)/$(1) ] || mkdir -p $(RTE_OUTPUT)/$(1) + $(Q)cp -rf $$(<) $(RTE_OUTPUT)/$(1) +endef + +$(foreach dir,$(INSTALL-DIRS-y),\ + $(foreach file,$(INSTALL-y-$(dir)),\ + $(eval $(call install_rule,$(dir),$(file))))) + + +# +# generate rules to install symbolic links of files in RTE_OUTPUT. +# +# arg1: relative install dir in RTE_OUTPUT +# arg2: relative file name in a source dir (VPATH) +# +define symlink_rule +$(addprefix $(RTE_OUTPUT)/$(1)/,$(notdir $(2))): $(2) + @echo " SYMLINK-FILE $(addprefix $(1)/,$(notdir $(2)))" + @[ -d $(RTE_OUTPUT)/$(1) ] || mkdir -p $(RTE_OUTPUT)/$(1) + $(Q)ln -nsf `$(RTE_SDK)/buildtools/relpath.sh $$(<) $(RTE_OUTPUT)/$(1)` \ + $(RTE_OUTPUT)/$(1) +endef + +$(foreach dir,$(SYMLINK-DIRS-y),\ + $(foreach file,$(SYMLINK-y-$(dir)),\ + $(eval $(call symlink_rule,$(dir),$(file))))) + + +# fast way, no need to do preinstall and postinstall +ifeq ($(PREINSTALL)$(POSTINSTALL),) + +_postinstall: $(_INSTALL) + @touch _postinstall + +else # slower way + +_preinstall: $(PREINSTALL) + @touch _preinstall + +ifneq ($(_INSTALL),) +$(_INSTALL): _preinstall +else +_INSTALL = _preinstall +endif + +_install: $(_INSTALL) + @touch _install + +ifneq ($(POSTINSTALL),) +$(POSTINSTALL): _install +else +POSTINSTALL = _install +endif + +_postinstall: $(POSTINSTALL) + @touch _postinstall +endif diff --git a/src/spdk/dpdk/mk/internal/rte.install-pre.mk b/src/spdk/dpdk/mk/internal/rte.install-pre.mk new file mode 100644 index 00000000..4786d3b2 --- /dev/null +++ b/src/spdk/dpdk/mk/internal/rte.install-pre.mk @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# get all variables starting with "INSTALL-y-", and extract the +# installation dir and path +# +INSTALL-y := $(filter INSTALL-y-%,$(.VARIABLES)) +INSTALL-n := $(filter INSTALL-n-%,$(.VARIABLES)) +INSTALL- := $(filter INSTALL--%,$(.VARIABLES)) +INSTALL-DIRS-y := $(patsubst INSTALL-y-%,%,$(INSTALL-y)) +INSTALL-FILES-y := $(foreach i,$(INSTALL-DIRS-y),\ + $(addprefix $(RTE_OUTPUT)/$(i)/,$(notdir $(INSTALL-y-$(i))))) +INSTALL-FILES-all := $(foreach i,$(INSTALL-DIRS-y) $(INSTALL-DIRS-n) $(INSTALL-DIRS-),\ + $(addprefix $(RTE_OUTPUT)/$(i)/,$(notdir $(INSTALL-y-$(i))))) + +_INSTALL_TARGETS := _preinstall _install _postinstall + +# +# get all variables starting with "SYMLINK-y-", and extract the +# installation dir and path +# +SYMLINK-y := $(filter SYMLINK-y-%,$(.VARIABLES)) +SYMLINK-n := $(filter SYMLINK-n-%,$(.VARIABLES)) +SYMLINK- := $(filter SYMLINK--%,$(.VARIABLES)) +SYMLINK-DIRS-y := $(patsubst SYMLINK-y-%,%,$(SYMLINK-y)) +SYMLINK-FILES-y := $(foreach i,$(SYMLINK-DIRS-y),\ + $(addprefix $(RTE_OUTPUT)/$(i)/,$(notdir $(SYMLINK-y-$(i))))) +SYMLINK-FILES-all := $(foreach i,$(SYMLINK-DIRS-y) $(SYMLINK-DIRS-n) $(SYMLINK-DIRS-),\ + $(addprefix $(RTE_OUTPUT)/$(i)/,$(notdir $(SYMLINK-y-$(i))))) + +_SYMLINK_TARGETS := _presymlink _symlink _postsymlink diff --git a/src/spdk/dpdk/mk/machine/armv7a/rte.vars.mk b/src/spdk/dpdk/mk/machine/armv7a/rte.vars.mk new file mode 100644 index 00000000..44ebd68d --- /dev/null +++ b/src/spdk/dpdk/mk/machine/armv7a/rte.vars.mk @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (C) 2015 RehiveTech. All rights reserved. + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=armv7-a + +ifdef CONFIG_RTE_ARCH_ARM_TUNE +MACHINE_CFLAGS += -mtune=$(CONFIG_RTE_ARCH_ARM_TUNE:"%"=%) +endif + +MACHINE_CFLAGS += -mfpu=neon diff --git a/src/spdk/dpdk/mk/machine/armv8a/rte.vars.mk b/src/spdk/dpdk/mk/machine/armv8a/rte.vars.mk new file mode 100644 index 00000000..8252efbb --- /dev/null +++ b/src/spdk/dpdk/mk/machine/armv8a/rte.vars.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2015 Cavium, Inc +# + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=armv8-a+crc+crypto diff --git a/src/spdk/dpdk/mk/machine/default/rte.vars.mk b/src/spdk/dpdk/mk/machine/default/rte.vars.mk new file mode 100644 index 00000000..df08d3b0 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/default/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=corei7 diff --git a/src/spdk/dpdk/mk/machine/dpaa/rte.vars.mk b/src/spdk/dpdk/mk/machine/dpaa/rte.vars.mk new file mode 100644 index 00000000..75df626f --- /dev/null +++ b/src/spdk/dpdk/mk/machine/dpaa/rte.vars.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. +# Copyright 2017 NXP + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = +MACHINE_CFLAGS += -march=armv8-a+crc + +ifdef CONFIG_RTE_ARCH_ARM_TUNE +MACHINE_CFLAGS += -mtune=$(CONFIG_RTE_ARCH_ARM_TUNE:"%"=%) +endif + +# To avoid TLS corruption issue. +MACHINE_CFLAGS += -mtls-dialect=trad diff --git a/src/spdk/dpdk/mk/machine/dpaa2/rte.vars.mk b/src/spdk/dpdk/mk/machine/dpaa2/rte.vars.mk new file mode 100644 index 00000000..aaa03c42 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/dpaa2/rte.vars.mk @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. +# Copyright 2016 NXP + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = +MACHINE_CFLAGS += -march=armv8-a+crc + +ifdef CONFIG_RTE_ARCH_ARM_TUNE +MACHINE_CFLAGS += -mtune=$(CONFIG_RTE_ARCH_ARM_TUNE:"%"=%) +endif + +# To avoid TLS corruption issue. +MACHINE_CFLAGS += -mtls-dialect=trad diff --git a/src/spdk/dpdk/mk/machine/hsw/rte.vars.mk b/src/spdk/dpdk/mk/machine/hsw/rte.vars.mk new file mode 100644 index 00000000..39099e76 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/hsw/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=core-avx2 diff --git a/src/spdk/dpdk/mk/machine/ivb/rte.vars.mk b/src/spdk/dpdk/mk/machine/ivb/rte.vars.mk new file mode 100644 index 00000000..5b656374 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/ivb/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=core-avx-i diff --git a/src/spdk/dpdk/mk/machine/native/rte.vars.mk b/src/spdk/dpdk/mk/machine/native/rte.vars.mk new file mode 100644 index 00000000..8c96e3fa --- /dev/null +++ b/src/spdk/dpdk/mk/machine/native/rte.vars.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=native + +# On FreeBSD systems, sometimes the correct CPU type is not picked up. +# To get everything to compile, we need SSE4.2 support, so check if that is +# reported by compiler. If not, check if the CPU actually supports it, and if +# so, set the compilation target to be a corei7, minimum target with SSE4.2. +SSE42_SUPPORT=$(shell $(CC) -march=native -dM -E - </dev/null | grep SSE4_2) +ifeq ($(SSE42_SUPPORT),) + MACHINE_CFLAGS = -march=corei7 +endif diff --git a/src/spdk/dpdk/mk/machine/nhm/rte.vars.mk b/src/spdk/dpdk/mk/machine/nhm/rte.vars.mk new file mode 100644 index 00000000..91de5d9b --- /dev/null +++ b/src/spdk/dpdk/mk/machine/nhm/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=corei7 diff --git a/src/spdk/dpdk/mk/machine/power8/rte.vars.mk b/src/spdk/dpdk/mk/machine/power8/rte.vars.mk new file mode 100644 index 00000000..6e9483c6 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/power8/rte.vars.mk @@ -0,0 +1,57 @@ +# BSD LICENSE +# +# Copyright (C) IBM Corporation 2014. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of IBM Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# 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. + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = diff --git a/src/spdk/dpdk/mk/machine/silvermont/rte.vars.mk b/src/spdk/dpdk/mk/machine/silvermont/rte.vars.mk new file mode 100644 index 00000000..e4f3fe42 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/silvermont/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=silvermont diff --git a/src/spdk/dpdk/mk/machine/snb/rte.vars.mk b/src/spdk/dpdk/mk/machine/snb/rte.vars.mk new file mode 100644 index 00000000..efe2f32d --- /dev/null +++ b/src/spdk/dpdk/mk/machine/snb/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=corei7-avx diff --git a/src/spdk/dpdk/mk/machine/thunderx/rte.vars.mk b/src/spdk/dpdk/mk/machine/thunderx/rte.vars.mk new file mode 100644 index 00000000..04774166 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/thunderx/rte.vars.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2015 Cavium, Inc +# + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=armv8-a+crc+crypto -mcpu=thunderx diff --git a/src/spdk/dpdk/mk/machine/wsm/rte.vars.mk b/src/spdk/dpdk/mk/machine/wsm/rte.vars.mk new file mode 100644 index 00000000..e9bc3f98 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/wsm/rte.vars.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS = -march=corei7 -maes -mpclmul diff --git a/src/spdk/dpdk/mk/machine/xgene1/rte.vars.mk b/src/spdk/dpdk/mk/machine/xgene1/rte.vars.mk new file mode 100644 index 00000000..e632f313 --- /dev/null +++ b/src/spdk/dpdk/mk/machine/xgene1/rte.vars.mk @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2015 Cavium, Inc +# + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - may override any previously defined variable +# + +# ARCH = +# CROSS = +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=armv8-a diff --git a/src/spdk/dpdk/mk/rte.app.mk b/src/spdk/dpdk/mk/rte.app.mk new file mode 100644 index 00000000..de33883b --- /dev/null +++ b/src/spdk/dpdk/mk/rte.app.mk @@ -0,0 +1,418 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2017 Intel Corporation. +# Copyright(c) 2014-2015 6WIND S.A. + +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(APP) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) +_INSTALL += $(RTE_OUTPUT)/app/$(APP) $(RTE_OUTPUT)/app/$(APP).map +POSTINSTALL += target-appinstall +_CLEAN = doclean +POSTCLEAN += target-appclean + +ifeq ($(NO_LDSCRIPT),) +LDSCRIPT = $(RTE_LDSCRIPT) +endif + +# Link only the libraries used in the application +LDFLAGS += --as-needed + +# default path for libs +_LDLIBS-y += -L$(RTE_SDK_BIN)/lib + +# +# Order is important: from higher level to lower level +# +_LDLIBS-$(CONFIG_RTE_LIBRTE_FLOW_CLASSIFY) += -lrte_flow_classify +_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += --whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += -lrte_pipeline +_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += --no-whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += --whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += -lrte_table +_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += --no-whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += --whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += -lrte_port +_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += --no-whole-archive + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PDUMP) += -lrte_pdump +_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor +_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter +_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm +# librte_acl needs --whole-archive because of weak functions +_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl +_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --no-whole-archive +_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += -lrte_jobstats +_LDLIBS-$(CONFIG_RTE_LIBRTE_METRICS) += -lrte_metrics +_LDLIBS-$(CONFIG_RTE_LIBRTE_BITRATE) += -lrte_bitratestats +_LDLIBS-$(CONFIG_RTE_LIBRTE_LATENCY_STATS) += -lrte_latencystats +_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power + +_LDLIBS-$(CONFIG_RTE_LIBRTE_EFD) += -lrte_efd +_LDLIBS-$(CONFIG_RTE_LIBRTE_BPF) += -lrte_bpf +ifeq ($(CONFIG_RTE_LIBRTE_BPF_ELF),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_BPF) += -lelf +endif + +_LDLIBS-y += --whole-archive + +_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile +_LDLIBS-$(CONFIG_RTE_LIBRTE_GRO) += -lrte_gro +_LDLIBS-$(CONFIG_RTE_LIBRTE_GSO) += -lrte_gso +_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH) += -lrte_hash +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMBER) += -lrte_member +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost +_LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf +_LDLIBS-$(CONFIG_RTE_LIBRTE_NET) += -lrte_net +_LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER) += -lrte_ethdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_BBDEV) += -lrte_bbdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += -lrte_cryptodev +_LDLIBS-$(CONFIG_RTE_LIBRTE_SECURITY) += -lrte_security +_LDLIBS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += -lrte_compressdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += -lrte_eventdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_RAWDEV) += -lrte_rawdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +_LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal +_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline +_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched + +ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni +endif + +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +_LDLIBS-y += -lrte_common_octeontx +endif + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci +_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa +ifeq ($(CONFIG_RTE_EAL_VFIO),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += -lrte_bus_fslmc +endif + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +# plugins (link only if static libraries) + +_LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_BUCKET) += -lrte_mempool_bucket +_LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_STACK) += -lrte_mempool_stack +ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_MEMPOOL) += -lrte_mempool_dpaa +endif +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += -lrte_mempool_dpaa2 +endif + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet +_LDLIBS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += -lrte_pmd_ark +_LDLIBS-$(CONFIG_RTE_LIBRTE_AVF_PMD) += -lrte_pmd_avf +_LDLIBS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += -lrte_pmd_avp +_LDLIBS-$(CONFIG_RTE_LIBRTE_AXGBE_PMD) += -lrte_pmd_axgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += -lrte_pmd_bnxt +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond +_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe +ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_PMD) += -lrte_pmd_dpaa +endif +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2 +endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += -lrte_pmd_failsafe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e +_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KNI) += -lrte_pmd_kni +endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += -lrte_pmd_lio +ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -ldl +else +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs -lmlx4 +endif +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -ldl -lmnl +else +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs -lmlx5 -lmnl +endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 -L$(LIBMUSDK_PATH)/lib -lmusdk +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += -lrte_pmd_softnic +endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += -lrte_pmd_sfc_efx +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += -lrte_pmd_tap +_LDLIBS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += -lrte_pmd_thunderx_nicvf +_LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += -lrte_pmd_vdev_netvsc +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost +ifeq ($(CONFIG_RTE_EAL_VFIO),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_IFC_PMD) += -lrte_pmd_ifc +endif # $(CONFIG_RTE_EAL_VFIO) +endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio + +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMBUS) += -lrte_bus_vmbus +_LDLIBS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += -lrte_pmd_netvsc + +ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL) += -lrte_pmd_bbdev_null + +# TURBO SOFTWARE PMD is dependent on the FLEXRAN library +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -lrte_pmd_bbdev_turbo_sw +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_crc -lcrc +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_turbo -lturbo +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_rate_matching -lrate_matching +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -L$(FLEXRAN_SDK)/lib_common -lcommon +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_TURBO_SW) += -lirc -limf -lstdc++ -lipps +endif # CONFIG_RTE_LIBRTE_BBDEV + +ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CCP) += -lrte_pmd_ccp -lcrypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += -lrte_pmd_openssl -lcrypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto +ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT_SYM) += -lrte_pmd_qat -lcrypto +endif # CONFIG_RTE_LIBRTE_PMD_QAT +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += -lrte_pmd_kasumi +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += -lrte_pmd_zuc +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += -lrte_pmd_armv8 +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += -L$(LIBMUSDK_PATH)/lib -lrte_pmd_mvsam_crypto -lmusdk +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += -lrte_pmd_crypto_scheduler +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += -lrte_pmd_dpaa2_sec +endif # CONFIG_RTE_LIBRTE_FSLMC_BUS +ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_SEC) += -lrte_pmd_dpaa_sec +endif # CONFIG_RTE_LIBRTE_DPAA_BUS +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += -lrte_pmd_virtio_crypto +endif # CONFIG_RTE_LIBRTE_CRYPTODEV + +ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += -lrte_pmd_isal_comp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += -lisal +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += -lrte_pmd_octeontx_zip +# Link QAT driver if it has not been linked yet +ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT_SYM),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat +endif # CONFIG_RTE_LIBRTE_PMD_QAT_SYM +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += -lrte_pmd_zlib +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_ZLIB) += -lz +endif # CONFIG_RTE_LIBRTE_COMPRESSDEV + +ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += -lrte_pmd_skeleton_event +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += -lrte_pmd_sw_event +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += -lrte_pmd_octeontx_ssovf +ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV) += -lrte_pmd_dpaa_event +endif # CONFIG_RTE_LIBRTE_DPAA_BUS +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += -lrte_pmd_dpaa2_event +endif # CONFIG_RTE_LIBRTE_FSLMC_BUS + +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += -lrte_mempool_octeontx +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += -lrte_pmd_octeontx +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV) += -lrte_pmd_opdl_event +endif # CONFIG_RTE_LIBRTE_EVENTDEV + +ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma +endif # CONFIG_RTE_LIBRTE_FSLMC_BUS +_LDLIBS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS) += -lrte_bus_ifpga +ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += -lrte_pmd_ifpga_rawdev +endif # CONFIG_RTE_LIBRTE_IFPGA_BUS +endif # CONFIG_RTE_LIBRTE_RAWDEV + +endif # !CONFIG_RTE_BUILD_SHARED_LIBS + +_LDLIBS-y += --no-whole-archive + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +# The static libraries do not know their dependencies. +# So linking with static library requires explicit dependencies. +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrt +ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP)$(CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lnuma +endif +ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP)$(CONFIG_RTE_USE_LIBBSD),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lbsd +endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMBER) += -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma +endif +_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap +endif # !CONFIG_RTE_BUILD_SHARED_LIBS + +_LDLIBS-y += $(EXECENV_LDLIBS) + +LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS) + +# all the words except the first one +allbutfirst = $(wordlist 2,$(words $(1)),$(1)) + +# Eliminate duplicates without sorting, only keep the last occurrence +filter-libs = \ + $(if $(1),$(strip\ + $(if \ + $(and \ + $(filter $(firstword $(1)),$(call allbutfirst,$(1))),\ + $(filter -l%,$(firstword $(1)))),\ + ,\ + $(firstword $(1))) \ + $(call filter-libs,$(call allbutfirst,$(1))))) + +LDLIBS := $(call filter-libs,$(LDLIBS)) + +ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy) +LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib +endif + +MAPFLAGS = -Map=$@.map --cref + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +ifeq ($(LINK_USING_CC),1) +O_TO_EXE = $(CC) -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $(OBJS-y) $(call linkerprefix, \ + $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + $(MAPFLAGS)) +else +O_TO_EXE = $(LD) -o $@ $(OBJS-y) \ + $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + $(MAPFLAGS) +endif +O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight +O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," LD $(@)") +O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)" +O_TO_EXE_DO = @set -e; \ + echo $(O_TO_EXE_DISP); \ + $(O_TO_EXE) && \ + echo $(O_TO_EXE_CMD) > $(call exe2cmd,$(@)) + +-include .$(APP).cmd + +# path where libraries are retrieved +LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS))) +LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS))) + +# list of .a files that are linked to this application +LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))) +LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS))) + +# list of found libraries files (useful for deps). If not found, the +# library is silently ignored and dep won't be checked +LDLIBS_FILES := $(sort $(wildcard $(foreach dir,$(LDLIBS_PATH),\ + $(addprefix $(dir)/,$(LDLIBS_NAMES))))) + +# +# Compile executable file if needed +# +$(APP): $(OBJS-y) $(LDLIBS_FILES) $(DEP_$(APP)) $(LDSCRIPT) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_EXE_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_EXE_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_EXE_DO)) + +# +# install app in $(RTE_OUTPUT)/app +# +$(RTE_OUTPUT)/app/$(APP): $(APP) + @echo " INSTALL-APP $(APP)" + @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app + $(Q)cp -f $(APP) $(RTE_OUTPUT)/app + +# +# install app map file in $(RTE_OUTPUT)/app +# +$(RTE_OUTPUT)/app/$(APP).map: $(APP) + @echo " INSTALL-MAP $(APP).map" + @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app + $(Q)cp -f $(APP).map $(RTE_OUTPUT)/app + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +.PHONY: doclean +doclean: + $(Q)rm -rf $(APP) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) $(INSTALL-FILES-all) .$(APP).cmd $(APP).map + + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk),) +include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk +else +include $(RTE_SDK)/mk/target/generic/rte.app.mk +endif + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.bsdmodule.mk b/src/spdk/dpdk/mk/rte.bsdmodule.mk new file mode 100644 index 00000000..df8bf9ef --- /dev/null +++ b/src/spdk/dpdk/mk/rte.bsdmodule.mk @@ -0,0 +1,89 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +##### if sourced from kernel Kbuild system +ifneq ($(KERNELRELEASE),) +override EXTRA_CFLAGS = $(MODULE_CFLAGS) $(EXTRA_KERNEL_CFLAGS) +obj-m += $(MODULE).o +ifneq ($(MODULE),$(notdir $(SRCS-y:%.c=%))) +$(MODULE)-objs += $(notdir $(SRCS-y:%.c=%.o)) +endif + +##### if launched from rte build system +else + +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# DPDK uses a more up-to-date gcc, so clear the override here. +unexport CC +override CFLAGS = $(MODULE_CFLAGS) + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(MODULE).ko +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) \ + $(RTE_OUTPUT)/kmod/$(MODULE).ko +_CLEAN = doclean + +SRCS_LINKS = $(addsuffix _link,$(SRCS-y)) + +compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1))) + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +# Link all sources in build directory +%_link: FORCE + $(if $(call compare,$(notdir $*),$*),\ + $(Q)if [ ! -f $(notdir $(*)) ]; then ln -nfs $(SRCDIR)/$(*) . ; fi,\ + $(Q)if [ ! -f $(notdir $(*)) ]; then ln -nfs $(SRCDIR)/$(*) . ; fi) + +# build module +$(MODULE).ko: $(SRCS_LINKS) + $(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi + $(Q)if [ ! -f $(notdir BSDmakefile) ]; then ln -nfs $(SRCDIR)/BSDmakefile . ; fi + $(Q)MAKEFLAGS= $(BSDMAKE) + +# install module in $(RTE_OUTPUT)/kmod +$(RTE_OUTPUT)/kmod/$(MODULE).ko: $(MODULE).ko + $(Q)echo INSTALL-MODULE $(MODULE).ko + $(Q)[ -d $(RTE_OUTPUT)/kmod ] || mkdir -p $(RTE_OUTPUT)/kmod + $(Q)cp -f $(MODULE).ko $(RTE_OUTPUT)/kmod + +# install module +modules_install: + $(Q)MAKEFLAGS= $(BSDMAKE) install + +.PHONY: clean +clean: _postclean + +# do a make clean and remove links +.PHONY: doclean +doclean: + $(Q)if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi + $(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean + $(Q)$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\ + if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi ;) + $(Q)if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \ + $(INSTALL-FILES-all) + +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: + +endif diff --git a/src/spdk/dpdk/mk/rte.combinedlib.mk b/src/spdk/dpdk/mk/rte.combinedlib.mk new file mode 100644 index 00000000..9d0f9353 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.combinedlib.mk @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2015 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +default: all + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXT:=.so +else +EXT:=.a +endif + +RTE_LIBNAME := dpdk +COMBINEDLIB := lib$(RTE_LIBNAME)$(EXT) + +LIBS := $(filter-out $(COMBINEDLIB), $(sort $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT))))) + +all: FORCE + $(Q)echo "GROUP ( $(LIBS) )" > $(RTE_OUTPUT)/lib/$(COMBINEDLIB) + +# +# Clean all generated files +# +.PHONY: clean +clean: + $(Q)rm -f $(RTE_OUTPUT)/lib/$(COMBINEDLIB) + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.cpuflags.mk b/src/spdk/dpdk/mk/rte.cpuflags.mk new file mode 100644 index 00000000..60713137 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.cpuflags.mk @@ -0,0 +1,115 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# this makefile is called from the generic rte.vars.mk and is +# used to set the RTE_CPUFLAG_* environment variables giving details +# of what instruction sets the target cpu supports. + +AUTO_CPUFLAGS := $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $(EXTRA_CFLAGS) -dM -E - < /dev/null) + +# adding flags to CPUFLAGS + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSE__),) +CPUFLAGS += SSE +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSE2__),) +CPUFLAGS += SSE2 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSE3__),) +CPUFLAGS += SSE3 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSSE3__),) +CPUFLAGS += SSSE3 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_1__),) +CPUFLAGS += SSE4_1 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__SSE4_2__),) +CPUFLAGS += SSE4_2 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__AES__),) +CPUFLAGS += AES +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__PCLMUL__),) +CPUFLAGS += PCLMULQDQ +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__AVX__),) +ifeq ($(CONFIG_RTE_ENABLE_AVX),y) +CPUFLAGS += AVX +endif +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__RDRND__),) +CPUFLAGS += RDRAND +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__FSGSBASE__),) +CPUFLAGS += FSGSBASE +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__F16C__),) +CPUFLAGS += F16C +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__AVX2__),) +ifeq ($(CONFIG_RTE_ENABLE_AVX),y) +CPUFLAGS += AVX2 +endif +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),) +ifeq ($(CONFIG_RTE_ENABLE_AVX512),y) +CPUFLAGS += AVX512F +endif +endif + +# IBM Power CPU flags +ifneq ($(filter $(AUTO_CPUFLAGS),__PPC64__),) +CPUFLAGS += PPC64 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__PPC32__),) +CPUFLAGS += PPC32 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__vector),) +CPUFLAGS += ALTIVEC +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__builtin_vsx_xvnmaddadp),) +CPUFLAGS += VSX +endif + +# ARM flags +ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_NEON),) +CPUFLAGS += NEON +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRC32),) +CPUFLAGS += CRC32 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__ARM_FEATURE_CRYPTO),) +CPUFLAGS += AES +CPUFLAGS += PMULL +CPUFLAGS += SHA1 +CPUFLAGS += SHA2 +endif + +MACHINE_CFLAGS += $(addprefix -DRTE_MACHINE_CPUFLAG_,$(CPUFLAGS)) + +# To strip whitespace +comma:= , +empty:= +space:= $(empty) $(empty) +CPUFLAGSTMP1 := $(addprefix RTE_CPUFLAG_,$(CPUFLAGS)) +CPUFLAGSTMP2 := $(subst $(space),$(comma),$(CPUFLAGSTMP1)) +CPUFLAGS_LIST := -DRTE_COMPILE_TIME_CPUFLAGS=$(CPUFLAGSTMP2) diff --git a/src/spdk/dpdk/mk/rte.extapp.mk b/src/spdk/dpdk/mk/rte.extapp.mk new file mode 100644 index 00000000..427bb523 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.extapp.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +MAKEFLAGS += --no-print-directory + +# we must create the output dir first and recall the same Makefile +# from this directory +ifeq ($(NOT_FIRST_CALL),) + +NOT_FIRST_CALL = 1 +export NOT_FIRST_CALL + +all: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) + +%:: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) $@ \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) +else +include $(RTE_SDK)/mk/rte.app.mk +endif diff --git a/src/spdk/dpdk/mk/rte.extlib.mk b/src/spdk/dpdk/mk/rte.extlib.mk new file mode 100644 index 00000000..97787332 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.extlib.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +MAKEFLAGS += --no-print-directory + +EXTLIB_BUILD := y + +# we must create the output dir first and recall the same Makefile +# from this directory +ifeq ($(NOT_FIRST_CALL),) + +NOT_FIRST_CALL = 1 +export NOT_FIRST_CALL + +all: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) + +%:: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) $@ \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) +else +include $(RTE_SDK)/mk/rte.lib.mk +endif diff --git a/src/spdk/dpdk/mk/rte.extobj.mk b/src/spdk/dpdk/mk/rte.extobj.mk new file mode 100644 index 00000000..c761a5de --- /dev/null +++ b/src/spdk/dpdk/mk/rte.extobj.mk @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +MAKEFLAGS += --no-print-directory + +# we must create the output dir first and recall the same Makefile +# from this directory +ifeq ($(NOT_FIRST_CALL),) + +NOT_FIRST_CALL = 1 +export NOT_FIRST_CALL + +all: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) + +%:: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) $@ \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) +else +include $(RTE_SDK)/mk/rte.obj.mk +endif diff --git a/src/spdk/dpdk/mk/rte.extshared.mk b/src/spdk/dpdk/mk/rte.extshared.mk new file mode 100644 index 00000000..64269e1a --- /dev/null +++ b/src/spdk/dpdk/mk/rte.extshared.mk @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2012-2013 6WIND S.A. + +MAKEFLAGS += --no-print-directory + +# we must create the output dir first and recall the same Makefile +# from this directory +ifeq ($(NOT_FIRST_CALL),) + +NOT_FIRST_CALL = 1 +export NOT_FIRST_CALL + +all: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) + @echo $(RTE_OUTPUT)/lib must be added to /etc/ld.so.conf or \ + LD_LIBRARY_PATH variable to allow binary to link with dynamic library + +%:: + $(Q)mkdir -p $(RTE_OUTPUT) + $(Q)$(MAKE) -C $(RTE_OUTPUT) -f $(RTE_EXTMK) $@ \ + S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) +else +include $(RTE_SDK)/mk/rte.shared.mk +endif diff --git a/src/spdk/dpdk/mk/rte.extsubdir.mk b/src/spdk/dpdk/mk/rte.extsubdir.mk new file mode 100644 index 00000000..0f8ef94c --- /dev/null +++ b/src/spdk/dpdk/mk/rte.extsubdir.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2014 6WIND S.A. + +MAKEFLAGS += --no-print-directory + +ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES))) + +# output directory +O ?= $(CURDIR) +BASE_OUTPUT ?= $(abspath $(O)) +CUR_SUBDIR ?= . + +.PHONY: all +all: $(DIRS-y) + +.PHONY: clean +clean: $(DIRS-y) + +.PHONY: $(DIRS-y) +$(DIRS-y): + @echo "== $@" + $(Q)$(MAKE) -C $(@) \ + M=$(CURDIR)/$(@)/Makefile \ + O=$(BASE_OUTPUT)/$(CUR_SUBDIR)/$(@)/$(RTE_TARGET) \ + BASE_OUTPUT=$(BASE_OUTPUT) \ + CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \ + S=$(CURDIR)/$(@) \ + $(filter-out $(DIRS-y),$(MAKECMDGOALS)) + +define depdirs_rule +$(DEPDIRS-$(1)): + +$(1): | $(DEPDIRS-$(1)) + +$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1)))) +endef + +$(foreach dir,$(ALL_DEPDIRS),\ + $(eval $(call depdirs_rule,$(dir)))) diff --git a/src/spdk/dpdk/mk/rte.gnuconfigure.mk b/src/spdk/dpdk/mk/rte.gnuconfigure.mk new file mode 100644 index 00000000..72e99aaf --- /dev/null +++ b/src/spdk/dpdk/mk/rte.gnuconfigure.mk @@ -0,0 +1,44 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +include $(RTE_SDK)/mk/internal/rte.build-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) +_BUILD = configure +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) +_CLEAN = doclean + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +configure: + $(Q)cd $(CONFIGURE_PATH) ; \ + ./configure --prefix $(CONFIGURE_PREFIX) $(CONFIGURE_ARGS) ; \ + make ; \ + make install + +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + $(Q)cd $(CONFIGURE_PATH) ; make clean + $(Q)rm -f $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.build-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.hostapp.mk b/src/spdk/dpdk/mk/rte.hostapp.mk new file mode 100644 index 00000000..68e32b57 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.hostapp.mk @@ -0,0 +1,93 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# tell rte.compile-pre.mk to use HOSTCC instead of CC +USE_HOST := 1 +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(HOSTAPP) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/app/$(HOSTAPP) +_CLEAN = doclean + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \ + $(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS) +O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight +O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," HOSTLD $(@)") +O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)" +O_TO_EXE_DO = @set -e; \ + echo $(O_TO_EXE_DISP); \ + $(O_TO_EXE) && \ + echo $(O_TO_EXE_CMD) > $(call exe2cmd,$(@)) + +-include .$(HOSTAPP).cmd + +# list of .a files that are linked to this application +LDLIBS_FILES := $(sort $(wildcard \ + $(addprefix $(RTE_OUTPUT)/lib/, \ + $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))) + +# +# Compile executable file if needed +# +$(HOSTAPP): $(OBJS-y) $(LDLIBS_FILES) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$@ -> $< " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_EXE_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_EXE_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_EXE_DO)) + +# +# install app in $(RTE_OUTPUT)/hostapp +# +$(RTE_OUTPUT)/app/$(HOSTAPP): $(HOSTAPP) + @echo " INSTALL-HOSTAPP $(HOSTAPP)" + @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app + $(Q)cp -f $(HOSTAPP) $(RTE_OUTPUT)/app + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +.PHONY: doclean +doclean: + $(Q)rm -rf $(HOSTAPP) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) $(INSTALL-FILES-all) .$(HOSTAPP).cmd + + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.hostlib.mk b/src/spdk/dpdk/mk/rte.hostlib.mk new file mode 100644 index 00000000..0ccaa55f --- /dev/null +++ b/src/spdk/dpdk/mk/rte.hostlib.mk @@ -0,0 +1,86 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# tell rte.compile-pre.mk to use HOSTCC instead of CC +USE_HOST := 1 +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(HOSTLIB) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/hostlib/$(HOSTLIB) +_CLEAN = doclean + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +O_TO_A = $(AR) crus $(HOSTLIB) $(OBJS-y) +O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight +O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," HOSTAR $(@)") +O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)" +O_TO_A_DO = @set -e; \ + echo $(O_TO_A_DISP); \ + $(O_TO_A) && \ + echo $(O_TO_A_CMD) > $(call exe2cmd,$(@)) + +-include .$(HOSTLIB).cmd + +# +# Archive objects in .a file if needed +# +$(HOSTLIB): $(OBJS-y) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$@ -> $< " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_A_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_A_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_A_DO)) + +# +# install lib in $(RTE_OUTPUT)/hostlib +# +$(RTE_OUTPUT)/hostlib/$(HOSTLIB): $(HOSTLIB) + @echo " INSTALL-HOSTLIB $(HOSTLIB)" + @[ -d $(RTE_OUTPUT)/hostlib ] || mkdir -p $(RTE_OUTPUT)/hostlib + $(Q)cp -f $(HOSTLIB) $(RTE_OUTPUT)/hostlib + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + $(Q)rm -rf $(HOSTLIB) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) $(INSTALL-FILES-all) + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.install.mk b/src/spdk/dpdk/mk/rte.install.mk new file mode 100644 index 00000000..e56daf45 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.install.mk @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# install-only makefile (no build target) + +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) +_CLEAN = doclean + +.PHONY: all +all: _postinstall + @true + +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + @rm -rf $(INSTALL-FILES-all) + @rm -f $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk diff --git a/src/spdk/dpdk/mk/rte.lib.mk b/src/spdk/dpdk/mk/rte.lib.mk new file mode 100644 index 00000000..c696a217 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.lib.mk @@ -0,0 +1,158 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +EXTLIB_BUILD ?= n + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +ifneq ($(CONFIG_RTE_MAJOR_ABI),) +ifneq ($(LIBABIVER),) +LIBABIVER := $(CONFIG_RTE_MAJOR_ABI) +endif +endif + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB)) +ifeq ($(EXTLIB_BUILD),n) +ifeq ($(CONFIG_RTE_MAJOR_ABI),) +ifeq ($(CONFIG_RTE_NEXT_ABI),y) +LIB := $(LIB).1 +endif +endif +CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP) +endif +endif + + +_BUILD = $(LIB) +PREINSTALL = $(SYMLINK-FILES-y) +_INSTALL = $(INSTALL-FILES-y) $(RTE_OUTPUT)/lib/$(LIB) +_CLEAN = doclean + +.PHONY: all +all: install + +.PHONY: install +ifeq ($(SYMLINK-FILES-y),) +install: build _postinstall +else +install: _preinstall build _postinstall +build: _preinstall +endif + +_postinstall: build + +.PHONY: build +build: _postbuild + +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +ifeq ($(LINK_USING_CC),1) +# Override the definition of LD here, since we're linking with CC +LD := $(CC) $(CPU_CFLAGS) $(EXTRA_CFLAGS) +_CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) +else +_CPU_LDFLAGS := $(CPU_LDFLAGS) +endif + +O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) +O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight +O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)") +O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)" +O_TO_A_DO = @set -e; \ + echo $(O_TO_A_DISP); \ + $(O_TO_A) && \ + echo $(O_TO_A_CMD) > $(call exe2cmd,$(@)) + +ifneq ($(CC_SUPPORTS_Z),false) +NO_UNDEFINED := -z defs +endif + +O_TO_S = $(LD) -L$(RTE_SDK_BIN)/lib $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) \ + -shared $(OBJS-y) $(NO_UNDEFINED) $(LDLIBS) -Wl,-soname,$(LIB) -o $(LIB) +O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight +O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)") +O_TO_S_DO = @set -e; \ + echo $(O_TO_S_DISP); \ + $(O_TO_S) && \ + echo $(O_TO_S_CMD) > $(call exe2cmd,$(@)) + +-include .$(LIB).cmd + +# +# Archive objects in .a file if needed +# +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +$(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE +ifeq ($(LIBABIVER),) + @echo "Must Specify a $(LIB) ABI version" + @false +endif + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_S_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_S_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_S_DO)) + +else +$(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_A_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_A_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_A_DO)) +endif + +# +# install lib in $(RTE_OUTPUT)/lib +# +$(RTE_OUTPUT)/lib/$(LIB): $(LIB) + @echo " INSTALL-LIB $(LIB)" + @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib + $(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) + $(Q)ln -s -f $< $(shell echo $@ | sed 's/\.so.*/.so/') +endif + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + $(Q)rm -rf $(LIB) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) .$(LIB).cmd $(INSTALL-FILES-all) *.pmd.c *.pmd.o + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.module.mk b/src/spdk/dpdk/mk/rte.module.mk new file mode 100644 index 00000000..1ada528a --- /dev/null +++ b/src/spdk/dpdk/mk/rte.module.mk @@ -0,0 +1,86 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +##### if sourced from kernel Kbuild system +ifneq ($(KERNELRELEASE),) +override EXTRA_CFLAGS = $(MODULE_CFLAGS) $(EXTRA_KERNEL_CFLAGS) +obj-m += $(MODULE).o +ifneq ($(MODULE),$(notdir $(SRCS-y:%.c=%))) +$(MODULE)-objs += $(notdir $(SRCS-y:%.c=%.o)) +endif + +##### if launched from rte build system +else + +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(MODULE).ko +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) \ + $(RTE_OUTPUT)/kmod/$(MODULE).ko +_CLEAN = doclean + +SRCS_LINKS = $(addsuffix _link,$(SRCS-y)) + +compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1))) + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +# Link all sources in build directory +%_link: FORCE + $(if $(call compare,$(notdir $*),$*),\ + @if [ ! -f $(notdir $(*)) ]; then ln -nfs $(SRCDIR)/$(*) . ; fi,\ + @if [ ! -f $(notdir $(*)) ]; then ln -nfs $(SRCDIR)/$(*) . ; fi) + +# build module +$(MODULE).ko: $(SRCS_LINKS) + @if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi + @$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) \ + CC="$(KERNELCC)" CROSS_COMPILE=$(CROSS) V=$(if $V,1,0) + +# install module in $(RTE_OUTPUT)/kmod +$(RTE_OUTPUT)/kmod/$(MODULE).ko: $(MODULE).ko + @echo INSTALL-MODULE $(MODULE).ko + @[ -d $(RTE_OUTPUT)/kmod ] || mkdir -p $(RTE_OUTPUT)/kmod + @cp -f $(MODULE).ko $(RTE_OUTPUT)/kmod + +# install module +modules_install: + @$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) \ + modules_install + +.PHONY: clean +clean: _postclean + +# do a make clean and remove links +.PHONY: doclean +doclean: + @if [ ! -f $(notdir Makefile) ]; then ln -nfs $(SRCDIR)/Makefile . ; fi + $(Q)$(MAKE) -C $(RTE_KERNELDIR) M=$(CURDIR) O=$(RTE_KERNELDIR) clean + @$(foreach FILE,$(SRCS-y) $(SRCS-n) $(SRCS-),\ + if [ -h $(notdir $(FILE)) ]; then rm -f $(notdir $(FILE)) ; fi ;) + @if [ -h $(notdir Makefile) ]; then rm -f $(notdir Makefile) ; fi + @rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) \ + $(INSTALL-FILES-all) + +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: + +endif diff --git a/src/spdk/dpdk/mk/rte.obj.mk b/src/spdk/dpdk/mk/rte.obj.mk new file mode 100644 index 00000000..1641a52e --- /dev/null +++ b/src/spdk/dpdk/mk/rte.obj.mk @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +ifneq ($(OBJ),) +_BUILD = $(OBJ) +else +_BUILD = $(OBJS-y) +endif +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) +_CLEAN = doclean + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +ifneq ($(OBJ),) +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +O_TO_O = $(LD) -r -o $(OBJ) $(OBJS-y) +O_TO_O_STR = $(subst ','\'',$(O_TO_O)) #'# fix syntax highlight +O_TO_O_DISP = $(if $(V),"$(O_TO_O_STR)"," LD $(@)") +O_TO_O_CMD = "cmd_$@ = $(O_TO_O_STR)" +O_TO_O_DO = @set -e; \ + echo $(O_TO_O_DISP); \ + $(O_TO_O) && \ + echo $(O_TO_O_CMD) > $(call exe2cmd,$(@)) + +-include .$(OBJ).cmd + +# +# Archive objects in .a file if needed +# +$(OBJ): $(OBJS-y) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_O_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_O_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_O_DO)) +endif + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + @rm -rf $(OBJ) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) $(INSTALL-FILES-all) + @rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.sdkbuild.mk b/src/spdk/dpdk/mk/rte.sdkbuild.mk new file mode 100644 index 00000000..5dc43e42 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkbuild.mk @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2015 Intel Corporation + +# +# include rte.vars.mk if config file exists +# +ifeq (,$(wildcard $(RTE_OUTPUT)/.config)) + $(error "need a make config first") +else + include $(RTE_SDK)/mk/rte.vars.mk +endif + +# allow exec-env specific targets +-include $(RTE_SDK)/mk/exec-env/$(RTE_EXEC_ENV)/rte.custom.mk + +buildtools: | lib +kernel: | lib +drivers: | lib buildtools +app: | lib buildtools drivers +test: | lib buildtools drivers + +# +# build and clean targets +# + +CLEANDIRS = $(addsuffix _clean,$(ROOTDIRS-y) $(ROOTDIRS-n) $(ROOTDIRS-)) + +.PHONY: build +build: $(ROOTDIRS-y) + @echo "Build complete [$(RTE_TARGET)]" + +.PHONY: clean +clean: $(CLEANDIRS) + @rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \ + $(RTE_OUTPUT)/lib \ + $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod + @[ -d $(RTE_OUTPUT)/include ] || mkdir -p $(RTE_OUTPUT)/include + @$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \ + > $(RTE_OUTPUT)/include/rte_config.h + $(Q)$(MAKE) -f $(RTE_SDK)/GNUmakefile gcovclean + @echo Clean complete + +.PHONY: test-build +test-build: test + +.SECONDEXPANSION: +.PHONY: $(ROOTDIRS-y) $(ROOTDIRS-) +$(ROOTDIRS-y) $(ROOTDIRS-): + @[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@ + @echo "== Build $@" + $(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all + @if [ $@ = drivers ]; then \ + $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \ + fi + +%_clean: + @echo "== Clean $*" + $(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \ + $(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \ + fi + +RTE_MAKE_SUBTARGET ?= all + +%_sub: $(addsuffix _sub,$(*)) + @echo $(addsuffix _sub,$(*)) + @[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$* + @echo "== Build $*" + $(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \ + $(RTE_MAKE_SUBTARGET) + +.PHONY: all +all: build + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.sdkconfig.mk b/src/spdk/dpdk/mk/rte.sdkconfig.mk new file mode 100644 index 00000000..d90d62cc --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkconfig.mk @@ -0,0 +1,147 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +.PHONY: showversion +showversion: + @set -- \ + $$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \ + -e 's,^#define RTE_VER_SUFFIX[[:space:]]+"(.*)",\1,p' \ + $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h) ;\ + printf '%d.%02d.%d' "$$1" "$$2" "$$3"; \ + if [ -z "$$5" ]; then echo; \ + else printf '%s' "$$4"; \ + if [ $$5 -lt 16 ] ; then echo $$5; \ + else echo $$(($$5 - 16)); fi; \ + fi + +.PHONY: showversionum +showversionum: + @set -- \ + $$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \ + $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \ + printf '%02d%02d\n' "$$1" "$$2" + +INSTALL_CONFIGS := $(sort $(filter-out %~,\ + $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\ + $(wildcard $(RTE_SRCDIR)/config/defconfig_*)))) +INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS)) + +.PHONY: showconfigs +showconfigs: + @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);) + +.PHONY: notemplate +notemplate: + @printf "No template specified. Use 'make defconfig' or " + @echo "use T=template from the following list:" + @$(MAKE) -rR showconfigs | sed 's,^, ,' + +.PHONY: defconfig +defconfig: + @$(MAKE) config T=$(shell \ + uname -m | awk '{ \ + if ($$0 == "aarch64") { \ + print "arm64-armv8a"} \ + else if ($$0 == "armv7l") { \ + print "arm-armv7a"} \ + else if ($$0 == "ppc64") { \ + print "ppc_64-power8"} \ + else if ($$0 == "amd64") { \ + print "x86_64-native"} \ + else { \ + printf "%s-native", $$0} }' \ + )-$(shell \ + uname | awk '{ \ + if ($$0 == "Linux") { \ + print "linuxapp"} \ + else { \ + print "bsdapp"} }' \ + )-$(shell \ + ${CC} --version | grep -o 'cc\|gcc\|icc\|clang' | awk \ + '{ \ + if ($$1 == "cc") { \ + print "gcc" } \ + else { \ + print $$1 } \ + }' \ + ) + +.PHONY: config +ifeq ($(RTE_CONFIG_TEMPLATE),) +config: notemplate +else +config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile + @echo "Configuration done using" \ + $(patsubst defconfig_%,%,$(notdir $(RTE_CONFIG_TEMPLATE))) +endif + +$(RTE_OUTPUT): + $(Q)mkdir -p $@ + +ifdef NODOTCONF +$(RTE_OUTPUT)/.config: ; +else +# Generate config from template, if there are duplicates keep only the last. +# To do so the temp config is checked for duplicate keys with cut/sort/uniq +# Then for each of those identified duplicates as long as there are more than +# just one left the last match is removed. +$(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT) + $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \ + $(CPP) -undef -P -x assembler-with-cpp \ + -ffreestanding \ + -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ + config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \ + echo "$$config" | awk -F '=' 'BEGIN {i=1} \ + /^#/ {pos[i++]=$$0} \ + !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \ + else {pos[s[$$1]]=$$0}} END \ + {for (j=1; j<i; j++) print pos[j]}' \ + > $(RTE_OUTPUT)/.config_tmp ; \ + if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ + cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ + cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ + fi ; \ + rm -f $(RTE_OUTPUT)/.config_tmp ; \ + else \ + $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \ + fi +endif + +# generate a Makefile for this build directory +# use a relative path so it will continue to work even if we move the directory +SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \ + $(abspath $(RTE_OUTPUT))) +OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \ + $(abspath $(RTE_SRCDIR))) +$(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT) + $(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \ + > $(RTE_OUTPUT)/Makefile + +# clean installed files, and generate a new config header file +# if NODOTCONF variable is defined, don't try to rebuild .config +$(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config + $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \ + $(RTE_OUTPUT)/lib \ + $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build + $(Q)mkdir -p $(RTE_OUTPUT)/include + $(Q)$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \ + > $(RTE_OUTPUT)/include/rte_config.h + +# generate the rte_config.h +.PHONY: headerconfig +headerconfig: $(RTE_OUTPUT)/include/rte_config.h + @true + +# check that .config is present, and if yes, check that rte_config.h +# is up to date +.PHONY: checkconfig +checkconfig: + @if [ ! -f $(RTE_OUTPUT)/.config ]; then \ + echo "No .config in build directory"; \ + exit 1; \ + fi + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \ + headerconfig NODOTCONF=1 + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.sdkdepdirs.mk b/src/spdk/dpdk/mk/rte.sdkdepdirs.mk new file mode 100644 index 00000000..7adeb0e1 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkdepdirs.mk @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +ifeq (,$(wildcard $(RTE_OUTPUT)/.config)) + $(error "need a make config first") +endif +ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile)) + $(error "need a make config first") +endif diff --git a/src/spdk/dpdk/mk/rte.sdkdoc.mk b/src/spdk/dpdk/mk/rte.sdkdoc.mk new file mode 100644 index 00000000..bd2e5763 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkdoc.mk @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2015 Intel Corporation. +# Copyright(c) 2013-2015 6WIND S.A. + +ifdef T +ifeq ("$(origin T)", "command line") +$(error "Cannot use T= with doc target") +endif +endif + +RTE_SPHINX_BUILD = sphinx-build +RTE_PDFLATEX_VERBOSE := --interaction=nonstopmode + +ifndef V +RTE_SPHINX_VERBOSE := -q +RTE_PDFLATEX_VERBOSE := --interaction=batchmode +RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1 +endif +ifeq '$V' '0' +RTE_SPHINX_VERBOSE := -q +RTE_PDFLATEX_VERBOSE := --interaction=batchmode +RTE_INKSCAPE_VERBOSE := >/dev/null 2>&1 +endif + +RTE_PDF_DPI ?= 300 + +RTE_GUIDES := $(filter %/, $(wildcard $(RTE_SDK)/doc/guides/*/)) + +API_EXAMPLES := $(RTE_OUTPUT)/doc/html/examples.dox + +.PHONY: help +help: + @cat $(RTE_SDK)/doc/build-sdk-quick.txt + @$(MAKE) -rR showconfigs | sed 's,^,\t\t\t\t,' + +.PHONY: all +all: api-html guides-html guides-pdf + +.PHONY: clean +clean: api-html-clean guides-html-clean guides-pdf-clean guides-man-clean + +.PHONY: api-html +api-html: $(API_EXAMPLES) + @echo 'doxygen for API...' + $(Q)mkdir -p $(RTE_OUTPUT)/doc/html + $(Q)(cat $(RTE_SDK)/doc/api/doxy-api.conf && \ + printf 'PROJECT_NUMBER = ' && \ + $(MAKE) -rRs showversion && \ + echo INPUT += $(API_EXAMPLES) && \ + echo OUTPUT_DIRECTORY = $(RTE_OUTPUT)/doc && \ + echo HTML_OUTPUT = html/api && \ + echo GENERATE_HTML = YES && \ + echo GENERATE_LATEX = NO && \ + echo GENERATE_MAN = NO )| \ + doxygen - + $(Q)$(RTE_SDK)/doc/api/doxy-html-custom.sh $(RTE_OUTPUT)/doc/html/api/doxygen.css + +.PHONY: api-html-clean +api-html-clean: + $(Q)rm -f $(API_EXAMPLES) + $(Q)rm -f $(RTE_OUTPUT)/doc/html/api/* + $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- || true + +$(API_EXAMPLES): api-html-clean + $(Q)mkdir -p $(@D) + @printf '/**\n' > $(API_EXAMPLES) + @printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES) + @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES) + @printf '*/\n' >> $(API_EXAMPLES) + +guides-pdf-clean: guides-pdf-img-clean +guides-pdf-img-clean: + $(Q)rm -f $(RTE_SDK)/doc/guides/*/img/*.pdf + +guides-%-clean: + $(Q)rm -rf $(RTE_OUTPUT)/doc/$*/guides + $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/$* 2>&- || true + +guides-pdf: $(addprefix guides-pdf-, $(notdir $(RTE_GUIDES:/=))) ; +guides-pdf-%: + @echo 'sphinx processing $@...' + $(Q)$(RTE_SPHINX_BUILD) -b latex $(RTE_SPHINX_VERBOSE) \ + -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides/$* \ + $(RTE_OUTPUT)/doc/pdf/guides/$* + $(if $^,$(Q)rm -f $^) + @echo 'pdflatex processing $@...' + $(Q)$(MAKE) all-pdf -sC $(RTE_OUTPUT)/doc/pdf/guides/$* \ + LATEXOPTS=$(RTE_PDFLATEX_VERBOSE) + $(Q)mv $(RTE_OUTPUT)/doc/pdf/guides/$*/doc.pdf \ + $(RTE_OUTPUT)/doc/pdf/guides/$*.pdf + +guides-html-prepare: + $(Q)install -D -m0644 $(RTE_SDK)/doc/guides/custom.css \ + $(RTE_OUTPUT)/doc/html/guides/_static/css/custom.css + +guides-%-prepare: ; + +guides-%: guides-%-prepare + @echo 'sphinx processing $@...' + $(Q)$(RTE_SPHINX_BUILD) -b $* $(RTE_SPHINX_VERBOSE) \ + -c $(RTE_SDK)/doc/guides $(RTE_SDK)/doc/guides \ + $(RTE_OUTPUT)/doc/$*/guides + +# Each PDF depends on generated images *.pdf from *.svg +$(foreach guide, $(RTE_GUIDES), $(foreach img, $(wildcard $(guide)img/*.svg), \ + $(eval guides-pdf-$(notdir $(guide:/=)): $(img:svg=pdf)))) +%.pdf: %.svg + $(Q)inkscape -d $(RTE_PDF_DPI) -D -f $< -A $@ $(RTE_INKSCAPE_VERBOSE) diff --git a/src/spdk/dpdk/mk/rte.sdkexamples.mk b/src/spdk/dpdk/mk/rte.sdkexamples.mk new file mode 100644 index 00000000..5eeec364 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkexamples.mk @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2014 6WIND S.A. + +# examples application are seen as external applications which are +# not part of SDK. +BUILDING_RTE_SDK := +export BUILDING_RTE_SDK + +# Build directory is given with O= +O ?= $(RTE_SDK)/examples + +# Target for which examples should be built. +T ?= * + +# list all available configurations +EXAMPLES_CONFIGS := $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\ + $(wildcard $(RTE_SRCDIR)/config/defconfig_$(T))) +EXAMPLES_TARGETS := $(addsuffix _examples,\ + $(filter-out %~,$(EXAMPLES_CONFIGS))) + +.PHONY: examples +examples: $(EXAMPLES_TARGETS) + +%_examples: + @echo ================== Build examples for $* + $(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \ + echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \ + echo -n "Please install DPDK first (make install) or use another " ; \ + echo "target argument (T=target)." ; \ + false ; \ + else \ + $(MAKE) -C examples O=$(abspath $(O)) RTE_TARGET=$(*); \ + fi + +EXAMPLES_CLEAN_TARGETS := $(addsuffix _examples_clean,\ + $(filter-out %~,$(EXAMPLES_CONFIGS))) + +.PHONY: examples_clean +examples_clean: $(EXAMPLES_CLEAN_TARGETS) + +%_examples_clean: + @echo ================== Clean examples for $* + $(Q)if [ ! -d "${RTE_SDK}/${*}" ]; then \ + echo "Target ${*} does not exist in ${RTE_SDK}/${*}." ; \ + echo -n "Please install DPDK first (make install) or use another " ; \ + echo "target argument (T=target)." ; \ + false ; \ + else \ + $(MAKE) -C examples O=$(abspath $(O)) RTE_TARGET=$(*) clean; \ + fi diff --git a/src/spdk/dpdk/mk/rte.sdkgcov.mk b/src/spdk/dpdk/mk/rte.sdkgcov.mk new file mode 100644 index 00000000..ab528b18 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkgcov.mk @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +ifdef T +ifeq ("$(origin T)", "command line") +$(error "Cannot use T= with gcov target") +endif +endif + +ifeq (,$(wildcard $(RTE_OUTPUT)/.config)) + $(error "need a make config first") +else + include $(RTE_SDK)/mk/rte.vars.mk +endif +ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile)) + $(error "need a make config first") +endif + +INPUTDIR = $(RTE_OUTPUT) +OUTPUTDIR = $(RTE_OUTPUT)/gcov + +.PHONY: gcovclean +gcovclean: + $(Q)find $(INPUTDIR)/build -name "*.gcno" -o -name "*.gcda" -exec rm {} \; + $(Q)rm -rf $(OUTPUTDIR) + +.PHONY: gcov +gcov: + $(Q)for APP in test ; do \ + mkdir -p $(OUTPUTDIR)/$$APP ; cd $(OUTPUTDIR)/$$APP ; \ + for FIC in `strings $(RTE_OUTPUT)/app/$$APP | grep gcda | sed s,gcda,o,` ; do \ + SUBDIR=`basename $$FIC`;\ + mkdir $$SUBDIR ;\ + cd $$SUBDIR ;\ + $(GCOV) $(RTE_OUTPUT)/app/$$APP -o $$FIC > gcov.log; \ + cd - >/dev/null;\ + done ; \ + cd - >/dev/null; \ + done diff --git a/src/spdk/dpdk/mk/rte.sdkinstall.mk b/src/spdk/dpdk/mk/rte.sdkinstall.mk new file mode 100644 index 00000000..8296e6db --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkinstall.mk @@ -0,0 +1,148 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation. +# Copyright 2015 6WIND S.A. + +# Configuration, compilation and installation can be done at once +# with make install T=<config> + +ifdef T # config, build and install combined +# The build directory is T and may be prepended with O +O ?= . +RTE_OUTPUT := $O/$T +else # standard install +# Build directory is given with O= +O ?= build +RTE_OUTPUT := $O +endif + +ifneq ($(MAKECMDGOALS),pre_install) +include $(RTE_SDK)/mk/rte.vars.mk +endif + +ifdef T # defaults with T= will install an almost flat staging tree +export prefix ?= +kerneldir ?= $(prefix)/kmod +else +ifeq ($(RTE_EXEC_ENV),linuxapp) +kerneldir ?= /lib/modules/$(shell uname -r)/extra/dpdk +else +kerneldir ?= /boot/modules +endif +prefix ?= /usr/local +endif +exec_prefix ?= $(prefix) +bindir ?= $(exec_prefix)/bin +sbindir ?= $(exec_prefix)/sbin +libdir ?= $(exec_prefix)/lib +includedir ?= $(prefix)/include/dpdk +datarootdir ?= $(prefix)/share +docdir ?= $(datarootdir)/doc/dpdk +datadir ?= $(datarootdir)/dpdk +mandir ?= $(datarootdir)/man +sdkdir ?= $(datadir) +targetdir ?= $(datadir)/$(RTE_TARGET) + +# The install directories may be staged in DESTDIR + +# Create the directory $1 if not exists +rte_mkdir = test -d $1 || mkdir -p $1 + +# Create the relative symbolic link $2 -> $1 +# May be replaced with --relative option of ln from coreutils-8.16 +rte_symlink = ln -snf $$($(RTE_SDK)/buildtools/relpath.sh $1 $(dir $2)) $2 + +.PHONY: pre_install +pre_install: +ifdef T + $(Q)if [ ! -f $(RTE_OUTPUT)/.config ]; then \ + $(MAKE) config O=$(RTE_OUTPUT); \ + elif cmp -s $(RTE_OUTPUT)/.config.orig $(RTE_OUTPUT)/.config; then \ + $(MAKE) config O=$(RTE_OUTPUT); \ + else \ + if [ -f $(RTE_OUTPUT)/.config.orig ] ; then \ + tmp_build=$(RTE_OUTPUT)/.config.tmp; \ + $(MAKE) config O=$$tmp_build; \ + if ! cmp -s $(RTE_OUTPUT)/.config.orig $$tmp_build/.config ; then \ + echo "Conflict: local config and template config have both changed"; \ + exit 1; \ + fi; \ + fi; \ + echo "Using local configuration"; \ + fi + $(Q)$(MAKE) all O=$(RTE_OUTPUT) +endif + +.PHONY: install +install: +ifeq ($(DESTDIR)$(if $T,,+),) + @echo Installation cannot run with T defined and DESTDIR undefined +else + @echo ================== Installing $(DESTDIR)$(prefix)/ + $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-runtime + $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-kmod + $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-sdk + $(Q)$(MAKE) O=$(RTE_OUTPUT) T= install-doc + @echo Installation in $(DESTDIR)$(prefix)/ complete +endif + +# when installing we want recursive copies preserving timestamps only, no +# preservation of user/group ids or permissions +CP_FLAGS=-dR --preserve=timestamps +TAR_X_FLAGS=--strip-components=1 --keep-newer-files --no-same-owner --no-same-permissions + +install-runtime: + $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir)) + $(Q)cp $(CP_FLAGS) $O/lib/* $(DESTDIR)$(libdir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir)) + $(Q)tar -cf - -C $O --exclude 'app/*.map' \ + --exclude app/dpdk-pmdinfogen \ + --exclude 'app/cmdline*' --exclude app/test \ + --exclude app/testacl --exclude app/testpipeline app | \ + tar -xf - -C $(DESTDIR)$(bindir) $(TAR_X_FLAGS) + $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)) + $(Q)cp $(CP_FLAGS) $(RTE_SDK)/usertools $(DESTDIR)$(datadir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir)) + $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-devbind.py, \ + $(DESTDIR)$(sbindir)/dpdk-devbind) + $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/usertools/dpdk-pmdinfo.py, \ + $(DESTDIR)$(bindir)/dpdk-pmdinfo) +ifneq ($(wildcard $O/doc/man/*/*.1),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man1) + $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.1 $(DESTDIR)$(mandir)/man1 +endif +ifneq ($(wildcard $O/doc/man/*/*.8),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(mandir)/man8) + $(Q)cp $(CP_FLAGS) $O/doc/man/*/*.8 $(DESTDIR)$(mandir)/man8 +endif + +install-kmod: +ifneq ($(wildcard $O/kmod/*),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir)) + $(Q)cp $(CP_FLAGS) $O/kmod/* $(DESTDIR)$(kerneldir) +endif + +install-sdk: + $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir)) + $(Q)tar -chf - -C $O include | \ + tar -xf - -C $(DESTDIR)$(includedir) $(TAR_X_FLAGS) + $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir)) + $(Q)cp $(CP_FLAGS) $(RTE_SDK)/mk $(DESTDIR)$(sdkdir) + $(Q)cp $(CP_FLAGS) $(RTE_SDK)/buildtools $(DESTDIR)$(sdkdir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)/app) + $(Q)cp $(CP_FLAGS) $O/.config $(DESTDIR)$(targetdir) + $(Q)cp $(CP_FLAGS) $O/app/dpdk-pmdinfogen $(DESTDIR)$(targetdir)/app + $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include) + $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib) + +install-doc: +ifneq ($(wildcard $O/doc/html),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)) + $(Q)tar -cf - -C $O/doc --exclude 'html/guides/.*' html | \ + tar -xf - -C $(DESTDIR)$(docdir) $(TAR_X_FLAGS) +endif +ifneq ($(wildcard $O/doc/*/*/*pdf),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides) + $(Q)cp $(CP_FLAGS) $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides +endif + $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)) + $(Q)cp $(CP_FLAGS) $(RTE_SDK)/examples $(DESTDIR)$(datadir) diff --git a/src/spdk/dpdk/mk/rte.sdkroot.mk b/src/spdk/dpdk/mk/rte.sdkroot.mk new file mode 100644 index 00000000..18c88017 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdkroot.mk @@ -0,0 +1,101 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +MAKEFLAGS += --no-print-directory + +# define Q to '@' or not. $(Q) is used to prefix all shell commands to +# be executed silently. +Q=@ +ifeq '$V' '0' +override V= +endif +ifdef V +ifeq ("$(origin V)", "command line") +Q= +endif +endif +export Q + +ifeq ($(RTE_SDK),) +$(error RTE_SDK is not defined) +endif + +RTE_SRCDIR = $(CURDIR) +export RTE_SRCDIR + +BUILDING_RTE_SDK := 1 +export BUILDING_RTE_SDK + +# +# We can specify the configuration template when doing the "make +# config". For instance: make config T=x86_64-native-linuxapp-gcc +# +RTE_CONFIG_TEMPLATE := +ifdef T +ifeq ("$(origin T)", "command line") +RTE_CONFIG_TEMPLATE := $(RTE_SRCDIR)/config/defconfig_$(T) +endif +endif +export RTE_CONFIG_TEMPLATE + +# +# Default output is $(RTE_SRCDIR)/build +# output files wil go in a separate directory +# +ifdef O +ifeq ("$(origin O)", "command line") +RTE_OUTPUT := $(abspath $(O)) +endif +endif +RTE_OUTPUT ?= $(RTE_SRCDIR)/build +export RTE_OUTPUT + +# the directory where intermediate build files are stored, like *.o, +# *.d, *.cmd, ... +BUILDDIR = $(RTE_OUTPUT)/build +export BUILDDIR + +export ROOTDIRS-y ROOTDIRS- ROOTDIRS-n + +.PHONY: default +default: all + +.PHONY: config defconfig showconfigs showversion showversionum +config defconfig showconfigs showversion showversionum: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@ + +.PHONY: cscope gtags tags etags +cscope gtags tags etags: + $(Q)$(RTE_SDK)/devtools/build-tags.sh $@ $T + +.PHONY: test test-fast test-perf coverage test-drivers test-dump +test test-fast test-perf coverage test-drivers test-dump: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktest.mk $@ + +test: test-build + +.PHONY: install +install: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk pre_install + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@ +install-%: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkinstall.mk $@ + +.PHONY: doc help +doc: doc-all +help: doc-help +doc-%: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $* + +.PHONY: gcov gcovclean +gcov gcovclean: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkgcov.mk $@ + +.PHONY: examples examples_clean +examples examples_clean: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkexamples.mk $@ + +# all other build targets +%: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk checkconfig + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkbuild.mk $@ diff --git a/src/spdk/dpdk/mk/rte.sdktest.mk b/src/spdk/dpdk/mk/rte.sdktest.mk new file mode 100644 index 00000000..29559280 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.sdktest.mk @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +ifeq (,$(wildcard $(RTE_OUTPUT)/.config)) + $(error "need a make config first") +else + include $(RTE_SDK)/mk/rte.vars.mk +endif +ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile)) + $(error "need a make config first") +endif + +DATE := $(shell date '+%Y%m%d-%H%M') +AUTOTEST_DIR := $(RTE_OUTPUT)/autotest-$(DATE) + +DIR := $(shell basename $(RTE_OUTPUT)) + +# +# test: launch auto-tests, very simple for now. +# +.PHONY: test test-fast test-perf test-drivers test-dump coverage + +PERFLIST=ring_perf,mempool_perf,memcpy_perf,hash_perf,timer_perf,\ + reciprocal_division,reciprocal_division_perf,lpm_perf,red_all,\ + barrier,hash_multiwriter,timer_racecond,efd,hash_functions,\ + eventdev_selftest_sw,member_perf,efd_perf,lpm6_perf,red_perf,\ + distributor_perf,ring_pmd_perf,pmd_perf,ring_perf +DRIVERSLIST=link_bonding,link_bonding_mode4,link_bonding_rssconf,\ + cryptodev_sw_mrvl,cryptodev_dpaa2_sec,cryptodev_dpaa_sec,\ + cryptodev_qat,cryptodev_aesni_mb,cryptodev_openssl,\ + cryptodev_scheduler,cryptodev_aesni_gcm,cryptodev_null,\ + cryptodev_sw_snow3g,cryptodev_sw_kasumi,cryptodev_sw_zuc +DUMPLIST=dump_struct_sizes,dump_mempool,dump_malloc_stats,dump_devargs,\ + dump_log_types,dump_ring,dump_physmem,dump_memzone + +SPACESTR:= +SPACESTR+= +STRIPPED_PERFLIST=$(subst $(SPACESTR),,$(PERFLIST)) +STRIPPED_DRIVERSLIST=$(subst $(SPACESTR),,$(DRIVERSLIST)) +STRIPPED_DUMPLIST=$(subst $(SPACESTR),,$(DUMPLIST)) + +coverage: BLACKLIST=-$(STRIPPED_PERFLIST) +test-fast: BLACKLIST=-$(STRIPPED_PERFLIST),$(STRIPPED_DRIVERSLIST),$(STRIPPED_DUMPLIST) +test-perf: WHITELIST=$(STRIPPED_PERFLIST) +test-drivers: WHITELIST=$(STRIPPED_DRIVERSLIST) +test-dump: WHITELIST=$(STRIPPED_DUMPLIST) + +test test-fast test-perf test-drivers test-dump: + @mkdir -p $(AUTOTEST_DIR) ; \ + cd $(AUTOTEST_DIR) ; \ + if [ -f $(RTE_OUTPUT)/app/test ]; then \ + python $(RTE_SDK)/test/test/autotest.py \ + $(RTE_OUTPUT)/app/test \ + $(RTE_TARGET) \ + $(BLACKLIST) $(WHITELIST); \ + else \ + echo "No test found, please do a 'make test-build' first, or specify O=" ; \ + fi + +# this is a special target to ease the pain of running coverage tests +# this runs all the autotests, cmdline_test script and dpdk-procinfo +coverage: + @mkdir -p $(AUTOTEST_DIR) ; \ + cd $(AUTOTEST_DIR) ; \ + if [ -f $(RTE_OUTPUT)/app/test ]; then \ + python $(RTE_SDK)/test/cmdline_test/cmdline_test.py \ + $(RTE_OUTPUT)/app/cmdline_test; \ + ulimit -S -n 100 ; \ + python $(RTE_SDK)/test/test/autotest.py \ + $(RTE_OUTPUT)/app/test \ + $(RTE_TARGET) \ + $(BLACKLIST) $(WHITELIST) ; \ + $(RTE_OUTPUT)/app/dpdk-procinfo --file-prefix=ring_perf -- -m; \ + else \ + echo "No test found, please do a 'make test-build' first, or specify O=" ;\ + fi diff --git a/src/spdk/dpdk/mk/rte.shared.mk b/src/spdk/dpdk/mk/rte.shared.mk new file mode 100644 index 00000000..2b501ddb --- /dev/null +++ b/src/spdk/dpdk/mk/rte.shared.mk @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2012-2013 6WIND S.A. + +include $(RTE_SDK)/mk/internal/rte.compile-pre.mk +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(SHARED) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(SHARED) +_CLEAN = doclean + +# Set fPIC in CFLAGS for .so generation +CFLAGS += -fPIC + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) + +ifeq ($(LINK_USING_CC),1) +override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) +O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS)) +else +O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + -shared -o $@ $(OBJS-y) $(LDLIBS) +endif + +O_TO_SO_STR = $(subst ','\'',$(O_TO_SO)) #'# fix syntax highlight +O_TO_SO_DISP = $(if $(V),"$(O_TO_SO_STR)"," LD $(@)") +O_TO_SO_CMD = "cmd_$@ = $(O_TO_SO_STR)" +O_TO_SO_DO = @set -e; \ + echo $(O_TO_SO_DISP); \ + $(O_TO_SO) && \ + echo $(O_TO_SO_CMD) > $(call exe2cmd,$(@)) + +-include .$(SHARED).cmd + +# path where libraries are retrieved +LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS))) +LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS))) + +# list of .a files that are linked to this application +LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))) +LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS))) + +# list of found libraries files (useful for deps). If not found, the +# library is silently ignored and dep won't be checked +LDLIBS_FILES := $(sort $(wildcard $(foreach dir,$(LDLIBS_PATH),\ + $(addprefix $(dir)/,$(LDLIBS_NAMES))))) + +# +# Archive objects in .so file if needed +# +$(SHARED): $(OBJS-y) $(LDLIBS_FILES) $(DEP_$(SHARED)) FORCE + @[ -d $(dir $@) ] || mkdir -p $(dir $@) + $(if $(D),\ + @echo -n "$< -> $@ " ; \ + echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ + echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_SO_STR))) " ; \ + echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ + echo "depfile_newer=$(call boolean,$(depfile_newer)) ") + $(if $(or \ + $(file_missing),\ + $(call cmdline_changed,$(O_TO_SO_STR)),\ + $(depfile_missing),\ + $(depfile_newer)),\ + $(O_TO_SO_DO)) + +# +# install lib in $(RTE_OUTPUT)/lib +# +$(RTE_OUTPUT)/lib/$(SHARED): $(SHARED) + @echo " INSTALL-SHARED $(SHARED)" + @[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib + $(Q)cp -f $(SHARED) $(RTE_OUTPUT)/lib + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + $(Q)rm -rf $(SHARED) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \ + $(CMDS-all) $(INSTALL-FILES-all) + $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +include $(RTE_SDK)/mk/internal/rte.compile-post.mk +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.subdir.mk b/src/spdk/dpdk/mk/rte.subdir.mk new file mode 100644 index 00000000..d6e64a24 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.subdir.mk @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# .mk to build subdirectories +# + +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + +ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES))) + +CLEANDIRS = $(addsuffix _clean,$(DIRS-y) $(DIRS-n) $(DIRS-)) + +VPATH += $(SRCDIR) +_BUILD = $(DIRS-y) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) +_CLEAN = $(CLEANDIRS) + +.PHONY: all +all: install + +.PHONY: install +install: build _postinstall + +_postinstall: build + +.PHONY: build +build: _postbuild + +.SECONDEXPANSION: +.PHONY: $(DIRS-y) +$(DIRS-y): + @[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@ + @echo "== Build $S/$@" + @$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all + +.PHONY: clean +clean: _postclean + +%_clean: + @echo "== Clean $S/$*" + @if [ -f $(SRCDIR)/$*/Makefile -a -d $(CURDIR)/$* ]; then \ + $(MAKE) S=$S/$* -f $(SRCDIR)/$*/Makefile -C $(CURDIR)/$* clean ; \ + fi + @rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS) + +define depdirs_rule +$(DEPDIRS-$(1)): + +$(1): | $(DEPDIRS-$(1)) + +$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1)))) +endef + +$(foreach dir,$(ALL_DEPDIRS),\ + $(eval $(call depdirs_rule,$(dir)))) + +include $(RTE_SDK)/mk/internal/rte.install-post.mk +include $(RTE_SDK)/mk/internal/rte.clean-post.mk +include $(RTE_SDK)/mk/internal/rte.build-post.mk + +.PHONY: FORCE +FORCE: diff --git a/src/spdk/dpdk/mk/rte.vars.mk b/src/spdk/dpdk/mk/rte.vars.mk new file mode 100644 index 00000000..07b0db12 --- /dev/null +++ b/src/spdk/dpdk/mk/rte.vars.mk @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# To be included at the beginning of all RTE user Makefiles. This +# .mk will define the RTE environment variables by including the +# config file of SDK. It also includes the config file from external +# application if any. +# + +ifeq ($(RTE_SDK),) +$(error RTE_SDK is not defined) +endif +ifeq ($(wildcard $(RTE_SDK)),) +$(error RTE_SDK variable points to an invalid location) +endif + +# define Q to '@' or not. $(Q) is used to prefix all shell commands to +# be executed silently. +Q=@ +ifeq '$V' '0' +override V= +endif +ifdef V +ifeq ("$(origin V)", "command line") +Q= +endif +endif +export Q + +# if we are building SDK, only includes SDK configuration +ifneq ($(BUILDING_RTE_SDK),) + include $(RTE_OUTPUT)/.config + # remove double-quotes from config names + RTE_ARCH := $(CONFIG_RTE_ARCH:"%"=%) + RTE_MACHINE := $(CONFIG_RTE_MACHINE:"%"=%) + RTE_EXEC_ENV := $(CONFIG_RTE_EXEC_ENV:"%"=%) + RTE_TOOLCHAIN := $(CONFIG_RTE_TOOLCHAIN:"%"=%) + RTE_SDK_BIN := $(RTE_OUTPUT) +endif + +RTE_TARGET ?= $(RTE_ARCH)-$(RTE_MACHINE)-$(RTE_EXEC_ENV)-$(RTE_TOOLCHAIN) + +ifeq ($(BUILDING_RTE_SDK),) +# if we are building an external app/lib, include internal/rte.extvars.mk that will +# define RTE_OUTPUT, RTE_SRCDIR, RTE_EXTMK, RTE_SDK_BIN, (etc ...) +include $(RTE_SDK)/mk/internal/rte.extvars.mk +endif + +CONFIG_RTE_LIBRTE_E1000_PMD = $(CONFIG_RTE_LIBRTE_IGB_PMD) +ifneq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y) + CONFIG_RTE_LIBRTE_E1000_PMD = $(CONFIG_RTE_LIBRTE_EM_PMD) +endif + +ifeq ($(RTE_ARCH),) +$(error RTE_ARCH is not defined) +endif + +ifeq ($(RTE_MACHINE),) +$(error RTE_MACHINE is not defined) +endif + +ifeq ($(RTE_EXEC_ENV),) +$(error RTE_EXEC_ENV is not defined) +endif + +ifeq ($(RTE_TOOLCHAIN),) +$(error RTE_TOOLCHAIN is not defined) +endif + +# can be overridden by make command line or exported environment variable +RTE_KERNELDIR ?= /lib/modules/$(shell uname -r)/build + +export RTE_TARGET +export RTE_ARCH +export RTE_MACHINE +export RTE_EXEC_ENV +export RTE_TOOLCHAIN + +# developer build automatically enabled in a git tree +ifneq ($(wildcard $(RTE_SDK)/.git),) +RTE_DEVEL_BUILD ?= y +endif + +# SRCDIR is the current source directory +ifdef S +SRCDIR := $(abspath $(RTE_SRCDIR)/$(S)) +else +SRCDIR := $(RTE_SRCDIR) +endif + +# helper: return y if option is set to y, else return an empty string +testopt = $(if $(strip $(subst y,,$(1)) $(subst $(1),,y)),,y) + +# helper: return an empty string if option is set, else return y +not = $(if $(strip $(subst y,,$(1)) $(subst $(1),,y)),,y) + +ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.vars.mk),) +include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.vars.mk +else +include $(RTE_SDK)/mk/target/generic/rte.vars.mk +endif diff --git a/src/spdk/dpdk/mk/target/generic/rte.app.mk b/src/spdk/dpdk/mk/target/generic/rte.app.mk new file mode 100644 index 00000000..ed82656f --- /dev/null +++ b/src/spdk/dpdk/mk/target/generic/rte.app.mk @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# define Makefile targets that are specific to an environment. +# +include $(RTE_SDK)/mk/exec-env/$(RTE_EXEC_ENV)/rte.app.mk + +.PHONY: exec-env-appinstall +target-appinstall: exec-env-appinstall + +.PHONY: exec-env-appclean +target-appclean: exec-env-appclean diff --git a/src/spdk/dpdk/mk/target/generic/rte.vars.mk b/src/spdk/dpdk/mk/target/generic/rte.vars.mk new file mode 100644 index 00000000..98085cd3 --- /dev/null +++ b/src/spdk/dpdk/mk/target/generic/rte.vars.mk @@ -0,0 +1,114 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# This .mk is the generic target rte.var.mk ; it includes .mk for +# the specified machine, architecture, toolchain (compiler) and +# executive environment. +# + +# +# machine: +# +# - can define ARCH variable (overridden by cmdline value) +# - can define CROSS variable (overridden by cmdline value) +# - define MACHINE_CFLAGS variable (overridden by cmdline value) +# - define MACHINE_LDFLAGS variable (overridden by cmdline value) +# - define MACHINE_ASFLAGS variable (overridden by cmdline value) +# - can define CPU_CFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overridden by cmdline value) that +# overrides the one defined in arch. +# +ifneq ($(wildcard $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk),) +include $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk +else +MACHINE_CFLAGS := -march=$(RTE_MACHINE) +endif + +# +# arch: +# +# - define ARCH variable (overridden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overridden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overridden by cmdline or previous +# define in machine .mk) +# - may override any previously defined variable +# +include $(RTE_SDK)/mk/arch/$(RTE_ARCH)/rte.vars.mk + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# - may override any previously defined variable +# +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk + +# +# exec-env: +# +# - define EXECENV_CFLAGS variable (overridden by cmdline) +# - define EXECENV_LDFLAGS variable (overridden by cmdline) +# - define EXECENV_ASFLAGS variable (overridden by cmdline) +# - may override any previously defined variable +# +include $(RTE_SDK)/mk/exec-env/$(RTE_EXEC_ENV)/rte.vars.mk + +# Don't set CFLAGS/LDFLAGS flags for kernel module, all flags are +# provided by Kbuild framework. +ifeq ($(KERNELRELEASE),) + +# now that the environment is mostly set up, including the machine type we will +# be passing to the compiler, set up the specific CPU flags based on that info. +include $(RTE_SDK)/mk/rte.cpuflags.mk + +# merge all CFLAGS +CFLAGS := $(CPU_CFLAGS) $(EXECENV_CFLAGS) $(TOOLCHAIN_CFLAGS) $(MACHINE_CFLAGS) +CFLAGS += $(TARGET_CFLAGS) + +# merge all LDFLAGS +LDFLAGS := $(CPU_LDFLAGS) $(EXECENV_LDFLAGS) $(TOOLCHAIN_LDFLAGS) $(MACHINE_LDFLAGS) +LDFLAGS += $(TARGET_LDFLAGS) + +# merge all ASFLAGS +ASFLAGS := $(CPU_ASFLAGS) $(EXECENV_ASFLAGS) $(TOOLCHAIN_ASFLAGS) $(MACHINE_ASFLAGS) +ASFLAGS += $(TARGET_ASFLAGS) + +# add default include and lib paths +CFLAGS += -I$(RTE_OUTPUT)/include +LDFLAGS += -L$(RTE_OUTPUT)/lib + +# always include rte_config.h: the one in $(RTE_OUTPUT)/include is +# the configuration of SDK when $(BUILDING_RTE_SDK) is true, or the +# configuration of the application if $(BUILDING_RTE_SDK) is not +# defined. +ifeq ($(BUILDING_RTE_SDK),1) +# building sdk +CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h +else +# if we are building an external application, include SDK's lib and +# includes too +CFLAGS += -I$(RTE_SDK_BIN)/include +ifneq ($(wildcard $(RTE_OUTPUT)/include/rte_config.h),) +CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h +endif +CFLAGS += -include $(RTE_SDK_BIN)/include/rte_config.h +LDFLAGS += -L$(RTE_SDK_BIN)/lib +endif + +export CFLAGS +export LDFLAGS + +endif diff --git a/src/spdk/dpdk/mk/toolchain/clang/rte.toolchain-compat.mk b/src/spdk/dpdk/mk/toolchain/clang/rte.toolchain-compat.mk new file mode 100644 index 00000000..e6189b49 --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/clang/rte.toolchain-compat.mk @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# CPUID-related options +# +# This was added to support compiler versions which might not support all the +# flags we need +# + +# find out CLANG version + +CLANG_VERSION := $(shell $(CC) -v 2>&1 | \ + sed -n "s/.*version \([0-9]*\.[0-9]*\).*/\1/p") + +CLANG_MAJOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f1 -d.) + +CLANG_MINOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f2 -d.) + +ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -lt 35 && echo 1), 1) + CC_SUPPORTS_Z := false +endif diff --git a/src/spdk/dpdk/mk/toolchain/clang/rte.vars.mk b/src/spdk/dpdk/mk/toolchain/clang/rte.vars.mk new file mode 100644 index 00000000..3c49dc56 --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/clang/rte.vars.mk @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overridden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# + +CC = $(CROSS)clang +KERNELCC = $(CROSS)gcc +CPP = $(CROSS)cpp +# for now, we don't use as but nasm. +# AS = $(CROSS)as +AS = nasm +AR = $(CROSS)ar +LD = $(CROSS)ld +OBJCOPY = $(CROSS)objcopy +OBJDUMP = $(CROSS)objdump +STRIP = $(CROSS)strip +READELF = $(CROSS)readelf +GCOV = $(CROSS)gcov + +ifeq ("$(origin CC)", "command line") +HOSTCC = $(CC) +else +HOSTCC = clang +endif +HOSTAS = as + +TOOLCHAIN_ASFLAGS = +TOOLCHAIN_CFLAGS = +TOOLCHAIN_LDFLAGS = + +WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes +WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith +WERROR_FLAGS += -Wnested-externs -Wcast-qual +WERROR_FLAGS += -Wformat-nonliteral -Wformat-security +WERROR_FLAGS += -Wundef -Wwrite-strings -Wdeprecated + +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror +endif + +# process cpu flags +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk + +# workaround clang bug with warning "missing field initializer" for "= {0}" +WERROR_FLAGS += -Wno-missing-field-initializers + +# disable packed member unalign warnings +ifeq ($(shell test $(CLANG_MAJOR_VERSION) -ge 4 && echo 1), 1) +WERROR_FLAGS += -Wno-address-of-packed-member +endif + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS diff --git a/src/spdk/dpdk/mk/toolchain/gcc/rte.toolchain-compat.mk b/src/spdk/dpdk/mk/toolchain/gcc/rte.toolchain-compat.mk new file mode 100644 index 00000000..1e4434fa --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/gcc/rte.toolchain-compat.mk @@ -0,0 +1,89 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# CPUID-related options +# +# This was added to support compiler versions which might not support all the +# flags we need +# + +#find out GCC version + +GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1) +GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1) +GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(CC) -E -x c - | tail -n 1) +GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR) + +HOST_GCC_MAJOR = $(shell echo __GNUC__ | $(HOSTCC) -E -x c - | tail -n 1) +HOST_GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(HOSTCC) -E -x c - | tail -n 1) +HOST_GCC_PATCHLEVEL = $(shell echo __GNUC_PATCHLEVEL__ | $(HOSTCC) -E -x c - | tail -n 1) +HOST_GCC_VERSION = $(HOST_GCC_MAJOR)$(HOST_GCC_MINOR) + +# if GCC is older than 4.x +ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1) + MACHINE_CFLAGS = +$(warning You are using GCC < 4.x. This is neither supported, nor tested.) + + +else +# GCC graceful degradation +# GCC 4.2.x - added support for generic target +# GCC 4.3.x - added support for core2, ssse3, sse4.1, sse4.2 +# GCC 4.4.x - added support for avx, aes, pclmul +# GCC 4.5.x - added support for atom +# GCC 4.6.x - added support for corei7, corei7-avx +# GCC 4.7.x - added support for fsgsbase, rdrnd, f16c, core-avx-i, core-avx2 +# GCC 4.9.x - added support for armv8-a+crc +# + ifeq ($(shell test $(GCC_VERSION) -le 49 && echo 1), 1) + MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc,-march=armv8-a+crc -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS)) + MACHINE_CFLAGS := $(patsubst -march=armv8-a+crc+crypto,-march=armv8-a+crc+crypto -D__ARM_FEATURE_CRC32=1,$(MACHINE_CFLAGS)) + endif + ifeq ($(shell test $(GCC_VERSION) -le 47 && echo 1), 1) + MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-march=corei7-avx,$(MACHINE_CFLAGS)) + MACHINE_CFLAGS := $(patsubst -march=core-avx2,-march=core-avx2,$(MACHINE_CFLAGS)) + endif + ifeq ($(shell test $(GCC_VERSION) -lt 46 && echo 1), 1) + MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-march=core2 -maes -mpclmul -mavx,$(MACHINE_CFLAGS)) + MACHINE_CFLAGS := $(patsubst -march=corei7,-march=core2 -maes -mpclmul,$(MACHINE_CFLAGS)) + endif + ifeq ($(shell test $(GCC_VERSION) -lt 45 && echo 1), 1) + MACHINE_CFLAGS := $(patsubst -march=atom,-march=core2 -mssse3,$(MACHINE_CFLAGS)) + endif + ifeq ($(shell test $(GCC_VERSION) -lt 44 && echo 1), 1) + MACHINE_CFLAGS := $(filter-out -mavx -mpclmul -maes,$(MACHINE_CFLAGS)) + ifneq ($(findstring SSE4_2, $(CPUFLAGS)),) + MACHINE_CFLAGS += -msse4.2 + endif + ifneq ($(findstring SSE4_1, $(CPUFLAGS)),) + MACHINE_CFLAGS += -msse4.1 + endif + endif + ifeq ($(shell test $(GCC_VERSION) -lt 43 && echo 1), 1) + MACHINE_CFLAGS := $(filter-out -msse% -mssse%,$(MACHINE_CFLAGS)) + MACHINE_CFLAGS := $(patsubst -march=core2,-march=generic,$(MACHINE_CFLAGS)) + MACHINE_CFLAGS += -msse3 + endif + ifeq ($(shell test $(GCC_VERSION) -lt 42 && echo 1), 1) + MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS)) + endif + + # Disable thunderx PMD for gcc < 4.7 + ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) + CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d + endif + + # Disable OPDL PMD for gcc < 4.7 + ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) + CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV=d + endif + + # Disable octeontx event PMD for gcc < 4.8.6 + ifeq ($(shell test $(GCC_VERSION)$(GCC_PATCHLEVEL) -lt 486 && echo 1), 1) + CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF=d + CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL=d + CONFIG_RTE_LIBRTE_OCTEONTX_PMD=d + endif + +endif diff --git a/src/spdk/dpdk/mk/toolchain/gcc/rte.vars.mk b/src/spdk/dpdk/mk/toolchain/gcc/rte.vars.mk new file mode 100644 index 00000000..d8b99faf --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/gcc/rte.vars.mk @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overridden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# + +CC = $(CROSS)gcc +KERNELCC = $(CROSS)gcc +CPP = $(CROSS)cpp +# for now, we don't use as but nasm. +# AS = $(CROSS)as +AS = nasm +AR = $(CROSS)ar +LD = $(CROSS)ld +OBJCOPY = $(CROSS)objcopy +OBJDUMP = $(CROSS)objdump +STRIP = $(CROSS)strip +READELF = $(CROSS)readelf +GCOV = $(CROSS)gcov + +ifeq ("$(origin CC)", "command line") +HOSTCC = $(CC) +else +HOSTCC = gcc +endif +HOSTAS = as + +TOOLCHAIN_ASFLAGS = +TOOLCHAIN_CFLAGS = +TOOLCHAIN_LDFLAGS = + +ifeq ($(CONFIG_RTE_LIBRTE_GCOV),y) +TOOLCHAIN_CFLAGS += --coverage +TOOLCHAIN_LDFLAGS += --coverage +ifeq (,$(findstring -O0,$(EXTRA_CFLAGS))) + $(warning "EXTRA_CFLAGS doesn't contains -O0, coverage will be inaccurate with optimizations enabled") +endif +endif + +WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes +WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith +WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual +WERROR_FLAGS += -Wformat-nonliteral -Wformat-security +WERROR_FLAGS += -Wundef -Wwrite-strings -Wdeprecated + +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror +endif + +# There are many issues reported for strict alignment architectures +# which are not necessarily fatal. Report as warnings. +ifeq ($(CONFIG_RTE_ARCH_STRICT_ALIGN),y) +WERROR_FLAGS += -Wno-error=cast-align +endif + +# process cpu flags +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk + +# workaround GCC bug with warning "missing initializer" for "= {0}" +ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) +WERROR_FLAGS += -Wno-missing-field-initializers +endif +# workaround GCC bug with warning "may be used uninitialized" +ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) +WERROR_FLAGS += -Wno-uninitialized +endif + +HOST_WERROR_FLAGS := $(WERROR_FLAGS) + +ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1) +# Tell GCC only to error for switch fallthroughs without a suitable comment +HOST_WERROR_FLAGS += -Wimplicit-fallthrough=2 +# Ignore errors for snprintf truncation +HOST_WERROR_FLAGS += -Wno-format-truncation +endif + +ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1) +# Tell GCC only to error for switch fallthroughs without a suitable comment +WERROR_FLAGS += -Wimplicit-fallthrough=2 +# Ignore errors for snprintf truncation +WERROR_FLAGS += -Wno-format-truncation +endif + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS diff --git a/src/spdk/dpdk/mk/toolchain/icc/rte.toolchain-compat.mk b/src/spdk/dpdk/mk/toolchain/icc/rte.toolchain-compat.mk new file mode 100644 index 00000000..2d663b34 --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/icc/rte.toolchain-compat.mk @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# CPUID-related options +# +# This was added to support compiler versions which might not support all the +# flags we need +# + +# find out ICC version + +ICC_MAJOR_VERSION = $(shell icc -dumpversion | cut -f1 -d.) + +ifeq ($(shell test $(ICC_MAJOR_VERSION) -lt 12 && echo 1), 1) + MACHINE_CFLAGS = -xSSE4.2 +$(warning You are not using ICC 12.x or higher. This is neither supported, nor tested.) + +else +# proceed to adjust compiler flags + + ICC_MINOR_VERSION = $(shell icc -dumpversion | cut -f2 -d.) + +# replace GCC flags with ICC flags + # if icc version >= 12 + ifeq ($(shell test $(ICC_MAJOR_VERSION) -ge 12 && echo 1), 1) + # Atom + MACHINE_CFLAGS := $(patsubst -march=atom,-xSSSE3_ATOM -march=atom,$(MACHINE_CFLAGS)) + # nehalem/westmere + MACHINE_CFLAGS := $(patsubst -march=corei7,-xSSE4.2 -march=corei7,$(MACHINE_CFLAGS)) + # sandy bridge + MACHINE_CFLAGS := $(patsubst -march=corei7-avx,-xAVX,$(MACHINE_CFLAGS)) + # ivy bridge + MACHINE_CFLAGS := $(patsubst -march=core-avx-i,-xCORE-AVX-I,$(MACHINE_CFLAGS)) + # hsw + MACHINE_CFLAGS := $(patsubst -march=core-avx2,-xCORE-AVX2,$(MACHINE_CFLAGS)) + # remove westmere flags + MACHINE_CFLAGS := $(filter-out -mpclmul -maes,$(MACHINE_CFLAGS)) + endif + # if icc version == 12.0 + ifeq ($(shell test $(ICC_MAJOR_VERSION) -eq 12 && test $(ICC_MINOR_VERSION) -eq 0 && echo 1), 1) + # Atom + MACHINE_CFLAGS := $(patsubst -xSSSE3_ATOM,-xSSE3_ATOM,$(MACHINE_CFLAGS)) + # remove march options + MACHINE_CFLAGS := $(patsubst -march=%,-xSSE3,$(MACHINE_CFLAGS)) + endif + + # Disable thunderx PMD for icc <= 16.0 + ifeq ($(shell test $(ICC_MAJOR_VERSION) -le 16 && echo 1), 1) + CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d + endif + + # Disable event/opdl PMD for icc <= 16.0 + ifeq ($(shell test $(ICC_MAJOR_VERSION) -le 16 && echo 1), 1) + CONFIG_RTE_LIBRTE_PMD_OPDL_EVENTDEV=d + endif + +endif diff --git a/src/spdk/dpdk/mk/toolchain/icc/rte.vars.mk b/src/spdk/dpdk/mk/toolchain/icc/rte.vars.mk new file mode 100644 index 00000000..aa1422bf --- /dev/null +++ b/src/spdk/dpdk/mk/toolchain/icc/rte.vars.mk @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2010-2014 Intel Corporation + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overridden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value) +# + +# Warning: we do not use CROSS environment variable as icc is mainly a +# x86->x86 compiler + +CC = icc +KERNELCC = gcc +CPP = cpp +AS = nasm +AR = ar +LD = ld +OBJCOPY = objcopy +OBJDUMP = objdump +STRIP = strip +READELF = readelf + +ifeq ($(KERNELRELEASE),) +HOSTCC = icc +else +HOSTCC = gcc +endif +HOSTAS = as + +TOOLCHAIN_CFLAGS = +TOOLCHAIN_LDFLAGS = +TOOLCHAIN_ASFLAGS = + +# Turn off some ICC warnings - +# Remark #271 : trailing comma is nonstandard +# Warning #1478 : function "<func_name>" (declared at line N of "<filename>") +# error #13368: loop was not vectorized with "vector always assert" +# error #15527: loop was not vectorized: function call to fprintf cannot be vectorize +# was declared "deprecated" +# Warning #11074, 11076: to prevent "inline-max-size" warnings. +WERROR_FLAGS := -Wall -w2 -diag-disable 271 -diag-warning 1478 +WERROR_FLAGS += -diag-disable 13368 -diag-disable 15527 +WERROR_FLAGS += -diag-disable 188 +WERROR_FLAGS += -diag-disable 11074 -diag-disable 11076 -Wdeprecated + +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror-all +endif + +# process cpu flags +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS |