mbuf_offload: remove library
[dpdk.git] / mk / rte.app.mk
1 #   BSD LICENSE
2 #
3 #   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
4 #   Copyright(c) 2014-2015 6WIND S.A.
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 include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
34 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
35 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
36 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
37 include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
38
39 # VPATH contains at least SRCDIR
40 VPATH += $(SRCDIR)
41
42 _BUILD = $(APP)
43 _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y)
44 _INSTALL += $(RTE_OUTPUT)/app/$(APP) $(RTE_OUTPUT)/app/$(APP).map
45 POSTINSTALL += target-appinstall
46 _CLEAN = doclean
47 POSTCLEAN += target-appclean
48
49 ifeq ($(NO_LDSCRIPT),)
50 LDSCRIPT = $(RTE_LDSCRIPT)
51 endif
52
53 # default path for libs
54 _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
55
56 #
57 # Order is important: from higher level to lower level
58 #
59
60 _LDLIBS-y += --whole-archive
61
62 _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)    += -lrte_distributor
63 _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)        += -lrte_reorder
64
65 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
66 _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)            += -lrte_kni
67 _LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)        += -lrte_ivshmem
68 endif
69
70 _LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)       += -lrte_pipeline
71 _LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)          += -lrte_table
72 _LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)           += -lrte_port
73 _LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer
74 _LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)           += -lrte_hash
75 _LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)       += -lrte_jobstats
76 _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)            += -lrte_lpm
77 _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)          += -lrte_power
78 _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)            += -lrte_acl
79 _LDLIBS-$(CONFIG_RTE_LIBRTE_METER)          += -lrte_meter
80
81 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)          += -lrte_sched
82 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)          += -lm
83 _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)          += -lrt
84
85 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lrte_vhost
86
87 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
88 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lnuma
89 endif
90
91 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
92 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lfuse
93 endif
94
95 # The static libraries do not know their dependencies.
96 # So linking with static library requires explicit dependencies.
97 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
98 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lpcap
99 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lz
100 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs
101 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -libverbs
102 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lsze2
103 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)    += -lxenstore
104 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)      += -lgxio
105 # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
106 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)        += -lcrypto
107 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
108
109 _LDLIBS-y += --start-group
110
111 _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)         += -lrte_kvargs
112 _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf
113 _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag
114 _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)          += -lethdev
115 _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV)      += -lrte_cryptodev
116 _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)        += -lrte_mempool
117 _LDLIBS-$(CONFIG_RTE_LIBRTE_RING)           += -lrte_ring
118 _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)            += -lrte_eal
119 _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE)        += -lrte_cmdline
120 _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)        += -lrte_cfgfile
121 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)       += -lrte_pmd_bond
122
123 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)    += -lrte_pmd_xenvirt
124
125 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
126 # plugins (link only if static libraries)
127
128 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
129 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)     += -lrte_pmd_virtio
130 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lrte_pmd_bnx2x
131 _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
132 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)       += -lrte_pmd_enic
133 _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)       += -lrte_pmd_i40e
134 _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)      += -lrte_pmd_fm10k
135 _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)      += -lrte_pmd_ixgbe
136 _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)      += -lrte_pmd_e1000
137 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -lrte_pmd_mlx4
138 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -lrte_pmd_mlx5
139 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)        += -lrte_pmd_nfp
140 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2)   += -lrte_pmd_szedata2
141 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD)      += -lrte_pmd_mpipe
142 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
143 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap
144 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet
145 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
146 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)        += -lrte_pmd_qat
147
148 # AESNI MULTI BUFFER is dependent on the IPSec_MB library
149 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -lrte_pmd_aesni_mb
150 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
151
152 endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
153
154 _LDLIBS-y += $(EXECENV_LDLIBS)
155 _LDLIBS-y += --end-group
156 _LDLIBS-y += --no-whole-archive
157
158 LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
159
160 .PHONY: all
161 all: install
162
163 .PHONY: install
164 install: build _postinstall
165
166 _postinstall: build
167
168 .PHONY: build
169 build: _postbuild
170
171 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
172
173 ifeq ($(LINK_USING_CC),1)
174 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
175 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
176         -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \
177         $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS))
178 else
179 O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
180         -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS)
181 endif
182 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
183 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)","  LD $(@)")
184 O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
185 O_TO_EXE_DO = @set -e; \
186         echo $(O_TO_EXE_DISP); \
187         $(O_TO_EXE) && \
188         echo $(O_TO_EXE_CMD) > $(call exe2cmd,$(@))
189
190 -include .$(APP).cmd
191
192 # path where libraries are retrieved
193 LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS)))
194 LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
195
196 # list of .a files that are linked to this application
197 LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
198 LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS)))
199
200 # list of found libraries files (useful for deps). If not found, the
201 # library is silently ignored and dep won't be checked
202 LDLIBS_FILES := $(wildcard $(foreach dir,$(LDLIBS_PATH),\
203         $(addprefix $(dir)/,$(LDLIBS_NAMES))))
204
205 #
206 # Compile executable file if needed
207 #
208 $(APP): $(OBJS-y) $(LDLIBS_FILES) $(DEP_$(APP)) $(LDSCRIPT) FORCE
209         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
210         $(if $(D),\
211                 @echo -n "$< -> $@ " ; \
212                 echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
213                 echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_EXE_STR))) " ; \
214                 echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
215                 echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
216         $(if $(or \
217                 $(file_missing),\
218                 $(call cmdline_changed,$(O_TO_EXE_STR)),\
219                 $(depfile_missing),\
220                 $(depfile_newer)),\
221                 $(O_TO_EXE_DO))
222
223 #
224 # install app in $(RTE_OUTPUT)/app
225 #
226 $(RTE_OUTPUT)/app/$(APP): $(APP)
227         @echo "  INSTALL-APP $(APP)"
228         @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app
229         $(Q)cp -f $(APP) $(RTE_OUTPUT)/app
230
231 #
232 # install app map file in $(RTE_OUTPUT)/app
233 #
234 $(RTE_OUTPUT)/app/$(APP).map: $(APP)
235         @echo "  INSTALL-MAP $(APP).map"
236         @[ -d $(RTE_OUTPUT)/app ] || mkdir -p $(RTE_OUTPUT)/app
237         $(Q)cp -f $(APP).map $(RTE_OUTPUT)/app
238
239 #
240 # Clean all generated files
241 #
242 .PHONY: clean
243 clean: _postclean
244         $(Q)rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
245
246 .PHONY: doclean
247 doclean:
248         $(Q)rm -rf $(APP) $(OBJS-all) $(DEPS-all) $(DEPSTMP-all) \
249           $(CMDS-all) $(INSTALL-FILES-all) .$(APP).cmd
250
251
252 include $(RTE_SDK)/mk/internal/rte.compile-post.mk
253 include $(RTE_SDK)/mk/internal/rte.install-post.mk
254 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
255 include $(RTE_SDK)/mk/internal/rte.build-post.mk
256 include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
257
258 ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk),)
259 include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk
260 else
261 include $(RTE_SDK)/mk/target/generic/rte.app.mk
262 endif
263
264 .PHONY: FORCE
265 FORCE: