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