New upstream version 18.02
[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 drivers: | lib buildtools
18 app: | lib buildtools drivers
19 test: | lib buildtools drivers
20
21 #
22 # build and clean targets
23 #
24
25 CLEANDIRS = $(addsuffix _clean,$(ROOTDIRS-y) $(ROOTDIRS-n) $(ROOTDIRS-))
26
27 .PHONY: build
28 build: $(ROOTDIRS-y)
29         @echo "Build complete [$(RTE_TARGET)]"
30
31 .PHONY: clean
32 clean: $(CLEANDIRS)
33         @rm -rf $(RTE_OUTPUT)/include $(RTE_OUTPUT)/app \
34                 $(RTE_OUTPUT)/lib \
35                 $(RTE_OUTPUT)/hostlib $(RTE_OUTPUT)/kmod
36         @[ -d $(RTE_OUTPUT)/include ] || mkdir -p $(RTE_OUTPUT)/include
37         @$(RTE_SDK)/buildtools/gen-config-h.sh $(RTE_OUTPUT)/.config \
38                 > $(RTE_OUTPUT)/include/rte_config.h
39         $(Q)$(MAKE) -f $(RTE_SDK)/GNUmakefile gcovclean
40         @echo Clean complete
41
42 .PHONY: test-build
43 test-build: test
44
45 .SECONDEXPANSION:
46 .PHONY: $(ROOTDIRS-y) $(ROOTDIRS-)
47 $(ROOTDIRS-y) $(ROOTDIRS-):
48         @[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
49         @echo "== Build $@"
50         $(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all
51         @if [ $@ = drivers ]; then \
52                 $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \
53         fi
54
55 %_clean:
56         @echo "== Clean $*"
57         $(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \
58                 $(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \
59         fi
60
61 RTE_MAKE_SUBTARGET ?= all
62
63 %_sub: $(addsuffix _sub,$(*))
64         @echo $(addsuffix _sub,$(*))
65         @[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
66         @echo "== Build $*"
67         $(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
68                 $(RTE_MAKE_SUBTARGET)
69
70 .PHONY: all
71 all: build
72
73 .PHONY: FORCE
74 FORCE: