1a152c68eSDaniel Mrzyglod# Copyright (c) 2016 Intel Corporation.
2a152c68eSDaniel Mrzyglod# Licensed under the Apache License, Version 2.0 (the "License");
3a152c68eSDaniel Mrzyglod# you may not use this file except in compliance with the License.
4a152c68eSDaniel Mrzyglod# You may obtain a copy of the License at:
5a152c68eSDaniel Mrzyglod#
6a152c68eSDaniel Mrzyglod#     http://www.apache.org/licenses/LICENSE-2.0
7a152c68eSDaniel Mrzyglod#
8a152c68eSDaniel Mrzyglod# Unless required by applicable law or agreed to in writing, software
9a152c68eSDaniel Mrzyglod# distributed under the License is distributed on an "AS IS" BASIS,
10a152c68eSDaniel Mrzyglod# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11a152c68eSDaniel Mrzyglod# See the License for the specific language governing permissions and
12a152c68eSDaniel Mrzyglod# limitations under the License.
13a152c68eSDaniel Mrzyglod
14a152c68eSDaniel Mrzyglodifeq ($(RTE_SDK),)
15a152c68eSDaniel Mrzyglod$(error "Please define RTE_SDK environment variable")
16a152c68eSDaniel Mrzyglodendif
17a152c68eSDaniel Mrzyglod
18a152c68eSDaniel Mrzyglodifeq ($(GTEST_DIR),)
19a152c68eSDaniel Mrzyglodall:
20a152c68eSDaniel Mrzyglod	@echo "GTEST_DIR is not setup properly. Skipping gtest"
21a152c68eSDaniel Mrzyglod
22a152c68eSDaniel Mrzyglod%::
23a152c68eSDaniel Mrzyglod	@echo "GTEST_DIR is not setup properly. Skipping gtest"
24a152c68eSDaniel Mrzyglod
25a152c68eSDaniel Mrzyglodelse
26a152c68eSDaniel Mrzyglod
27a152c68eSDaniel Mrzyglod# Default target, can be overridden by command line or environment
28a152c68eSDaniel MrzyglodRTE_TARGET ?= x86_64-native-linuxapp-gcc
29a152c68eSDaniel Mrzyglod
30a152c68eSDaniel Mrzyglodinclude $(RTE_SDK)/mk/rte.vars.mk
31a152c68eSDaniel Mrzyglod
32a152c68eSDaniel MrzyglodCUR_SUBDIR ?= .
33a152c68eSDaniel Mrzyglod
34a152c68eSDaniel Mrzyglod# we must create the output dir first and recall the same Makefile
35a152c68eSDaniel Mrzyglod# from this directory
36a152c68eSDaniel Mrzyglodifeq ($(NOT_FIRST_CALL),)
37a152c68eSDaniel Mrzyglod
38a152c68eSDaniel MrzyglodNOT_FIRST_CALL = 1
39a152c68eSDaniel Mrzyglodexport NOT_FIRST_CALL
40a152c68eSDaniel Mrzyglod
41a152c68eSDaniel Mrzyglod
42a152c68eSDaniel MrzyglodBDIR := $(RTE_OUTPUT)/build/$(CUR_SUBDIR)
43a152c68eSDaniel Mrzyglod
44a152c68eSDaniel Mrzyglodall:
45a152c68eSDaniel Mrzyglod	$(Q)mkdir -p $(BDIR)
46a152c68eSDaniel Mrzyglod	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
47a152c68eSDaniel Mrzyglod		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
48a152c68eSDaniel Mrzyglod	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
49a152c68eSDaniel Mrzyglod		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
50a152c68eSDaniel Mrzyglod
51a152c68eSDaniel Mrzyglod%::
52a152c68eSDaniel Mrzyglod	$(Q)mkdir -p $(BDIR)
53a152c68eSDaniel Mrzyglod	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
54a152c68eSDaniel Mrzyglod		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
55a152c68eSDaniel Mrzyglod	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
56a152c68eSDaniel Mrzyglod		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
57a152c68eSDaniel Mrzyglodelse
58a152c68eSDaniel Mrzyglod
59a152c68eSDaniel Mrzyglod#
60a152c68eSDaniel Mrzyglod# building object
61a152c68eSDaniel Mrzyglod#
62a152c68eSDaniel Mrzyglod
63a152c68eSDaniel Mrzyglodifeq ($(X),obj)
64a152c68eSDaniel Mrzyglodinclude $(TLDK_ROOT)/mk/tle.cpp-vars.mk
65a152c68eSDaniel Mrzyglod
66a152c68eSDaniel Mrzyglod# binary name
67a152c68eSDaniel MrzyglodOBJ = gtest-rfc.o
68a152c68eSDaniel Mrzyglod
69a152c68eSDaniel Mrzyglod# all source are stored in SRCS-y
70a152c68eSDaniel MrzyglodSRCS-y += main.cpp
71aa97dd1cSKonstantin AnanyevSRCS-y += test_common.cpp
72a152c68eSDaniel MrzyglodSRCS-y += test_tle_dring.cpp
73aa97dd1cSKonstantin AnanyevSRCS-y += test_tle_ctx.cpp
748fb6bb3bSMohammad Abdul Awal#SRCS-y += test_tle_udp_dev.cpp
75a152c68eSDaniel MrzyglodSRCS-y += test_tle_udp_destroy.cpp
76a152c68eSDaniel MrzyglodSRCS-y += test_tle_udp_event.cpp
77aa97dd1cSKonstantin Ananyev#SRCS-y += test_tle_udp_stream.cpp
789cbfd751SMohammad Abdul AwalSRCS-y += test_tle_udp_stream_gen.cpp
794e3cb261STomasz KopecSRCS-y += test_tle_tcp_stream.cpp
80aa97dd1cSKonstantin Ananyev#SRCS-y += test_tle_tcp_stream_gen.cpp
81a152c68eSDaniel Mrzyglod
8268f21c31SKopec, TomaszXSYMLINK-y-app += test_scapy_gen.py
8368f21c31SKopec, TomaszX
84a152c68eSDaniel MrzyglodCXXFLAGS += -std=c++11
85a18f8552SDaniel Mrzyglod
86a18f8552SDaniel Mrzyglodifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
87a18f8552SDaniel MrzyglodCXXFLAGS += -D __STDC_FORMAT_MACROS
88a18f8552SDaniel Mrzyglodendif
89a18f8552SDaniel Mrzyglod
90a152c68eSDaniel MrzyglodCXXFLAGS += -I$(GTEST_DIR)/include
91a152c68eSDaniel MrzyglodCXXFLAGS += -I$(GMOCK_DIR)/include
9244222fc2SKonstantin AnanyevCXXFLAGS += -I$(RTE_OUTPUT)/include
93a152c68eSDaniel Mrzyglod
945c795f7bSKonstantin AnanyevCXXFLAGS += $(EXTRA_CFLAGS)
955c795f7bSKonstantin Ananyev
96a152c68eSDaniel MrzyglodLDFLAGS += -lstdc++
97f6603a8bSKonstantin AnanyevLDFLAGS += -L$(GMOCK_DIR) -L$(GMOCK_DIR)/../lib -lgmock
98aa97dd1cSKonstantin AnanyevLDLIBS += -whole-archive -ltle_l4p -ltle_dring
99a152c68eSDaniel Mrzyglod
100a152c68eSDaniel Mrzyglodinclude $(TLDK_ROOT)/mk/tle.cpp-obj.mk
101a152c68eSDaniel Mrzyglodendif
102a152c68eSDaniel Mrzyglod
103a152c68eSDaniel Mrzyglod#
104a152c68eSDaniel Mrzyglod# building app
105a152c68eSDaniel Mrzyglod#
106a152c68eSDaniel Mrzyglod
107a152c68eSDaniel Mrzyglodifeq ($(X),app)
108a152c68eSDaniel Mrzyglod
109a152c68eSDaniel Mrzyglod# binary name
110a152c68eSDaniel MrzyglodAPP = gtest-rfc
111a152c68eSDaniel Mrzyglod
112a152c68eSDaniel Mrzyglod# all source are stored in SRCS-y
113a152c68eSDaniel Mrzyglod
114a152c68eSDaniel MrzyglodCFLAGS += -O3
115a18f8552SDaniel Mrzyglod
116a18f8552SDaniel Mrzyglodifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
117a18f8552SDaniel MrzyglodCFLAGS += -D __STDC_FORMAT_MACROS
118a18f8552SDaniel Mrzyglodendif
119a18f8552SDaniel Mrzyglod
120a152c68eSDaniel MrzyglodCFLAGS += $(WERROR_FLAGS)
121a152c68eSDaniel Mrzyglod
122a152c68eSDaniel MrzyglodLDLIBS += gtest-rfc.o
123a152c68eSDaniel Mrzyglod
124dd8d338eSKarol LateckiLDLIBS += -lstdc++
125f6603a8bSKonstantin AnanyevLDLIBS += -L$(GMOCK_DIR) -L$(GMOCK_DIR)/../lib -lgmock
126f6603a8bSKonstantin AnanyevLDLIBS += -L$(GMOCK_DIR)/gtest -L$(GMOCK_DIR)/../lib -lgtest
12744222fc2SKonstantin AnanyevLDLIBS += -L$(RTE_OUTPUT)/lib
128b8f1ef2bSKonstantin AnanyevLDLIBS += -whole-archive -ltle_l4p -ltle_dring -ltle_memtank -ltle_timer
129a152c68eSDaniel Mrzyglod
130a152c68eSDaniel Mrzyglodinclude $(TLDK_ROOT)/mk/tle.app.mk
131a152c68eSDaniel Mrzyglodendif
132a152c68eSDaniel Mrzyglod
133a152c68eSDaniel Mrzyglodendif
134a152c68eSDaniel Mrzyglodendif
135