-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
108 lines (85 loc) · 1.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
ifeq ($(RTE_SDK),)
$(error RTE_SDK is not defined)
endif
#
# directory list
#
ROOTDIRS-y := lib fpga_drivers dhl_nflib dhl_manager
export ROOTDIRS-y ROOTDIRS- ROOTDIRS-n
fpga_drivers: | lib
dhl_nflib: | lib fpga_drivers
dhl_manager: | lib fpga_drivers dhl_nflib
# define Q to '@' or not. $(Q) is used to prefix all shell commands to
# be executed silently.
Q=@
ifeq '$V' '0'
override V=
endif
ifdef V
ifeq ("$(origin V)", "command line")
Q=
endif
endif
export Q
#
# export DHL_SRCDIR and BUILDING_DHL_SDK
#
DHL_SRCDIR = $(CURDIR)
export DHL_SRCDIR
#
# Default output is $(DHL_SRCDIR)/build
# output files will go in a seperate directory
#
ifdef O
ifeq ("$(origin O)", "command line")
DHL_OUTPUT := $(abspath $(O))
endif
endif
DHL_OUTPUT ?= $(DHL_SRCDIR)/build
export DHL_OUTPUT
# the directory where intermediate build files are stored, like *.o,
# *.d, *.cmd, ...
BUILDDIR = $(DHL_OUTPUT)/build
export BUILDDIR
# for external lib, drivers compilation
RTE_SRCDIR ?= DHL_SRCDIR
RTE_OUTPUT ?= DHL_OUTPUT
export RTE_SRCDIR
export RTE_OUTPUT
#
# build and clean targets
#
CLEANDIRS = $(addsuffix _clean,$(ROOTDIRS-y) $(ROOTDIRS-n) $(ROOTDIRS-))
.PHONY: build
build: $(ROOTDIRS-y)
@echo "Build comlete DHL"
.PHONY: clean
#clean: $(CLEANDIRS)
# @echo "clean have not been realised"
clean:
rm -rf ./build/
.SECONDEXPANSION:
.PHONY: $(ROOTDIRS-y) $(ROOTDIRS-)
$(ROOTDIRS-y) $(ROOTDIRS-):
@[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@
@echo "==Build $@"
$(Q)$(MAKE) O=$(BUILDDIR)/$(@) -C $(DHL_SRCDIR)/$@ all
# @if [ $@ = drivers ]; then \
# $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \
# fi
%_clean:
@echo "== Clean $*"
$(Q)if [ -f $(DHL_SRCDIR)/$*/Makefile -a -d $(BUILDDIR)/$* ]; then \
$(MAKE) S=$* -f $(DHL_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* clean ; \
fi
$(DHL_OUTPUT):
$(Q)mkdir -p $@
.PHONY: default
default: all
.PHONY: all
all: builddir build
.PHONY: builddir
builddir: $(DHL_OUTPUT)
@echo "The build dir is" $(DHL_OUTPUT)
.PHONY: FORCE
FORCE: