]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/mk/rte.sdkconfig.mk
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / mk / rte.sdkconfig.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
3
4 .PHONY: showversion
5 showversion:
6 @cat $(RTE_SRCDIR)/VERSION
7
8 .PHONY: showversionum
9 showversionum:
10 @cat $(RTE_SRCDIR)/VERSION | awk -F '.' '{print $$1$$2}'
11
12 INSTALL_CONFIGS := $(sort $(filter-out %app-icc,$(filter-out %app-clang,\
13 $(filter-out %app-gcc,$(filter-out %~,\
14 $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
15 $(wildcard $(RTE_SRCDIR)/config/defconfig_*)))))))
16 INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS))
17
18 .PHONY: showconfigs
19 showconfigs:
20 @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);)
21
22 .PHONY: notemplate
23 notemplate:
24 @printf "No template specified. Use 'make defconfig' or "
25 @echo "use T=template from the following list:"
26 @$(MAKE) -rR showconfigs | sed 's,^, ,'
27
28 .PHONY: defconfig
29 defconfig:
30 @$(MAKE) config T=$(shell \
31 uname -m | awk '{ \
32 if ($$0 == "aarch64") { \
33 print "arm64-armv8a"} \
34 else if ($$0 == "armv7l") { \
35 print "arm-armv7a"} \
36 else if ($$0 == "ppc64") { \
37 print "ppc_64-power8"} \
38 else if ($$0 == "amd64") { \
39 print "x86_64-native"} \
40 else { \
41 printf "%s-native", $$0} }' \
42 )-$(shell \
43 uname | awk '{ \
44 if ($$0 == "Linux") { \
45 print "linux"} \
46 else { \
47 print "freebsd"} }' \
48 )-$(shell \
49 ${CC} --version | grep -o 'cc\|gcc\|icc\|clang' | awk \
50 '{ \
51 if ($$1 == "cc") { \
52 print "gcc" } \
53 else { \
54 print $$1 } \
55 }' \
56 )
57
58 .PHONY: config
59 ifeq ($(RTE_CONFIG_TEMPLATE),)
60 config: notemplate
61 else
62 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
63 @echo "Configuration done using" \
64 $(patsubst defconfig_%,%,$(notdir $(RTE_CONFIG_TEMPLATE)))
65 @echo "==== NOTE ===="
66 @echo "It is recommended to build DPDK using 'meson' and 'ninja'"
67 @echo "See https://doc.dpdk.org/guides/linux_gsg/build_dpdk.html for instructions"
68 @echo "Building DPDK with 'make' will be deprecated in a future release"
69 @echo "=============="
70 endif
71
72 $(RTE_OUTPUT):
73 $(Q)mkdir -p $@
74
75 ifdef NODOTCONF
76 $(RTE_OUTPUT)/.config: ;
77 else
78 # Generate config from template, if there are duplicates keep only the last.
79 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
80 # Then for each of those identified duplicates as long as there are more than
81 # just one left the last match is removed.
82 # Part of the config includes the version information taken from "VERSION"
83 # in the repo. This needs to be split into the various parts using sed and awk.
84 # To ensure correct version comparison, we append ".99" to the version number
85 # so that the version of a release is higher than that of its rc's.
86 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
87 $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
88 $(CPP) -undef -P -x assembler-with-cpp \
89 `cat $(RTE_SRCDIR)/VERSION | \
90 sed -e 's/-rc/.-rc./' -e 's/$$/..99/' | \
91 awk -F '.' '{print "-D__YEAR="int($$1), "-D__MONTH="int($$2), "-D__MINOR="int($$3), "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
92 -ffreestanding \
93 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
94 config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
95 echo "$$config" | awk -F '=' 'BEGIN {i=1} \
96 /^#/ {pos[i++]=$$0} \
97 !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \
98 else {pos[s[$$1]]=$$0}} END \
99 {for (j=1; j<i; j++) print pos[j]}' \
100 > $(RTE_OUTPUT)/.config_tmp ; \
101 if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
102 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
103 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
104 fi ; \
105 rm -f $(RTE_OUTPUT)/.config_tmp ; \
106 else \
107 $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \
108 fi
109 endif
110
111 # generate a Makefile for this build directory
112 # use a relative path so it will continue to work even if we move the directory
113 SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
114 $(abspath $(RTE_OUTPUT)))
115 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
116 $(abspath $(RTE_SRCDIR)))
117 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
118 $(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) > $@
119
120 # clean installed files, and generate a new config header file
121 # if NODOTCONF variable is defined, don't try to rebuild .config
122 $(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config
123 $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
124 $(RTE_OUTPUT)/lib \
125 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build
126 $(Q)mkdir -p $(RTE_OUTPUT)/include
127 $(Q)$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \
128 > $(RTE_OUTPUT)/include/rte_config.h
129
130 # generate the rte_config.h
131 .PHONY: headerconfig
132 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
133 @true
134
135 # check that .config is present, and if yes, check that rte_config.h
136 # is up to date
137 .PHONY: checkconfig
138 checkconfig:
139 @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
140 echo "No .config in build directory"; \
141 exit 1; \
142 fi
143 $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
144 headerconfig NODOTCONF=1
145
146 .PHONY: FORCE
147 FORCE: