-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
112 lines (97 loc) · 2.96 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
109
110
111
112
#
# Copyright (c) 2019, Wuklab, UCSD.
#
# o Do not use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour);
# o Look for make include files relative to root of kernel src
MAKEFLAGS += -rR --include-dir=$(CURDIR)
# Do not print "Entering directory ...",
# but we want to display it when entering to the output directory
MAKEFLAGS += --no-print-directory
# Beautify output
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
endif
ifeq ($(KBUILD_VERBOSE), 1)
Q =
else
Q = @
endif
export Q KBUILD_VERBOSE
# Current SHELL
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
HOSTCC = gcc
HOSTCXX = g++
HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
HOSTCXXFLAGS = -O2
export CONFIG_SHELL HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS
# Configure Board
DEFAULT_BOARD = vcu118
ifeq ("$(origin board)", "command line")
TARGET_BOARD = $(board)
endif
ifndef TARGET_BOARD
TARGET_BOARD = $(DEFAULT_BOARD)
DEFAULT_BOARD_USED = 1
endif
VALID_TARGET_BOARD = arty_a7 vcu108 vcu118
ifeq ($(findstring $(TARGET_BOARD), $(VALID_TARGET_BOARD)), )
$(error Target board [$(TARGET_BOARD)] not found. Supported boards: $(VALID_TARGET_BOARD))
endif
export TARGET_BOARD DEFAULT_BOARD_USED
GENERATED_IP = generated_ip/
#
# Order matters. Build small, no-dependency IPs first.
# System-level IPs must come at last.
#
PHONY :=
all:
$(Q)mkdir -p $(GENERATED_IP)
$(Q)make -C alloc
$(Q)make -C lib
$(Q)make -C net
$(Q)make -C mm
$(Q)make -C app
$(Q)make -C system
#
# This cleans up everything.
# Compiling takes time.
# Use with caution.
#
PHONY += clean
clean:
rm -rf $(GENERATED_IP)
find ./ -name "generated_ip" | xargs rm -rf
find ./ -name "generated_hls_project" | xargs rm -rf
find ./ -name "generated_vivado_project" | xargs rm -rf
find ./ -name "*.log" | xargs rm -rf
find ./ -name "*.jou" | xargs rm -rf
find ./ -name "*.str" | xargs rm -rf
find ./ -name ".Xil" | xargs rm -rf
find ./ -name "awsver.txt" | xargs rm -rf
find ./ -name "ipshared" | xargs rm -rf
find ./ -name "generated" | xargs rm -rf
find ./ -name "generated_project" | xargs rm -rf
PHONY += help
help:
@echo 'Build:'
@echo ' make board= - Build for certain board. If board field is not given,'
@echo ' The default board $(DEFAULT_BOARD) will be used.'
@echo ''
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
@echo ''
@echo 'Supported Boards:'
@$(if $(VALID_TARGET_BOARD), \
$(foreach b, $(VALID_TARGET_BOARD), \
echo " $(b)";) \
echo '')
@echo 'Cleaning targets:'
@echo ' clean - Remove all generated files'
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends.
.PHONY: $(PHONY)