]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/Makefile
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / Makefile
CommitLineData
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
34S :=
35
36SPDK_ROOT_DIR := $(CURDIR)
37include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
38
11fdf7f2
TL
39DIRS-y += lib
40DIRS-$(CONFIG_SHARED) += shared_lib
41DIRS-y += examples app include
42DIRS-$(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
47ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
48ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
49ifneq ($(SKIP_DPDK_BUILD),1)
50DPDKBUILD = dpdkbuild
51DIRS-y += dpdkbuild
52endif
53endif
54endif
55
56ifeq ($(CONFIG_SHARED),y)
57LIB = shared_lib
58else
59LIB = lib
60endif
7c673cae
FG
61
62all: $(DIRS-y)
63clean: $(DIRS-y)
11fdf7f2
TL
64 $(Q)rm -f mk/cc.mk
65 $(Q)rm -f include/spdk/config.h
66
67install: all
68 $(Q)echo "Installed to $(DESTDIR)$(CONFIG_PREFIX)"
7c673cae 69
11fdf7f2
TL
70shared_lib: lib
71lib: $(DPDKBUILD)
72app: $(LIB)
73test: $(LIB)
74examples: $(LIB)
75pkgdep:
76 sh ./scripts/pkgdep.sh
7c673cae 77
11fdf7f2
TL
78$(DIRS-y): mk/cc.mk include/spdk/config.h
79
80mk/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
85include/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
95cc_version: mk/cc.mk
96 $(Q)echo "SPDK using CC=$(CC)"; $(CC) -v
97
98cxx_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
110ldflags: .ldflags .libs_only_other
111 $(Q)echo ''
112
7c673cae 113include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk