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,^, ,'
42 @$(MAKE) config T=$(shell \
44 if ($$0 == "aarch64") { \
45 print "arm64-armv8a"} \
46 else if ($$0 == "armv7l") { \
48 else if ($$0 == "ppc64") { \
49 print "ppc_64-power8"} \
51 printf "%s-native", $$0} }')-$(shell \
53 if ($$0 == "Linux") { \
56 print "bsdapp"} }')-$(shell \
58 grep " version " | cut -d ' ' -f 1)
61 ifeq ($(RTE_CONFIG_TEMPLATE),)
64 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
65 @echo "Configuration done using" \
66 $(patsubst defconfig_%,%,$(notdir $(RTE_CONFIG_TEMPLATE)))
73 $(RTE_OUTPUT)/.config: ;
75 # Generate config from template, if there are duplicates keep only the last.
76 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
77 # Then for each of those identified duplicates as long as there are more than
78 # just one left the last match is removed.
79 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
80 $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
81 $(CPP) -undef -P -x assembler-with-cpp \
83 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
84 config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
85 echo "$$config" | awk -F '=' 'BEGIN {i=1} \
87 !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \
88 else {pos[s[$$1]]=$$0}} END \
89 {for (j=1; j<i; j++) print pos[j]}' \
90 > $(RTE_OUTPUT)/.config_tmp ; \
91 if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
92 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
93 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
95 rm -f $(RTE_OUTPUT)/.config_tmp ; \
97 $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \
101 # generate a Makefile for this build directory
102 # use a relative path so it will continue to work even if we move the directory
103 SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
104 $(abspath $(RTE_OUTPUT)))
105 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
106 $(abspath $(RTE_SRCDIR)))
107 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
108 $(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
109 > $(RTE_OUTPUT)/Makefile
111 # clean installed files, and generate a new config header file
112 # if NODOTCONF variable is defined, don't try to rebuild .config
113 $(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config
114 $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
116 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build
117 $(Q)mkdir -p $(RTE_OUTPUT)/include
118 $(Q)$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \
119 > $(RTE_OUTPUT)/include/rte_config.h
121 # generate the rte_config.h
123 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
126 # check that .config is present, and if yes, check that rte_config.h
130 @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
131 echo "No .config in build directory"; \
134 $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
135 headerconfig NODOTCONF=1