]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # |
2 | # BSD LICENSE | |
3 | # | |
4 | # Copyright (c) Intel Corporation. | |
5 | # All rights reserved. | |
6 | # | |
7 | # Redistribution and use in source and binary forms, with or without | |
8 | # modification, are permitted provided that the following conditions | |
9 | # are met: | |
10 | # | |
11 | # * Redistributions of source code must retain the above copyright | |
12 | # notice, this list of conditions and the following disclaimer. | |
13 | # * Redistributions in binary form must reproduce the above copyright | |
14 | # notice, this list of conditions and the following disclaimer in | |
15 | # the documentation and/or other materials provided with the | |
16 | # distribution. | |
17 | # * Neither the name of Intel Corporation nor the names of its | |
18 | # contributors may be used to endorse or promote products derived | |
19 | # from this software without specific prior written permission. | |
20 | # | |
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
25 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
26 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
27 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
28 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
29 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
30 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | # | |
33 | ||
34 | S := | |
35 | ||
36 | SPDK_ROOT_DIR := $(CURDIR) | |
37 | include $(SPDK_ROOT_DIR)/mk/spdk.common.mk | |
38 | ||
11fdf7f2 TL |
39 | DIRS-y += lib |
40 | DIRS-$(CONFIG_SHARED) += shared_lib | |
41 | DIRS-y += examples app include | |
42 | DIRS-$(CONFIG_TESTS) += test | |
7c673cae | 43 | |
11fdf7f2 TL |
44 | .PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk mk/cc.mk \ |
45 | cc_version cxx_version .libs_only_other .ldflags ldflags | |
46 | ||
47 | ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV)) | |
48 | ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR)) | |
49 | ifneq ($(SKIP_DPDK_BUILD),1) | |
50 | DPDKBUILD = dpdkbuild | |
51 | DIRS-y += dpdkbuild | |
52 | endif | |
53 | endif | |
54 | endif | |
55 | ||
56 | ifeq ($(CONFIG_SHARED),y) | |
57 | LIB = shared_lib | |
58 | else | |
59 | LIB = lib | |
60 | endif | |
7c673cae FG |
61 | |
62 | all: $(DIRS-y) | |
63 | clean: $(DIRS-y) | |
11fdf7f2 TL |
64 | $(Q)rm -f mk/cc.mk |
65 | $(Q)rm -f include/spdk/config.h | |
66 | ||
67 | install: all | |
68 | $(Q)echo "Installed to $(DESTDIR)$(CONFIG_PREFIX)" | |
7c673cae | 69 | |
11fdf7f2 TL |
70 | shared_lib: lib |
71 | lib: $(DPDKBUILD) | |
72 | app: $(LIB) | |
73 | test: $(LIB) | |
74 | examples: $(LIB) | |
75 | pkgdep: | |
76 | sh ./scripts/pkgdep.sh | |
7c673cae | 77 | |
11fdf7f2 TL |
78 | $(DIRS-y): mk/cc.mk include/spdk/config.h |
79 | ||
80 | mk/cc.mk: | |
81 | $(Q)scripts/detect_cc.sh --cc=$(CC) --cxx=$(CXX) --lto=$(CONFIG_LTO) > $@.tmp; \ | |
82 | cmp -s $@.tmp $@ || mv $@.tmp $@ ; \ | |
83 | rm -f $@.tmp | |
7c673cae | 84 | |
11fdf7f2 TL |
85 | include/spdk/config.h: mk/config.mk scripts/genconfig.py |
86 | $(Q)PYCMD=$$(cat PYTHON_COMMAND 2>/dev/null) ; \ | |
87 | test -z "$$PYCMD" && PYCMD=python ; \ | |
88 | echo "#ifndef SPDK_CONFIG_H" > $@.tmp; \ | |
89 | echo "#define SPDK_CONFIG_H" >> $@.tmp; \ | |
90 | $$PYCMD scripts/genconfig.py $(MAKEFLAGS) >> $@.tmp; \ | |
91 | echo "#endif /* SPDK_CONFIG_H */" >> $@.tmp; \ | |
7c673cae FG |
92 | cmp -s $@.tmp $@ || mv $@.tmp $@ ; \ |
93 | rm -f $@.tmp | |
94 | ||
11fdf7f2 TL |
95 | cc_version: mk/cc.mk |
96 | $(Q)echo "SPDK using CC=$(CC)"; $(CC) -v | |
97 | ||
98 | cxx_version: mk/cc.mk | |
99 | $(Q)echo "SPDK using CXX=$(CXX)"; $(CXX) -v | |
100 | ||
101 | .libs_only_other: | |
102 | $(Q)echo -n '$(SYS_LIBS) ' | |
103 | $(Q)if [ "$(CONFIG_SHARED)" = "y" ]; then \ | |
104 | echo -n '-lspdk '; \ | |
105 | fi | |
106 | ||
107 | .ldflags: | |
108 | $(Q)echo -n '$(LDFLAGS) ' | |
109 | ||
110 | ldflags: .ldflags .libs_only_other | |
111 | $(Q)echo '' | |
112 | ||
7c673cae | 113 | include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk |