1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
7 $$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
8 -e 's,^#define RTE_VER_SUFFIX[[:space:]]+"(.*)",\1,p' \
9 $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h) ;\
10 printf '%d.%02d.%d' "$$1" "$$2" "$$3"; \
11 if [ -z "$$5" ]; then echo; \
12 else printf '%s' "$$4"; \
13 if [ $$5 -lt 16 ] ; then echo $$5; \
14 else echo $$(($$5 - 16)); fi; \
20 $$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
21 $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
22 printf '%02d%02d\n' "$$1" "$$2"
24 INSTALL_CONFIGS := $(sort $(filter-out %~,\
25 $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
26 $(wildcard $(RTE_SRCDIR)/config/defconfig_*))))
27 INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS))
31 @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);)
35 @printf "No template specified. Use 'make defconfig' or "
36 @echo "use T=template from the following list:"
37 @$(MAKE) -rR showconfigs | sed 's,^, ,'
41 @$(MAKE) config T=$(shell \
43 if ($$0 == "aarch64") { \
44 print "arm64-armv8a"} \
45 else if ($$0 == "armv7l") { \
47 else if ($$0 == "ppc64") { \
48 print "ppc_64-power8"} \
49 else if ($$0 == "amd64") { \
50 print "x86_64-native"} \
52 printf "%s-native", $$0} }' \
55 if ($$0 == "Linux") { \
60 ${CC} --version | grep -o 'cc\|gcc\|icc\|clang' | awk \
70 ifeq ($(RTE_CONFIG_TEMPLATE),)
73 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
74 @echo "Configuration done using" \
75 $(patsubst defconfig_%,%,$(notdir $(RTE_CONFIG_TEMPLATE)))
82 $(RTE_OUTPUT)/.config: ;
84 # Generate config from template, if there are duplicates keep only the last.
85 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
86 # Then for each of those identified duplicates as long as there are more than
87 # just one left the last match is removed.
88 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
89 $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
90 $(CPP) -undef -P -x assembler-with-cpp \
92 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
93 config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
94 echo "$$config" | awk -F '=' 'BEGIN {i=1} \
96 !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \
97 else {pos[s[$$1]]=$$0}} END \
98 {for (j=1; j<i; j++) print pos[j]}' \
99 > $(RTE_OUTPUT)/.config_tmp ; \
100 if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
101 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
102 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
104 rm -f $(RTE_OUTPUT)/.config_tmp ; \
106 $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \
110 # generate a Makefile for this build directory
111 # use a relative path so it will continue to work even if we move the directory
112 SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
113 $(abspath $(RTE_OUTPUT)))
114 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
115 $(abspath $(RTE_SRCDIR)))
116 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
117 $(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
118 > $(RTE_OUTPUT)/Makefile
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 \
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
130 # generate the rte_config.h
132 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
135 # check that .config is present, and if yes, check that rte_config.h
139 @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
140 echo "No .config in build directory"; \
143 $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
144 headerconfig NODOTCONF=1