first public release
[dpdk.git] / mk / rte.sdkconfig.mk
1 #   BSD LICENSE
2
3 #   Copyright(c) 2010-2012 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 #  version: DPDK.L.1.2.3-3
33
34 INSTALL_CONFIGS := $(filter-out %~,\
35         $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
36         $(wildcard $(RTE_SRCDIR)/config/defconfig_*)))
37 INSTALL_TARGETS := $(addsuffix _install,$(INSTALL_CONFIGS))
38
39 .PHONY: config
40 ifeq ($(RTE_CONFIG_TEMPLATE),)
41 config:
42         @echo -n "No template specified. Use T=template " ; \
43         echo "among the following list:" ; \
44         for t in $(INSTALL_CONFIGS); do \
45                 echo "  $$t" ; \
46         done
47 else
48 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
49         $(Q)$(MAKE) depdirs
50         @echo "Configuration done"
51 endif
52
53 ifdef NODOTCONF
54 $(RTE_OUTPUT)/.config: ;
55 else
56 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE
57         @[ -d $(RTE_OUTPUT) ] || mkdir -p $(RTE_OUTPUT)
58         $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
59                 if ! cmp -s $(RTE_CONFIG_TEMPLATE) $(RTE_OUTPUT)/.config; then \
60                         cp $(RTE_CONFIG_TEMPLATE) $(RTE_OUTPUT)/.config ; \
61                 fi ; \
62         else \
63                 echo -n "No template specified. Use T=template " ; \
64                 echo "among the following list:" ; \
65                 for t in $(INSTALL_CONFIGS); do \
66                         echo "  $$t" ; \
67                 done ; \
68         fi
69 endif
70
71 # generate a Makefile for this build directory
72 # use a relative path so it will continue to work even if we move the directory
73 SDK_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_SRCDIR)) \
74                                 $(abspath $(RTE_OUTPUT)))
75 OUTPUT_RELPATH=$(shell $(RTE_SDK)/scripts/relpath.sh $(abspath $(RTE_OUTPUT)) \
76                                 $(abspath $(RTE_SRCDIR)))
77 $(RTE_OUTPUT)/Makefile:
78         @[ -d $(RTE_OUTPUT) ] || mkdir -p $(RTE_OUTPUT)
79         $(Q)$(RTE_SDK)/scripts/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
80                 > $(RTE_OUTPUT)/Makefile
81
82 # clean installed files, and generate a new config header file
83 # if NODOTCONF variable is defined, don't try to rebuild .config
84 $(RTE_OUTPUT)/include/rte_config.h: $(RTE_OUTPUT)/.config
85         $(Q)rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
86                 $(RTE_OUTPUT)/hostapp $(RTE_OUTPUT)/lib \
87                 $(RTE_OUTPUT)/hostlib
88         @[ -d $(RTE_OUTPUT)/include ] || mkdir -p $(RTE_OUTPUT)/include
89         $(Q)$(RTE_SDK)/scripts/gen-config-h.sh $(RTE_OUTPUT)/.config \
90                 > $(RTE_OUTPUT)/include/rte_config.h
91
92 # generate the rte_config.h
93 .PHONY: headerconfig
94 headerconfig: $(RTE_OUTPUT)/include/rte_config.h
95         @true
96
97 # check that .config is present, and if yes, check that rte_config.h
98 # is up to date
99 .PHONY: checkconfig
100 checkconfig:
101         @if [ ! -f $(RTE_OUTPUT)/.config ]; then \
102                 echo "No .config in build directory"; \
103                 exit 1; \
104         fi
105         $(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
106                 headerconfig NODOTCONF=1
107
108 .PHONY: FORCE
109 FORCE: