Makefile revision a18f8552
1# Copyright (c) 2016 Intel Corporation.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at:
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14ifeq ($(RTE_SDK),)
15$(error "Please define RTE_SDK environment variable")
16endif
17
18ifeq ($(GTEST_DIR),)
19all:
20	@echo "GTEST_DIR is not setup properly. Skipping gtest"
21
22%::
23	@echo "GTEST_DIR is not setup properly. Skipping gtest"
24
25else
26
27# Default target, can be overridden by command line or environment
28RTE_TARGET ?= x86_64-native-linuxapp-gcc
29
30include $(RTE_SDK)/mk/rte.vars.mk
31
32CUR_SUBDIR ?= .
33
34# we must create the output dir first and recall the same Makefile
35# from this directory
36ifeq ($(NOT_FIRST_CALL),)
37
38NOT_FIRST_CALL = 1
39export NOT_FIRST_CALL
40
41
42BDIR := $(RTE_OUTPUT)/build/$(CUR_SUBDIR)
43
44all:
45	$(Q)mkdir -p $(BDIR)
46	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
47		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
48	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) \
49		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
50
51%::
52	$(Q)mkdir -p $(BDIR)
53	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
54		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=obj
55	$(Q)$(MAKE) -C $(BDIR) -f $(RTE_EXTMK) $@ \
56		S=$(RTE_SRCDIR) O=$(RTE_OUTPUT) SRCDIR=$(RTE_SRCDIR) X=app
57else
58
59#
60# building object
61#
62
63ifeq ($(X),obj)
64include $(TLDK_ROOT)/mk/tle.cpp-vars.mk
65
66# binary name
67OBJ = gtest-rfc.o
68
69# all source are stored in SRCS-y
70SRCS-y += main.cpp
71SRCS-y += test_tle_dring.cpp
72SRCS-y += test_tle_udp_ctx.cpp
73SRCS-y += test_tle_udp_dev.cpp
74SRCS-y += test_tle_udp_destroy.cpp
75SRCS-y += test_tle_udp_event.cpp
76SRCS-y += test_tle_udp_stream.cpp
77
78CXXFLAGS += -std=c++11
79
80ifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
81CXXFLAGS += -D __STDC_FORMAT_MACROS
82endif
83
84CXXFLAGS += -I$(GTEST_DIR)/include
85CXXFLAGS += -I$(GMOCK_DIR)/include
86CXXFLAGS += -I$(RTE_OUTPUT)/include
87
88LDFLAGS += -lstdc++
89LDFLAGS += -L$(GMOCK_DIR) -lgmock
90LDLIBS += -ltle_udp -ltle_dring
91
92include $(TLDK_ROOT)/mk/tle.cpp-obj.mk
93endif
94
95#
96# building app
97#
98
99ifeq ($(X),app)
100
101# binary name
102APP = gtest-rfc
103
104# all source are stored in SRCS-y
105
106CFLAGS += -O3
107
108ifeq ($(shell test $(GCC_VERSION) -lt 50 && echo 1), 1)
109CFLAGS += -D __STDC_FORMAT_MACROS
110endif
111
112CFLAGS += $(WERROR_FLAGS)
113
114LDLIBS += gtest-rfc.o
115
116LDLIBS += -lstdc++
117LDLIBS += -L$(GMOCK_DIR) -lgmock
118LDLIBS += -L$(RTE_OUTPUT)/lib
119LDLIBS += -ltle_udp -ltle_dring
120
121include $(TLDK_ROOT)/mk/tle.app.mk
122endif
123
124endif
125endif
126