]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/mk/target/generic/rte.vars.mk
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / mk / target / generic / rte.vars.mk
CommitLineData
11fdf7f2
TL
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2010-2014 Intel Corporation
3
4#
5# This .mk is the generic target rte.var.mk ; it includes .mk for
6# the specified machine, architecture, toolchain (compiler) and
7# executive environment.
8#
9
9f95a23c
TL
10#
11# toolchain:
12#
13# - define CC, LD, AR, AS, ...
14# - define TOOLCHAIN_CFLAGS variable (overridden by cmdline value)
15# - define TOOLCHAIN_LDFLAGS variable (overridden by cmdline value)
16# - define TOOLCHAIN_ASFLAGS variable (overridden by cmdline value)
17# - may override any previously defined variable
18#
19include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.vars.mk
20
11fdf7f2
TL
21#
22# machine:
23#
24# - can define ARCH variable (overridden by cmdline value)
25# - can define CROSS variable (overridden by cmdline value)
26# - define MACHINE_CFLAGS variable (overridden by cmdline value)
27# - define MACHINE_LDFLAGS variable (overridden by cmdline value)
28# - define MACHINE_ASFLAGS variable (overridden by cmdline value)
29# - can define CPU_CFLAGS variable (overridden by cmdline value) that
30# overrides the one defined in arch.
31# - can define CPU_LDFLAGS variable (overridden by cmdline value) that
32# overrides the one defined in arch.
33# - can define CPU_ASFLAGS variable (overridden by cmdline value) that
34# overrides the one defined in arch.
35#
36ifneq ($(wildcard $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk),)
37include $(RTE_SDK)/mk/machine/$(RTE_MACHINE)/rte.vars.mk
38else
39MACHINE_CFLAGS := -march=$(RTE_MACHINE)
40endif
41
42#
43# arch:
44#
45# - define ARCH variable (overridden by cmdline or by previous
46# optional define in machine .mk)
47# - define CROSS variable (overridden by cmdline or previous define
48# in machine .mk)
49# - define CPU_CFLAGS variable (overridden by cmdline or previous
50# define in machine .mk)
51# - define CPU_LDFLAGS variable (overridden by cmdline or previous
52# define in machine .mk)
53# - define CPU_ASFLAGS variable (overridden by cmdline or previous
54# define in machine .mk)
55# - may override any previously defined variable
56#
57include $(RTE_SDK)/mk/arch/$(RTE_ARCH)/rte.vars.mk
58
11fdf7f2
TL
59#
60# exec-env:
61#
62# - define EXECENV_CFLAGS variable (overridden by cmdline)
63# - define EXECENV_LDFLAGS variable (overridden by cmdline)
64# - define EXECENV_ASFLAGS variable (overridden by cmdline)
65# - may override any previously defined variable
66#
67include $(RTE_SDK)/mk/exec-env/$(RTE_EXEC_ENV)/rte.vars.mk
68
69# Don't set CFLAGS/LDFLAGS flags for kernel module, all flags are
70# provided by Kbuild framework.
71ifeq ($(KERNELRELEASE),)
72
73# now that the environment is mostly set up, including the machine type we will
74# be passing to the compiler, set up the specific CPU flags based on that info.
75include $(RTE_SDK)/mk/rte.cpuflags.mk
76
77# merge all CFLAGS
78CFLAGS := $(CPU_CFLAGS) $(EXECENV_CFLAGS) $(TOOLCHAIN_CFLAGS) $(MACHINE_CFLAGS)
79CFLAGS += $(TARGET_CFLAGS)
80
81# merge all LDFLAGS
82LDFLAGS := $(CPU_LDFLAGS) $(EXECENV_LDFLAGS) $(TOOLCHAIN_LDFLAGS) $(MACHINE_LDFLAGS)
83LDFLAGS += $(TARGET_LDFLAGS)
84
85# merge all ASFLAGS
86ASFLAGS := $(CPU_ASFLAGS) $(EXECENV_ASFLAGS) $(TOOLCHAIN_ASFLAGS) $(MACHINE_ASFLAGS)
87ASFLAGS += $(TARGET_ASFLAGS)
88
89# add default include and lib paths
90CFLAGS += -I$(RTE_OUTPUT)/include
91LDFLAGS += -L$(RTE_OUTPUT)/lib
92
f67539c2
TL
93# add in flag for supporting function versioning. The define is used in meson
94# builds to ensure that the user has properly flagged the unit in question as
95# using function versioning so it can be built twice - once for static lib and
96# then a second time for the shared lib. Since make only builds one library
97# type at a time, such precautions aren't necessary, so we can globally define
98# the flag
99CFLAGS += -DRTE_USE_FUNCTION_VERSIONING
100
11fdf7f2
TL
101# always include rte_config.h: the one in $(RTE_OUTPUT)/include is
102# the configuration of SDK when $(BUILDING_RTE_SDK) is true, or the
103# configuration of the application if $(BUILDING_RTE_SDK) is not
104# defined.
105ifeq ($(BUILDING_RTE_SDK),1)
106# building sdk
107CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
f67539c2
TL
108CFLAGS += -DALLOW_EXPERIMENTAL_API
109CFLAGS += -DALLOW_INTERNAL_API
11fdf7f2
TL
110else
111# if we are building an external application, include SDK's lib and
112# includes too
113CFLAGS += -I$(RTE_SDK_BIN)/include
114ifneq ($(wildcard $(RTE_OUTPUT)/include/rte_config.h),)
115CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
116endif
117CFLAGS += -include $(RTE_SDK_BIN)/include/rte_config.h
118LDFLAGS += -L$(RTE_SDK_BIN)/lib
119endif
120
9f95a23c
TL
121# always define _GNU_SOURCE
122CFLAGS += -D_GNU_SOURCE
123
f67539c2
TL
124# define __BSD_VISIBLE when building for FreeBSD
125ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
126CFLAGS += -D__BSD_VISIBLE
127endif
128
11fdf7f2
TL
129export CFLAGS
130export LDFLAGS
131
132endif