eal: hide shared memory config
[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 .SECONDEXPANSION:
44 .PHONY: $(ROOTDIRS-y) $(ROOTDIRS-)
45 $(ROOTDIRS-y) $(ROOTDIRS-):
46         @[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
47         @echo "== Build $@"
48         $(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all
49         @if [ $@ = drivers ]; then \
50                 $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \
51         fi
52
53 %_clean:
54         @echo "== Clean $*"
55         $(Q)if [ -f $(RTE_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \
56                 $(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \
57         fi
58
59 RTE_MAKE_SUBTARGET ?= all
60
61 %_sub: $(addsuffix _sub,$(*))
62         @echo $(addsuffix _sub,$(*))
63         @[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
64         @echo "== Build $*"
65         $(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
66                 $(RTE_MAKE_SUBTARGET)
67
68 .PHONY: all
69 all: build
70
71 .PHONY: FORCE
72 FORCE: