doc: fix spelling in bonding guide
[dpdk.git] / mk / rte.sdkconfig.mk
1 #   BSD LICENSE
2 #
3 #   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
4 #   All rights reserved.
5 #
6 #   Redistribution and use in source and binary forms, with or without
7 #   modification, are permitted provided that the following conditions
8 #   are met:
9 #
10 #     * Redistributions of source code must retain the above copyright
11 #       notice, this list of conditions and the following disclaimer.
12 #     * Redistributions in binary form must reproduce the above copyright
13 #       notice, this list of conditions and the following disclaimer in
14 #       the documentation and/or other materials provided with the
15 #       distribution.
16 #     * Neither the name of Intel Corporation nor the names of its
17 #       contributors may be used to endorse or promote products derived
18 #       from this software without specific prior written permission.
19 #
20 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 #   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 #   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 #   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 #   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 #   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 .PHONY: showversion
33 showversion:
34         @set -- \
35                 $$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
36                         -e 's,^#define RTE_VER_SUFFIX[[:space:]]+"(.*)",\1,p' \
37                         $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h) ;\
38                 printf '%d.%d.%d' "$$1" "$$2" "$$3"; \
39                 if [ -z "$$5" ]; then echo; \
40                 else printf '%s' "$$4"; \
41                         if [ $$5 -lt 16 ] ; then echo $$5; \
42                         else echo $$(($$5 - 16)); fi; \
43                 fi
44
45 INSTALL_CONFIGS := $(sort $(filter-out %~,\
46         $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
47         $(wildcard $(RTE_SRCDIR)/config/defconfig_*))))
48 INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS))
49
50 .PHONY: showconfigs
51 showconfigs:
52         @$(foreach CONFIG, $(INSTALL_CONFIGS), echo $(CONFIG);)
53
54 .PHONY: notemplate
55 notemplate:
56         @printf "No template specified. "
57         @echo "Use T=template among the following list:"
58         @$(MAKE) -rR showconfigs | sed 's,^,  ,'
59
60 .PHONY: config
61 ifeq ($(RTE_CONFIG_TEMPLATE),)
62 config: notemplate
63 else
64 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
65         $(Q)$(MAKE) depdirs
66         @echo "Configuration done"
67 endif
68
69 $(RTE_OUTPUT):
70         $(Q)mkdir -p $@
71
72 ifdef NODOTCONF
73 $(RTE_OUTPUT)/.config: ;
74 else
75 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
76         $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
77                 $(CPP) -undef -P -x assembler-with-cpp \
78                 -ffreestanding \
79                 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
80                 if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \
81                         cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \
82                         cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \
83                 fi ; \
84                 rm -f $(RTE_OUTPUT)/.config_tmp ; \
85         else \
86                 $(MAKE) -rRf $(RTE_SDK)/mk/rte.sdkconfig.mk notemplate; \
87         fi
88 endif
89
90 # generate a Makefile for this build directory
91 # use a relative path so it will continue to work even if we move the directory
92 SDK_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_SRCDIR)) \
93                                 $(abspath $(RTE_OUTPUT)))
94 OUTPUT_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_OUTPUT)) \
95                                 $(abspath $(RTE_SRCDIR)))
96 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
97         $(Q)$(RTE_SDK)/scripts/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
98                 > $(RTE_OUTPUT)/Makefile
99
100 # clean installed files, and generate a new config header file
101 # if NODOTCONF variable is defined, don't try to rebuild .config
102 $(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config
103         $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
104                 $(RTE_OUTPUT)/hostapp $(RTE_OUTPUT)/lib \
105                 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod $(RTE_OUTPUT)/build
106         $(Q)mkdir -p $(RTE_OUTPUT)/include
107         $(Q)$(RTE_SDK)/scripts/gen-config-h.sh $(RTE_OUTPUT)/.config \
108                 > $(RTE_OUTPUT)/include/rte_config.h
109
110 # generate the rte_config.h
111 .PHONY: headerconfig
112 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
113         @true
114
115 # check that .config is present, and if yes, check that rte_config.h
116 # is up to date
117 .PHONY: checkconfig
118 checkconfig:
119         @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
120                 echo "No .config in build directory"; \
121                 exit 1; \
122         fi
123         $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
124                 headerconfig NODOTCONF=1
125         $(Q)$(MAKE) -s depdirs
126
127 .PHONY: FORCE
128 FORCE: