diff options
author | C.J. Collier <cjcollier@linuxfoundation.org> | 2016-06-14 07:50:17 -0700 |
---|---|---|
committer | C.J. Collier <cjcollier@linuxfoundation.org> | 2016-06-14 12:17:54 -0700 |
commit | 97f17497d162afdb82c8704bf097f0fee3724b2e (patch) | |
tree | 1c6269614c0c15ffef8451c58ae8f8b30a1bc804 /mk | |
parent | e04be89c2409570e0055b2cda60bd11395bb93b0 (diff) |
Imported Upstream version 16.04
Change-Id: I77eadcd8538a9122e4773cbe55b24033dc451757
Signed-off-by: C.J. Collier <cjcollier@linuxfoundation.org>
Diffstat (limited to 'mk')
72 files changed, 5734 insertions, 0 deletions
diff --git a/mk/arch/arm/rte.vars.mk b/mk/arch/arm/rte.vars.mk new file mode 100644 index 00000000..bd85140e --- /dev/null +++ b/mk/arch/arm/rte.vars.mk @@ -0,0 +1,39 @@ +# BSD LICENSE +# +# Copyright (C) 2015 RehiveTech. All rights reserved. +# +# 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 RehiveTech 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 ?= arm +CROSS ?= + +CPU_CFLAGS ?= -marm -munaligned-access +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= -felf + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS diff --git a/mk/arch/arm64/rte.vars.mk b/mk/arch/arm64/rte.vars.mk new file mode 100644 index 00000000..32e3a5fd --- /dev/null +++ b/mk/arch/arm64/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright (C) Cavium networks 2015. All rights reserved. +# +# 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 Cavium networks 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: +# +# - 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 diff --git a/mk/arch/i686/rte.vars.mk b/mk/arch/i686/rte.vars.mk new file mode 100644 index 00000000..8ba9a230 --- /dev/null +++ b/mk/arch/i686/rte.vars.mk @@ -0,0 +1,59 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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: +# +# - define ARCH variable (overriden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overriden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overriden 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 diff --git a/mk/arch/ppc_64/rte.vars.mk b/mk/arch/ppc_64/rte.vars.mk new file mode 100644 index 00000000..363fcd14 --- /dev/null +++ b/mk/arch/ppc_64/rte.vars.mk @@ -0,0 +1,39 @@ +# 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 diff --git a/mk/arch/tile/rte.vars.mk b/mk/arch/tile/rte.vars.mk new file mode 100644 index 00000000..5ad37389 --- /dev/null +++ b/mk/arch/tile/rte.vars.mk @@ -0,0 +1,39 @@ +# BSD LICENSE +# +# Copyright (C) EZchip Semiconductor Ltd. 2015. +# +# 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 EZchip Semiconductor 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 ?= tile +CROSS ?= + +CPU_CFLAGS ?= +CPU_LDFLAGS ?= +CPU_ASFLAGS ?= + +export ARCH CROSS CPU_CFLAGS CPU_LDFLAGS CPU_ASFLAGS diff --git a/mk/arch/x86_64/rte.vars.mk b/mk/arch/x86_64/rte.vars.mk new file mode 100644 index 00000000..b986f04b --- /dev/null +++ b/mk/arch/x86_64/rte.vars.mk @@ -0,0 +1,59 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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: +# +# - define ARCH variable (overriden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overriden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overriden 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 diff --git a/mk/arch/x86_x32/rte.vars.mk b/mk/arch/x86_x32/rte.vars.mk new file mode 100644 index 00000000..3103dfc9 --- /dev/null +++ b/mk/arch/x86_x32/rte.vars.mk @@ -0,0 +1,63 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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: +# +# - 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 diff --git a/mk/exec-env/bsdapp/rte.app.mk b/mk/exec-env/bsdapp/rte.app.mk new file mode 100644 index 00000000..df21af98 --- /dev/null +++ b/mk/exec-env/bsdapp/rte.app.mk @@ -0,0 +1,36 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +exec-env-appinstall: + @true + +exec-env-appclean: + @true diff --git a/mk/exec-env/bsdapp/rte.vars.mk b/mk/exec-env/bsdapp/rte.vars.mk new file mode 100644 index 00000000..47a673e7 --- /dev/null +++ b/mk/exec-env/bsdapp/rte.vars.mk @@ -0,0 +1,61 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# exec-env: +# +# - define EXECENV_CFLAGS variable (overriden by cmdline) +# - define EXECENV_LDFLAGS variable (overriden by cmdline) +# - define EXECENV_ASFLAGS variable (overriden 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/mk/exec-env/linuxapp/rte.app.mk b/mk/exec-env/linuxapp/rte.app.mk new file mode 100644 index 00000000..df21af98 --- /dev/null +++ b/mk/exec-env/linuxapp/rte.app.mk @@ -0,0 +1,36 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +exec-env-appinstall: + @true + +exec-env-appclean: + @true diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk new file mode 100644 index 00000000..d51bd170 --- /dev/null +++ b/mk/exec-env/linuxapp/rte.vars.mk @@ -0,0 +1,66 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# exec-env: +# +# - define EXECENV_CFLAGS variable (overriden by cmdline) +# - define EXECENV_LDFLAGS variable (overriden by cmdline) +# - define EXECENV_ASFLAGS variable (overriden 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 + +# Workaround lack of DT_NEEDED entry +EXECENV_LDFLAGS = --no-as-needed + +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/mk/internal/rte.build-post.mk b/mk/internal/rte.build-post.mk new file mode 100644 index 00000000..62b1129c --- /dev/null +++ b/mk/internal/rte.build-post.mk @@ -0,0 +1,62 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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/mk/internal/rte.build-pre.mk b/mk/internal/rte.build-pre.mk new file mode 100644 index 00000000..560cf829 --- /dev/null +++ b/mk/internal/rte.build-pre.mk @@ -0,0 +1,35 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +_BUILD_TARGETS := _prebuild _build _postbuild + +comma := , +linkerprefix = $(subst -Wl$(comma)-L,-L,$(addprefix -Wl$(comma),$1)) diff --git a/mk/internal/rte.clean-post.mk b/mk/internal/rte.clean-post.mk new file mode 100644 index 00000000..d6c98ab6 --- /dev/null +++ b/mk/internal/rte.clean-post.mk @@ -0,0 +1,62 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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/mk/internal/rte.clean-pre.mk b/mk/internal/rte.clean-pre.mk new file mode 100644 index 00000000..3147e23c --- /dev/null +++ b/mk/internal/rte.clean-pre.mk @@ -0,0 +1,32 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +_CLEAN_TARGETS := _preclean _clean _postclean diff --git a/mk/internal/rte.compile-post.mk b/mk/internal/rte.compile-post.mk new file mode 100644 index 00000000..fd366c62 --- /dev/null +++ b/mk/internal/rte.compile-post.mk @@ -0,0 +1,33 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# no rule no build these files +$(DEPS-y) $(CMDS-y): diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk new file mode 100644 index 00000000..b9bff4a7 --- /dev/null +++ b/mk/internal/rte.compile-pre.mk @@ -0,0 +1,176 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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_CFLAGS) \ + $(CFLAGS_$(@)) $(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 $(CFLAGS) \ + $(CFLAGS_$(@)) $(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 +C_TO_O_CMD = 'cmd_$@ = $(C_TO_O_STR)' +C_TO_O_DO = @set -e; \ + echo $(C_TO_O_DISP); \ + $(C_TO_O) && \ + 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/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk new file mode 100644 index 00000000..fc6904dd --- /dev/null +++ b/mk/internal/rte.depdirs-post.mk @@ -0,0 +1,42 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +.PHONY: depdirs +depdirs: + @for d in $(DEPDIRS-y); do \ + $(RTE_SDK)/scripts/depdirs-rule.sh $(S) $$d ; \ + done + +.PHONY: depgraph +depgraph: + @for d in $(DEPDIRS-y); do \ + echo " \"$(S)\" -> \"$$d\"" ; \ + done diff --git a/mk/internal/rte.depdirs-pre.mk b/mk/internal/rte.depdirs-pre.mk new file mode 100644 index 00000000..8825db03 --- /dev/null +++ b/mk/internal/rte.depdirs-pre.mk @@ -0,0 +1,32 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# nothing diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk new file mode 100644 index 00000000..e2462fd2 --- /dev/null +++ b/mk/internal/rte.extvars.mk @@ -0,0 +1,83 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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)/Makefile +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/mk/internal/rte.install-post.mk b/mk/internal/rte.install-post.mk new file mode 100644 index 00000000..77addee2 --- /dev/null +++ b/mk/internal/rte.install-post.mk @@ -0,0 +1,99 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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)/scripts/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/mk/internal/rte.install-pre.mk b/mk/internal/rte.install-pre.mk new file mode 100644 index 00000000..0a8712f7 --- /dev/null +++ b/mk/internal/rte.install-pre.mk @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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/mk/machine/armv7a/rte.vars.mk b/mk/machine/armv7a/rte.vars.mk new file mode 100644 index 00000000..abdb15e5 --- /dev/null +++ b/mk/machine/armv7a/rte.vars.mk @@ -0,0 +1,65 @@ +# BSD LICENSE +# +# Copyright (C) 2015 RehiveTech. All rights reserved. +# +# 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 RehiveTech 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 = + +CPU_CFLAGS += -mfloat-abi=softfp + +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/mk/machine/armv8a/rte.vars.mk b/mk/machine/armv8a/rte.vars.mk new file mode 100644 index 00000000..d5049e1f --- /dev/null +++ b/mk/machine/armv8a/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright (C) Cavium networks 2015. All rights reserved. +# +# 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 Cavium networks 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 += -march=armv8-a+crc diff --git a/mk/machine/atm/rte.vars.mk b/mk/machine/atm/rte.vars.mk new file mode 100644 index 00000000..d6fbba0f --- /dev/null +++ b/mk/machine/atm/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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=atom diff --git a/mk/machine/default/rte.vars.mk b/mk/machine/default/rte.vars.mk new file mode 100644 index 00000000..53c6af6e --- /dev/null +++ b/mk/machine/default/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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=core2 diff --git a/mk/machine/hsw/rte.vars.mk b/mk/machine/hsw/rte.vars.mk new file mode 100644 index 00000000..eedc5d02 --- /dev/null +++ b/mk/machine/hsw/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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/mk/machine/ivb/rte.vars.mk b/mk/machine/ivb/rte.vars.mk new file mode 100644 index 00000000..932241af --- /dev/null +++ b/mk/machine/ivb/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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/mk/machine/native/rte.vars.mk b/mk/machine/native/rte.vars.mk new file mode 100644 index 00000000..6ce0c723 --- /dev/null +++ b/mk/machine/native/rte.vars.mk @@ -0,0 +1,70 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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),) + CPU_SSE42_SUPPORT = $(shell grep SSE4\.2 /var/run/dmesg.boot 2>/dev/null) + ifneq ($(CPU_SSE42_SUPPORT),) + MACHINE_CFLAGS = -march=corei7 + endif +endif diff --git a/mk/machine/nhm/rte.vars.mk b/mk/machine/nhm/rte.vars.mk new file mode 100644 index 00000000..9566efd7 --- /dev/null +++ b/mk/machine/nhm/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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/mk/machine/power8/rte.vars.mk b/mk/machine/power8/rte.vars.mk new file mode 100644 index 00000000..6e9483c6 --- /dev/null +++ b/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/mk/machine/snb/rte.vars.mk b/mk/machine/snb/rte.vars.mk new file mode 100644 index 00000000..a9c1b7ca --- /dev/null +++ b/mk/machine/snb/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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/mk/machine/thunderx/rte.vars.mk b/mk/machine/thunderx/rte.vars.mk new file mode 100644 index 00000000..81da1b4c --- /dev/null +++ b/mk/machine/thunderx/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright (C) Cavium networks 2015. All rights reserved. +# +# 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 Cavium networks 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 ?= aarch64-thunderx-linux-gnu- +# MACHINE_CFLAGS = +# MACHINE_LDFLAGS = +# MACHINE_ASFLAGS = +# CPU_CFLAGS = +# CPU_LDFLAGS = +# CPU_ASFLAGS = + +MACHINE_CFLAGS += -march=armv8-a+crc -mcpu=thunderx diff --git a/mk/machine/tilegx/rte.vars.mk b/mk/machine/tilegx/rte.vars.mk new file mode 100644 index 00000000..c8256f12 --- /dev/null +++ b/mk/machine/tilegx/rte.vars.mk @@ -0,0 +1,57 @@ +# BSD LICENSE +# +# Copyright (C) EZchip Semiconductor Ltd. 2015. +# +# 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 EZchip Semiconductor 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/mk/machine/wsm/rte.vars.mk b/mk/machine/wsm/rte.vars.mk new file mode 100644 index 00000000..c8a266ca --- /dev/null +++ b/mk/machine/wsm/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden 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/mk/machine/xgene1/rte.vars.mk b/mk/machine/xgene1/rte.vars.mk new file mode 100644 index 00000000..419c2343 --- /dev/null +++ b/mk/machine/xgene1/rte.vars.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright (C) Cavium networks 2015. All rights reserved. +# +# 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 Cavium networks 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 += -march=armv8-a diff --git a/mk/rte.app.mk b/mk/rte.app.mk new file mode 100644 index 00000000..c66e491d --- /dev/null +++ b/mk/rte.app.mk @@ -0,0 +1,293 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. +# Copyright(c) 2014-2015 6WIND S.A. +# All rights reserved. +# +# 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 Intel 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. + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 + +# default path for libs +_LDLIBS-y += -L$(RTE_SDK_BIN)/lib + +# +# Order is important: from higher level to lower level +# + +_LDLIBS-y += --whole-archive + +_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor +_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder + +ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni +_LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem +endif + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += -lrte_pipeline +_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += -lrte_table +_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += -lrte_port +_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer +_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH) += -lrte_hash +_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += -lrte_jobstats +_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm +_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power +_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost + +# The static libraries do not know their dependencies. +# So linking with static library requires explicit dependencies. +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma +endif +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse +endif +_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lz +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lsze2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore +_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lm +# QAT / AESNI GCM PMDs are dependent on libcrypto (from openssl) +# for calculating HMAC precomputes +ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT),y) +_LDLIBS-y += -lcrypto +else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) +_LDLIBS-y += -lcrypto +endif +endif # !CONFIG_RTE_BUILD_SHARED_LIBS + +_LDLIBS-y += --start-group + +_LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf +_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag +_LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER) += -lethdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += -lrte_cryptodev +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +_LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal +_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline +_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +# plugins (link only if static libraries) + +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x +_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e +_LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k +_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null + +ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto + +# AESNI MULTI BUFFER / GCM PMDs are dependent on the IPSec_MB library +ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_MB),y) +_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) +_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +endif + +# SNOW3G PMD is dependent on the LIBSSO library +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso +endif # CONFIG_RTE_LIBRTE_CRYPTODEV + +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost + +endif # $(CONFIG_RTE_LIBRTE_VHOST) + +endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) + +_LDLIBS-y += $(EXECENV_LDLIBS) +_LDLIBS-y += --end-group +_LDLIBS-y += --no-whole-archive + +LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS) + +# Eliminate duplicates without sorting +LDLIBS := $(shell echo $(LDLIBS) | \ + awk '{for (i = 1; i <= NF; i++) { if (!seen[$$i]++) print $$i }}') + +.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_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ + -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \ + $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS)) +else +O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS) +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 := $(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 + + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk new file mode 100644 index 00000000..86b92ff5 --- /dev/null +++ b/mk/rte.bsdmodule.mk @@ -0,0 +1,119 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +##### 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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: + +endif diff --git a/mk/rte.combinedlib.mk b/mk/rte.combinedlib.mk new file mode 100644 index 00000000..449358b3 --- /dev/null +++ b/mk/rte.combinedlib.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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), $(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/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk new file mode 100644 index 00000000..e634abc3 --- /dev/null +++ b/mk/rte.cpuflags.mk @@ -0,0 +1,131 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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__),) +CPUFLAGS += AVX +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__),) +CPUFLAGS += AVX2 +endif + +ifneq ($(filter $(AUTO_CPUFLAGS),__AVX512F__),) +CPUFLAGS += AVX512F +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 + + +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/mk/rte.extapp.mk b/mk/rte.extapp.mk new file mode 100644 index 00000000..b4d1ef6c --- /dev/null +++ b/mk/rte.extapp.mk @@ -0,0 +1,52 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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/mk/rte.extlib.mk b/mk/rte.extlib.mk new file mode 100644 index 00000000..f58d96cd --- /dev/null +++ b/mk/rte.extlib.mk @@ -0,0 +1,54 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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/mk/rte.extobj.mk b/mk/rte.extobj.mk new file mode 100644 index 00000000..253de280 --- /dev/null +++ b/mk/rte.extobj.mk @@ -0,0 +1,52 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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/mk/rte.extshared.mk b/mk/rte.extshared.mk new file mode 100644 index 00000000..0d8abbe3 --- /dev/null +++ b/mk/rte.extshared.mk @@ -0,0 +1,53 @@ +# BSD LICENSE +# +# Copyright 2012-2013 6WIND S.A. +# +# 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 6WIND S.A. 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. + +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/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk new file mode 100644 index 00000000..f50f0062 --- /dev/null +++ b/mk/rte.extsubdir.mk @@ -0,0 +1,53 @@ +# BSD LICENSE +# +# Copyright(c) 2014 6WIND S.A. +# +# 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 6WIND S.A. 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. + +MAKEFLAGS += --no-print-directory + +# output directory +O ?= . +BASE_OUTPUT ?= $(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)) diff --git a/mk/rte.gnuconfigure.mk b/mk/rte.gnuconfigure.mk new file mode 100644 index 00000000..65b658c1 --- /dev/null +++ b/mk/rte.gnuconfigure.mk @@ -0,0 +1,74 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk new file mode 100644 index 00000000..c44d0f8a --- /dev/null +++ b/mk/rte.hostapp.mk @@ -0,0 +1,123 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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 +include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +_BUILD = $(HOSTAPP) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/hostapp/$(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 := $(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)/hostapp/$(HOSTAPP): $(HOSTAPP) + @echo " INSTALL-HOSTAPP $(HOSTAPP)" + @[ -d $(RTE_OUTPUT)/hostapp ] || mkdir -p $(RTE_OUTPUT)/hostapp + $(Q)cp -f $(HOSTAPP) $(RTE_OUTPUT)/hostapp + +# +# 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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.hostlib.mk b/mk/rte.hostlib.mk new file mode 100644 index 00000000..fe24049f --- /dev/null +++ b/mk/rte.hostlib.mk @@ -0,0 +1,116 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# 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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.install.mk b/mk/rte.install.mk new file mode 100644 index 00000000..e7ac4d5b --- /dev/null +++ b/mk/rte.install.mk @@ -0,0 +1,58 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# install-only makefile (no build target) + +include $(RTE_SDK)/mk/internal/rte.install-pre.mk +include $(RTE_SDK)/mk/internal/rte.clean-pre.mk +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk new file mode 100644 index 00000000..8f7e021c --- /dev/null +++ b/mk/rte.lib.mk @@ -0,0 +1,192 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk + +EXTLIB_BUILD ?= n + +# VPATH contains at least SRCDIR +VPATH += $(SRCDIR) + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB)) +ifeq ($(EXTLIB_BUILD),n) +ifeq ($(CONFIG_RTE_NEXT_ABI),y) +LIB := $(LIB).1 +endif +CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP) +endif +endif + + +_BUILD = $(LIB) +_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB) +_CLEAN = doclean + +.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 the definition of LD here, since we're linking with CC +LD := $(CC) $(CPU_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,$(@)) + +O_TO_S = $(LD) $(_CPU_LDFLAGS) $(EXTRA_LDFLAGS) -shared $(OBJS-y) $(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,$(@)) + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +O_TO_C = $(AR) crus $(LIB_ONE) $(OBJS-y) +O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight +O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," AR_C $(@)") +O_TO_C_DO = @set -e; \ + $(lib_dir) \ + $(copy_obj) +else +O_TO_C = $(LD) -shared $(OBJS-y) -o $(LIB_ONE) +O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight +O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," LD_C $(@)") +O_TO_C_DO = @set -e; \ + $(lib_dir) \ + $(copy_obj) +endif + +copy_obj = cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib; +lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib; +-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) +ifeq ($(CONFIG_RTE_NEXT_ABI)$(EXTLIB_BUILD),yn) + $(Q)ln -s -f $< $(basename $(basename $@)) +else + $(Q)ln -s -f $< $(basename $@) +endif +endif + +# +# Clean all generated files +# +.PHONY: clean +clean: _postclean + +.PHONY: doclean +doclean: + $(Q)rm -rf $(LIB) $(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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.module.mk b/mk/rte.module.mk new file mode 100644 index 00000000..53ed4fe9 --- /dev/null +++ b/mk/rte.module.mk @@ -0,0 +1,116 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +##### 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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: + +endif diff --git a/mk/rte.obj.mk b/mk/rte.obj.mk new file mode 100644 index 00000000..5982227d --- /dev/null +++ b/mk/rte.obj.mk @@ -0,0 +1,112 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk new file mode 100644 index 00000000..eec52412 --- /dev/null +++ b/mk/rte.sdkbuild.mk @@ -0,0 +1,103 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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 + +# +# include .depdirs and define rules to order priorities between build +# of directories. +# +-include $(RTE_OUTPUT)/.depdirs + +define depdirs_rule +$(1): $(sort $(LOCAL_DEPDIRS-$(1))) +endef + +$(foreach d,$(ROOTDIRS-y),$(eval $(call depdirs_rule,$(d)))) + +# +# 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)/hostapp $(RTE_OUTPUT)/lib \ + $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod + @[ -d $(RTE_OUTPUT)/include ] || mkdir -p $(RTE_OUTPUT)/include + @$(RTE_SDK)/scripts/gen-config-h.sh $(RTE_OUTPUT)/.config \ + > $(RTE_OUTPUT)/include/rte_config.h + $(Q)$(MAKE) -f $(RTE_SDK)/GNUmakefile gcovclean + @echo Clean complete + +.SECONDEXPANSION: +.PHONY: $(ROOTDIRS-y) +$(ROOTDIRS-y): + @[ -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,$(FULL_DEPDIRS-$(*))) + @echo $(addsuffix _sub,$(FULL_DEPDIRS-$(*))) + @[ -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/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk new file mode 100644 index 00000000..a3acfe64 --- /dev/null +++ b/mk/rte.sdkconfig.mk @@ -0,0 +1,135 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +.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. " + @echo "Use T=template among the following list:" + @$(MAKE) -rR showconfigs | sed 's,^, ,' + +.PHONY: config +ifeq ($(RTE_CONFIG_TEMPLATE),) +config: notemplate +else +config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile + $(Q)$(MAKE) depdirs + @echo "Configuration done" +endif + +$(RTE_OUTPUT): + $(Q)mkdir -p $@ + +ifdef NODOTCONF +$(RTE_OUTPUT)/.config: ; +else +$(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) ; \ + 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)/scripts/relpath.sh $(abspath $(RTE_SRCDIR)) \ + $(abspath $(RTE_OUTPUT))) +OUTPUT_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_OUTPUT)) \ + $(abspath $(RTE_SRCDIR))) +$(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT) + $(Q)$(RTE_SDK)/scripts/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)/hostapp $(RTE_OUTPUT)/lib \ + $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build + $(Q)mkdir -p $(RTE_OUTPUT)/include + $(Q)$(RTE_SDK)/scripts/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 + $(Q)$(MAKE) -s depdirs + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk new file mode 100644 index 00000000..bebaf2a2 --- /dev/null +++ b/mk/rte.sdkdepdirs.mk @@ -0,0 +1,64 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +ifeq (,$(wildcard $(RTE_OUTPUT)/.config)) + $(error "need a make config first") +endif +ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile)) + $(error "need a make config first") +endif + +# use a "for" in a shell to process dependencies: we don't want this +# task to be run in parallel. +.PHONY: depdirs +depdirs: $(RTE_OUTPUT)/.depdirs +$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config + @rm -f $(RTE_OUTPUT)/.depdirs ; \ + for d in $(ROOTDIRS-y); do \ + if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \ + [ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \ + $(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \ + >> $(RTE_OUTPUT)/.depdirs ; \ + fi ; \ + done + +.PHONY: depgraph +depgraph: + @echo "digraph unix {" ; \ + echo " size=\"6,6\";" ; \ + echo " node [color=lightblue2, style=filled];" ; \ + for d in $(ROOTDIRS-y); do \ + echo " \"root\" -> \"$$d\"" ; \ + if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \ + $(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depgraph ; \ + fi ; \ + done ; \ + echo "}" diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk new file mode 100644 index 00000000..9952f258 --- /dev/null +++ b/mk/rte.sdkdoc.mk @@ -0,0 +1,119 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# Copyright(c) 2013-2015 6WIND S.A. +# All rights reserved. +# +# 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 Intel 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. + +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/*/)) + +.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 + +.PHONY: api-html +api-html: api-html-clean + @echo 'doxygen for API...' + $(Q)mkdir -p $(RTE_OUTPUT)/doc/html + $(Q)(cat $(RTE_SDK)/doc/api/doxy-api.conf && \ + printf 'PROJECT_NUMBER = ' && \ + $(MAKE) -rR showversion && \ + 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 $(RTE_OUTPUT)/doc/html/api/* + $(Q)rmdir -p --ignore-fail-on-non-empty $(RTE_OUTPUT)/doc/html/api 2>&- || true + +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-%: + @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/mk/rte.sdkexamples.mk b/mk/rte.sdkexamples.mk new file mode 100644 index 00000000..111ce91d --- /dev/null +++ b/mk/rte.sdkexamples.mk @@ -0,0 +1,77 @@ +# BSD LICENSE +# +# Copyright(c) 2014 6WIND S.A. +# +# 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 6WIND S.A. 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. + +# 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/mk/rte.sdkgcov.mk b/mk/rte.sdkgcov.mk new file mode 100644 index 00000000..fd20fd75 --- /dev/null +++ b/mk/rte.sdkgcov.mk @@ -0,0 +1,67 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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/mk/rte.sdkinstall.mk b/mk/rte.sdkinstall.mk new file mode 100644 index 00000000..68e56b68 --- /dev/null +++ b/mk/rte.sdkinstall.mk @@ -0,0 +1,161 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright 2015 6WIND S.A. +# All rights reserved. +# +# 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 Intel 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. + +# 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 +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)/scripts/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 + +install-runtime: + $(Q)$(call rte_mkdir, $(DESTDIR)$(libdir)) + $(Q)cp -a $O/lib/* $(DESTDIR)$(libdir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(bindir)) + $(Q)tar -cf - -C $O app --exclude 'app/*.map' \ + --exclude 'app/cmdline*' --exclude app/test \ + --exclude app/testacl --exclude app/testpipeline | \ + tar -xf - -C $(DESTDIR)$(bindir) --strip-components=1 \ + --keep-newer-files --warning=no-ignore-newer + $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)) + $(Q)cp -a $(RTE_SDK)/tools $(DESTDIR)$(datadir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(sbindir)) + $(Q)$(call rte_symlink, $(DESTDIR)$(datadir)/tools/dpdk_nic_bind.py, \ + $(DESTDIR)$(sbindir)/dpdk_nic_bind) + +install-kmod: +ifneq ($(wildcard $O/kmod/*),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(kerneldir)) + $(Q)cp -a $O/kmod/* $(DESTDIR)$(kerneldir) +endif + +install-sdk: + $(Q)$(call rte_mkdir, $(DESTDIR)$(includedir)) + $(Q)tar -chf - -C $O include | \ + tar -xf - -C $(DESTDIR)$(includedir) --strip-components=1 \ + --keep-newer-files --warning=no-ignore-newer + $(Q)$(call rte_mkdir, $(DESTDIR)$(sdkdir)) + $(Q)cp -a $(RTE_SDK)/mk $(DESTDIR)$(sdkdir) + $(Q)cp -a $(RTE_SDK)/scripts $(DESTDIR)$(sdkdir) + $(Q)$(call rte_mkdir, $(DESTDIR)$(targetdir)) + $(Q)cp -a $O/.config $(DESTDIR)$(targetdir) + $(Q)$(call rte_symlink, $(DESTDIR)$(includedir), $(DESTDIR)$(targetdir)/include) + $(Q)$(call rte_symlink, $(DESTDIR)$(libdir), $(DESTDIR)$(targetdir)/lib) + +install-doc: +ifneq ($(wildcard $O/doc),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)) + $(Q)tar -cf - -C $O/doc html --exclude 'html/guides/.*' | \ + tar -xf - -C $(DESTDIR)$(docdir) --strip-components=1 \ + --keep-newer-files --warning=no-ignore-newer +endif +ifneq ($(wildcard $O/doc/*/*/*pdf),) + $(Q)$(call rte_mkdir, $(DESTDIR)$(docdir)/guides) + $(Q)cp -a $O/doc/*/*/*pdf $(DESTDIR)$(docdir)/guides +endif + $(Q)$(call rte_mkdir, $(DESTDIR)$(datadir)) + $(Q)cp -a $(RTE_SDK)/examples $(DESTDIR)$(datadir) diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk new file mode 100644 index 00000000..55a9d8ae --- /dev/null +++ b/mk/rte.sdkroot.mk @@ -0,0 +1,124 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +MAKEFLAGS += --no-print-directory + +# define Q to '@' or not. $(Q) is used to prefix all shell commands to +# be executed silently. +Q=@ +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 showconfigs showversion showversionum +config showconfigs showversion showversionum: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk $@ + +.PHONY: test fast_test ring_test mempool_test perf_test coverage +test fast_test ring_test mempool_test perf_test coverage: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdktest.mk $@ + +.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: depdirs depgraph +depdirs depgraph: + $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdepdirs.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/mk/rte.sdktest.mk b/mk/rte.sdktest.mk new file mode 100644 index 00000000..ee25f280 --- /dev/null +++ b/mk/rte.sdktest.mk @@ -0,0 +1,84 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +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 fast_test + +coverage: BLACKLIST=-Mempool_perf,Memcpy_perf,Hash_perf +fast_test: BLACKLIST=-Ring_perf,Mempool_perf,Memcpy_perf,Hash_perf,Lpm6 +ring_test: WHITELIST=Ring,Ring_perf +mempool_test: WHITELIST=Mempool,Mempool_perf +perf_test:WHITELIST=Mempool_perf,Memcpy_perf,Hash_perf,Ring_perf +test fast_test ring_test mempool_test perf_test: + @mkdir -p $(AUTOTEST_DIR) ; \ + cd $(AUTOTEST_DIR) ; \ + if [ -f $(RTE_OUTPUT)/app/test ]; then \ + python $(RTE_SDK)/app/test/autotest.py \ + $(RTE_OUTPUT)/app/test \ + $(RTE_TARGET) \ + $(BLACKLIST) $(WHITELIST); \ + else \ + echo "No test found, please do a 'make 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_proc_info +coverage: + @mkdir -p $(AUTOTEST_DIR) ; \ + cd $(AUTOTEST_DIR) ; \ + if [ -f $(RTE_OUTPUT)/app/test ]; then \ + python $(RTE_SDK)/app/cmdline_test/cmdline_test.py \ + $(RTE_OUTPUT)/app/cmdline_test; \ + ulimit -S -n 100 ; \ + python $(RTE_SDK)/app/test/autotest.py \ + $(RTE_OUTPUT)/app/test \ + $(RTE_TARGET) \ + $(BLACKLIST) $(WHITELIST) ; \ + $(RTE_OUTPUT)/app/dpdk_proc_info --file-prefix=ring_perf -- -m; \ + else \ + echo "No test found, please do a 'make build' first, or specify O=" ;\ + fi diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk new file mode 100644 index 00000000..fc6b0b44 --- /dev/null +++ b/mk/rte.shared.mk @@ -0,0 +1,137 @@ +# BSD LICENSE +# +# Copyright 2012-2013 6WIND S.A. +# +# 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 6WIND S.A. 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. + +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 +include $(RTE_SDK)/mk/internal/rte.depdirs-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 := $(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 +include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk new file mode 100644 index 00000000..256e64e7 --- /dev/null +++ b/mk/rte.subdir.mk @@ -0,0 +1,112 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# .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 + +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) + +# +# include .depdirs and define rules to order priorities between build +# of directories. +# +include $(RTE_OUTPUT)/.depdirs + +define depdirs_rule +$(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1)))) +endef + +$(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d)))) + + +# use a "for" in a shell to process dependencies: we don't want this +# task to be run in parallel. +.PHONY: depdirs +depdirs: + @for d in $(DIRS-y); do \ + if [ -f $(SRCDIR)/$$d/Makefile ]; then \ + $(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \ + fi ; \ + done + +.PHONY: depgraph +depgraph: + @for d in $(DIRS-y); do \ + echo " \"$(S)\" -> \"$(S)/$$d\"" ; \ + if [ -f $(SRCDIR)/$$d/Makefile ]; then \ + $(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depgraph ; \ + fi ; \ + done + +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/mk/rte.vars.mk b/mk/rte.vars.mk new file mode 100644 index 00000000..28982a5f --- /dev/null +++ b/mk/rte.vars.mk @@ -0,0 +1,127 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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=@ +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 overriden 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/mk/target/generic/rte.app.mk b/mk/target/generic/rte.app.mk new file mode 100644 index 00000000..000219f2 --- /dev/null +++ b/mk/target/generic/rte.app.mk @@ -0,0 +1,41 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk new file mode 100644 index 00000000..75a616ab --- /dev/null +++ b/mk/target/generic/rte.vars.mk @@ -0,0 +1,144 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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 (overriden by cmdline value) +# - can define CROSS variable (overriden by cmdline value) +# - define MACHINE_CFLAGS variable (overriden by cmdline value) +# - define MACHINE_LDFLAGS variable (overriden by cmdline value) +# - define MACHINE_ASFLAGS variable (overriden by cmdline value) +# - can define CPU_CFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_LDFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# - can define CPU_ASFLAGS variable (overriden by cmdline value) that +# overrides the one defined in arch. +# +include $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk + +# +# arch: +# +# - define ARCH variable (overriden by cmdline or by previous +# optional define in machine .mk) +# - define CROSS variable (overriden by cmdline or previous define +# in machine .mk) +# - define CPU_CFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_LDFLAGS variable (overriden by cmdline or previous +# define in machine .mk) +# - define CPU_ASFLAGS variable (overriden 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 (overriden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overriden 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 (overriden by cmdline) +# - define EXECENV_LDFLAGS variable (overriden by cmdline) +# - define EXECENV_ASFLAGS variable (overriden 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 +ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y) +CFLAGS += -include rte_warnings.h +endif +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 +ifeq ($(CONFIG_RTE_INSECURE_FUNCTION_WARNING),y) +CFLAGS += -include rte_warnings.h +endif +LDFLAGS += -L$(RTE_SDK_BIN)/lib +endif + +export CFLAGS +export LDFLAGS + +endif diff --git a/mk/toolchain/clang/rte.toolchain-compat.mk b/mk/toolchain/clang/rte.toolchain-compat.mk new file mode 100644 index 00000000..f995b0b0 --- /dev/null +++ b/mk/toolchain/clang/rte.toolchain-compat.mk @@ -0,0 +1,43 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# CPUID-related options +# +# This was added to support compiler versions which might not support all the +# flags we need +# + +# find out CLANG version + +CLANG_MAJOR_VERSION = $(shell $(CC) -dumpversion | cut -f1 -d.) + +CLANG_MINOR_VERSION = $(shell $(CC) -dumpversion | cut -f2 -d.) diff --git a/mk/toolchain/clang/rte.vars.mk b/mk/toolchain/clang/rte.vars.mk new file mode 100644 index 00000000..7749b991 --- /dev/null +++ b/mk/toolchain/clang/rte.vars.mk @@ -0,0 +1,83 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overriden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overriden 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 + +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 + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk new file mode 100644 index 00000000..6eed20cc --- /dev/null +++ b/mk/toolchain/gcc/rte.toolchain-compat.mk @@ -0,0 +1,92 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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_VERSION = $(GCC_MAJOR)$(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)) + 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 +endif diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk new file mode 100644 index 00000000..ff70f3d9 --- /dev/null +++ b/mk/toolchain/gcc/rte.vars.mk @@ -0,0 +1,103 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overriden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overriden 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 + +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror +endif + +# There are many issues reported for ARMv7 architecture +# which are not necessarily fatal. Report as warnings. +ifeq ($(CONFIG_RTE_ARCH_ARMv7),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 + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS diff --git a/mk/toolchain/icc/rte.toolchain-compat.mk b/mk/toolchain/icc/rte.toolchain-compat.mk new file mode 100644 index 00000000..41344668 --- /dev/null +++ b/mk/toolchain/icc/rte.toolchain-compat.mk @@ -0,0 +1,75 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# 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 = -xSSE3 +$(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 +endif diff --git a/mk/toolchain/icc/rte.vars.mk b/mk/toolchain/icc/rte.vars.mk new file mode 100644 index 00000000..ba69f1f8 --- /dev/null +++ b/mk/toolchain/icc/rte.vars.mk @@ -0,0 +1,87 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# All rights reserved. +# +# 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 Intel 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. + +# +# toolchain: +# +# - define CC, LD, AR, AS, ... (overriden by cmdline value) +# - define TOOLCHAIN_CFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_LDFLAGS variable (overriden by cmdline value) +# - define TOOLCHAIN_ASFLAGS variable (overriden 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" +WERROR_FLAGS := -Wall -w2 -diag-disable 271 -diag-warning 1478 +WERROR_FLAGS += -diag-disable 13368 -diag-disable 15527 + +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror-all +endif + +# process cpu flags +include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk +# disable max-inline params boundaries for ICC compiler for version 15 and greater +ifeq ($(shell test $(ICC_MAJOR_VERSION) -ge 14 && echo 1), 1) + TOOLCHAIN_CFLAGS += -no-inline-max-size -no-inline-max-total-size +endif + +export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF +export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS |