New upstream version 18.08
[deb_dpdk.git] / mk / rte.sdkbuild.mk
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2010-2015 Intel Corporation
3
4 #
5 # include rte.vars.mk if config file exists
6 #
7 ifeq (,$(wildcard $(RTE_OUTPUT)/.config))
8   $(error "need a make config first")
9 else
10   include $(RTE_SDK)/mk/rte.vars.mk
11 endif
12
13 # allow exec-env specific targets
14 -include $(RTE_SDK)/mk/exec-env/$(RTE_EXEC_ENV)/rte.custom.mk
15
16 buildtools: | lib
17 kernel: | lib
18 drivers: | lib buildtools
19 app: | lib buildtools drivers
20 test: | lib buildtools drivers
21
22 #
23 # build and clean targets
24 #
25
26 CLEANDIRS = $(addsuffix _clean,$(ROOTDIRS-y) $(ROOTDIRS-n) $(ROOTDIRS-))
27
28 .PHONY: build
29 build: $(ROOTDIRS-y)
30         @echo "Build complete [$(RTE_TARGET)]"
31
32 .PHONY: clean
33 clean: $(CLEANDIRS)
34         @rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
35                 $(RTE_OUTPUT)/lib \
36                 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod
37         @[ -d $(RTE_OUTPUT)/include ] || mkdir -p $(RTE_OUTPUT)/include
38         @$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \
39                 > $(RTE_OUTPUT)/include/rte_config.h
40         $(Q)$(MAKE) -f $(RTE_SDK)/GNUmakefile gcovclean
41         @echo Clean complete
42
43 .PHONY: test-build
44 test-build: test
45
46 .SECONDEXPANSION:
47 .PHONY: $(ROOTDIRS-y) $(ROOTDIRS-)
48 $(ROOTDIRS-y) $(ROOTDIRS-):
49         @[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
50         @echo "== Build $@"
51         $(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all
52         @if [ $@ = drivers ]; then \
53                 $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \
54         fi
55
56 %_clean:
57         @echo "== Clean $*"
58         $(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \
59                 $(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \
60         fi
61
62 RTE_MAKE_SUBTARGET ?= all
63
64 %_sub: $(addsuffix _sub,$(*))
65         @echo $(addsuffix _sub,$(*))
66         @[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
67         @echo "== Build $*"
68         $(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
69                 $(RTE_MAKE_SUBTARGET)
70
71 .PHONY: all
72 all: build
73
74 .PHONY: FORCE
75 FORCE: