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
14TLDK_ROOT := $(CURDIR)
15export TLDK_ROOT
16
17LOCAL_RTE_SDK=$(TLDK_ROOT)/dpdk/_build/dpdk
18
19ifeq ($(RTE_SDK),)
20	export RTE_SDK=$(LOCAL_RTE_SDK)
21endif
22
23RTE_TARGET ?= x86_64-native-linuxapp-gcc
24
25DIRS-y += lib
26DIRS-y += examples
27DIRS-y += test
28
29MAKEFLAGS += --no-print-directory
30
31# output directory
32O ?= $(TLDK_ROOT)/${RTE_TARGET}
33BASE_OUTPUT ?= $(abspath $(O))
34
35.PHONY: all
36all: $(DIRS-y)
37
38.PHONY: clean
39clean: $(DIRS-y)
40
41.PHONY: $(DIRS-y)
42$(DIRS-y): $(RTE_SDK)/mk/rte.vars.mk
43	@echo "== $@"
44	$(Q)$(MAKE) -C $(@) \
45		M=$(CURDIR)/$(@)/Makefile \
46		O=$(BASE_OUTPUT) \
47		BASE_OUTPUT=$(BASE_OUTPUT) \
48		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
49		S=$(CURDIR)/$(@) \
50		RTE_TARGET=$(RTE_TARGET) \
51		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
52
53$(RTE_SDK)/mk/rte.vars.mk:
54ifeq ($(RTE_SDK),$(LOCAL_RTE_SDK))
55	@make RTE_TARGET=$(RTE_TARGET) config all -C $(TLDK_ROOT)/dpdk/
56endif
57