Makefile revision a152c68e
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
79CXXFLAGS += -I$(GTEST_DIR)/include
80CXXFLAGS += -I$(GMOCK_DIR)/include
81CXXFLAGS += -I$(TLDK_ROOT)/$(RTE_TARGET)/include
82
83LDFLAGS += -lstdc++
84LDFLAGS += -L$(GMOCK_DIR) -lgmock
85LDLIBS += -ltle_udp -ltle_dring
86
87include $(TLDK_ROOT)/mk/tle.cpp-obj.mk
88endif
89
90#
91# building app
92#
93
94ifeq ($(X),app)
95
96# binary name
97APP = gtest-rfc
98
99# all source are stored in SRCS-y
100
101CFLAGS += -O3
102CFLAGS += $(WERROR_FLAGS)
103
104LDLIBS += gtest-rfc.o
105
106LDFLAGS += -lstdc++
107LDFLAGS += -L$(GMOCK_DIR) -lgmock
108LDLIBS += -L$(TLDK_ROOT)/$(RTE_TARGET)/lib
109LDLIBS += -ltle_udp -ltle_dring
110
111include $(TLDK_ROOT)/mk/tle.app.mk
112endif
113
114endif
115endif
116