1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2014 Intel Corporation
6 @cat $(RTE_SRCDIR)/VERSION
10 @cat $(RTE_SRCDIR)/VERSION | awk -F '.' '{print $$1$$2}'
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))
20 @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);)
24 @printf "No template specified. Use 'make defconfig' or "
25 @echo "use T=template from the following list:"
26 @$(MAKE) -rR showconfigs | sed 's,^, ,'
30 @$(MAKE) config T=$(shell \
32 if ($$0 == "aarch64") { \
33 print "arm64-armv8a"} \
34 else if ($$0 == "armv7l") { \
36 else if ($$0 == "ppc64") { \
37 print "ppc_64-power8"} \
38 else if ($$0 == "amd64") { \
39 print "x86_64-native"} \
41 printf "%s-native", $$0} }' \
44 if ($$0 == "Linux") { \
49 ${CC} --version | grep -o 'cc\|gcc\|icc\|clang' | awk \
59 ifeq ($(RTE_CONFIG_TEMPLATE),)
62 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
63 @echo "Configuration done using" \
64 $(patsubst defconfig_%,%,$(notdir $(RTE_CONFIG_TEMPLATE)))
71 $(RTE_OUTPUT)/.config: ;
73 # Generate config from template, if there are duplicates keep only the last.
74 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
75 # Then for each of those identified duplicates as long as there are more than
76 # just one left the last match is removed.
77 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
78 $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
79 $(CPP) -undef -P -x assembler-with-cpp \
81 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
82 config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
83 echo "$$config" | awk -F '=' 'BEGIN {i=1} \
85 !/^#/ {if (!s[$$1]) {pos[i]=$$0; s[$$1]=i++} \
86 else {pos[s[$$1]]=$$0}} END \
87 {for (j=1; j<i; j++) print pos[j]}' \
88 > $(RTE_OUTPUT)/.config_tmp ; \
89 if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
90 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
91 cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
93 rm -f $(RTE_OUTPUT)/.config_tmp ; \
95 $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \
99 # generate a Makefile for this build directory
100 # use a relative path so it will continue to work even if we move the directory
101 SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
102 $(abspath $(RTE_OUTPUT)))
103 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
104 $(abspath $(RTE_SRCDIR)))
105 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
106 $(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) > $@
108 # clean installed files, and generate a new config header file
109 # if NODOTCONF variable is defined, don't try to rebuild .config
110 $(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config
111 $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
113 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build
114 $(Q)mkdir -p $(RTE_OUTPUT)/include
115 $(Q)$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \
116 > $(RTE_OUTPUT)/include/rte_config.h
118 # generate the rte_config.h
120 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
123 # check that .config is present, and if yes, check that rte_config.h
127 @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
128 echo "No .config in build directory"; \
131 $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
132 headerconfig NODOTCONF=1