Makefile revision 3d9b7210
1#   BSD LICENSE
2#
3#   Copyright(c) 2010-2015 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
32include $(RTE_SDK)/mk/rte.vars.mk
33
34ifeq ($(CONFIG_RTE_APP_TEST),y)
35
36# default rule
37all:
38
39# Define an externally linked resource. A linked resource is an arbitrary
40# file that is linked into the test binary. The application refers to this
41# resource by name. The linked generates identifiers beg_<name> and end_<name>
42# for referencing by the C code.
43#
44# Parameters: <unique name>, <file to be linked>
45define linked_resource
46SRCS-y += $(1).res.o
47$(1).res.o: $(2)
48	@  echo '  MKRES $$@'
49	$Q [ "$$(<D)" = . ] || ln -fs $$<
50	$Q $(OBJCOPY) -I binary -B $(RTE_OBJCOPY_ARCH) -O $(RTE_OBJCOPY_TARGET) \
51		--rename-section                                         \
52			.data=.rodata,alloc,load,data,contents,readonly  \
53		--redefine-sym _binary_$$(subst .,_,$$(<F))_start=beg_$(1) \
54		--redefine-sym _binary_$$(subst .,_,$$(<F))_end=end_$(1)   \
55		--redefine-sym _binary_$$(subst .,_,$$(<F))_size=siz_$(1)  \
56		$$(<F) $$@
57endef
58
59ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
60define linked_tar_resource
61$(1).tar: $(2)
62	@  echo '  TAR $$@'
63	$Q tar -C $$(dir $$<) -cf $$@ $$(notdir $$<)
64$(call linked_resource,$(1),$(1).tar)
65endef
66else # ! CONFIG_RTE_APP_TEST_RESOURCE_TAR
67linked_tar_resource =
68endif # CONFIG_RTE_APP_TEST_RESOURCE_TAR
69
70#
71# library name
72#
73APP = test
74
75#
76# all sources are stored in SRCS-y
77#
78SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := commands.c
79SRCS-y += test.c
80SRCS-y += resource.c
81SRCS-y += test_resource.c
82test_resource.res: test_resource.c
83	@ cp $< $@
84$(eval $(call linked_resource,test_resource_c,test_resource.res))
85$(eval $(call linked_tar_resource,test_resource_tar,test_resource.c))
86SRCS-$(CONFIG_RTE_APP_TEST_RESOURCE_TAR) += test_pci.c
87$(eval $(call linked_tar_resource,test_pci_sysfs,test_pci_sysfs))
88SRCS-y += test_prefetch.c
89SRCS-y += test_byteorder.c
90SRCS-y += test_per_lcore.c
91SRCS-y += test_atomic.c
92SRCS-y += test_malloc.c
93SRCS-y += test_cycles.c
94SRCS-y += test_spinlock.c
95SRCS-y += test_memory.c
96SRCS-y += test_memzone.c
97
98SRCS-y += test_ring.c
99SRCS-y += test_ring_perf.c
100SRCS-y += test_pmd_perf.c
101
102ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
103SRCS-y += test_table.c
104SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test_table_pipeline.c
105SRCS-y += test_table_tables.c
106SRCS-y += test_table_ports.c
107SRCS-y += test_table_combined.c
108SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_table_acl.c
109endif
110
111SRCS-y += test_rwlock.c
112
113SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer.c
114SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer_perf.c
115SRCS-$(CONFIG_RTE_LIBRTE_TIMER) += test_timer_racecond.c
116
117SRCS-y += test_mempool.c
118SRCS-y += test_mempool_perf.c
119
120SRCS-y += test_mbuf.c
121SRCS-y += test_logs.c
122
123SRCS-y += test_memcpy.c
124SRCS-y += test_memcpy_perf.c
125
126SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash.c
127SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_thash.c
128SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_perf.c
129SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_functions.c
130SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_scaling.c
131SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_multiwriter.c
132
133SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c
134SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c
135SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6.c
136SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6_perf.c
137
138SRCS-y += test_debug.c
139SRCS-y += test_errno.c
140SRCS-y += test_tailq.c
141SRCS-y += test_string_fns.c
142SRCS-y += test_cpuflags.c
143SRCS-y += test_mp_secondary.c
144SRCS-y += test_eal_flags.c
145SRCS-y += test_eal_fs.c
146SRCS-y += test_alarm.c
147SRCS-y += test_interrupts.c
148SRCS-y += test_version.c
149SRCS-y += test_func_reentrancy.c
150
151SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline.c
152SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_num.c
153SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_etheraddr.c
154SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_portlist.c
155SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_ipaddr.c
156SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_cirbuf.c
157SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_string.c
158SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += test_cmdline_lib.c
159
160ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
161SRCS-y += test_red.c
162SRCS-y += test_sched.c
163endif
164
165SRCS-$(CONFIG_RTE_LIBRTE_METER) += test_meter.c
166SRCS-$(CONFIG_RTE_LIBRTE_KNI) += test_kni.c
167SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power.c test_power_acpi_cpufreq.c
168SRCS-$(CONFIG_RTE_LIBRTE_POWER) += test_power_kvm_vm.c
169SRCS-y += test_common.c
170
171SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor.c
172SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += test_distributor_perf.c
173
174SRCS-$(CONFIG_RTE_LIBRTE_REORDER) += test_reorder.c
175
176SRCS-y += test_devargs.c
177SRCS-y += virtual_pmd.c
178SRCS-y += packet_burst_generator.c
179SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c
180
181ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
182SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding.c
183SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_mode4.c
184endif
185
186ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
187SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_rssconf.c
188ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
189LDLIBS += -lrte_pmd_null
190endif
191endif
192
193SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
194SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
195
196SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
197SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
198SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
199
200SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
201
202CFLAGS += -O3
203CFLAGS += $(WERROR_FLAGS)
204
205CFLAGS += -D_GNU_SOURCE
206
207LDLIBS += -lm
208
209# Disable VTA for memcpy test
210ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
211ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
212CFLAGS_test_memcpy.o += -fno-var-tracking-assignments
213CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
214endif
215endif
216
217# this application needs libraries first
218DEPDIRS-y += lib drivers
219
220# Link against shared libraries when needed
221ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
222ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
223$(error Link bonding tests require CONFIG_RTE_LIBRTE_PMD_RING=y)
224else
225ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
226LDLIBS += -lrte_pmd_ring
227endif
228endif
229endif
230
231ifeq ($(CONFIG_RTE_APP_TEST_RESOURCE_TAR),y)
232LDLIBS += -larchive
233endif
234
235include $(RTE_SDK)/mk/rte.app.mk
236
237endif
238