-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
150 lines (110 loc) · 4.63 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#====================================================================#
#h#. ____ _________ _______ __ __
#h#. / __ \/ _/ ___// ____/ | / / ____ _/ /_____ ____ ___
#h#. / /_/ // / \__ \/ / | | / / / __ `/ __/ __ \/ __ `__ \
#h#. / _, _// / ___/ / /___ | |/ / / /_/ / /_/ /_/ / / / / / /
#h#. /_/ |_/___//____/\____/ |___/ \__,_/\__/\____/_/ /_/ /_/
#h#
#====================================================================#
# README:
# This is the root makefile for the RISC-V Atom project. It
# provides the convenience of building sim, tools, lib, etc from
# the root of the project directory. see `$ make help` for info
# on how to usage instructions and available targets
#
#====================================================================#
#h# ***** RISC-V Atom Root Makefile *****
#v# Specify soctarget
soctarget?= atombones
#v# Build for simulation
sim?=1
#v# Enable debug build of atomsim
debug?=0
# Flags to the makefiles
MKFLAGS := -s
_mk_check_env:=1
include common.mk
#######################################################################
# Directories
sim_dir := sim
scar_dir := test/scar
elfdump_dir := tools/elfdump
bootloader_dir := sw/bootloader
lib_dir := sw/lib
doxy_dir := sim/docs
#======================================================================
# Recepies
#======================================================================
default: sim lib boot #t# Build atomsim, libcatom and bootloader
@printf "\n$(CLR_GR)==============================\n"
@printf " Build Succesful!\n"
@printf "==============================$(CLR_NC)\n"
@printf " soctarget: $(soctarget), sim: $(sim), debug: $(debug)\n"
all : doxy-pdf default #t# Build default with docs
# ======== AtomSim ========
.PHONY : sim
sim: boot #t# Build atomsim for given soctarget
$(call print_msg_root,Building AtomSim)
$(MAKE) $(MKFLAGS) -C $(sim_dir) soctarget=$(soctarget) DEBUG=$(debug)
.PHONY: clean-sim
clean-sim: #t# Clean atomsim build files
$(call print_msg_root,Cleaning AtomSim build files)
$(MAKE) $(MKFLAGS) -C $(sim_dir) soctarget=$(soctarget) clean
.PHONY: test
test: sim lib #t# Test the build using banner example
$(call print_msg_root,Running example on Atomsim)
$(MAKE) $(MKFLAGS) -C $(RVATOM)/sw/examples soctarget=$(soctarget) ex=banner sim=1 clean compile run
# ======== Bootloader ========
.PHONY : boot
boot: lib #t# Build bootloader for given target
$(call print_msg_root,Building bootloader)
$(MAKE) $(MKFLAGS) -C $(bootloader_dir) soctarget=$(soctarget) sim=$(sim)
.PHONY: clean-boot
clean-boot: #t# Clean bootloader build files
$(call print_msg_root,Cleaning bootloader build files)
$(MAKE) $(MKFLAGS) -C $(bootloader_dir) soctarget=$(soctarget) clean
# ======== SCAR ========
.PHONY: scar
scar: sim #t# Verify target using scar
$(call print_msg_root,Running SCAR)
$(MAKE) $(MKFLAGS) -C $(scar_dir)
.PHONY: clean-scar
clean-scar: #t# Clean scar directory
$(call print_msg_root,Cleaning SCAR working directory)
$(MAKE) $(MKFLAGS) -C $(scar_dir) clean
# ======== ElfDump ========
.PHONY: elfdump
elfdump: #t# Build elfdump utility
$(call print_msg_root,Building ELFDump)
$(MAKE) $(MKFLAGS) -C $(elfdump_dir)
.PHONY: clean-elfdump
clean-elfdump: #t# Clean elfdump directory
$(call print_msg_root,Cleaning ELFDump build files)
$(MAKE) $(MKFLAGS) -C $(elfdump_dir) clean
# ======== SW libs ========
.PHONY: lib
lib: #t# compile software libraries
$(call print_msg_root,Building libcatom)
$(MAKE) $(MKFLAGS) -C $(lib_dir) soctarget=$(soctarget) sim=$(sim)
.PHONY: clean-lib
clean-lib: #t# Clean software libs
$(call print_msg_root,Cleaning libcatom build files)
$(MAKE) $(MKFLAGS) -C $(lib_dir) clean
# ======== Documentation ========
.PHONY: doxy
doxy: #t# Generate atomsim C++ source documentation
$(call print_msg_root,Generating docs for AtomSim,LATEX & HTML)
$(MAKE) $(MKFLAGS) -C $(doxy_dir)
.PHONY: doxy-pdf
doxy-pdf: doxy #t# Generate atomsim C++ source documentation (pdf)
$(call print_msg_root,Generating docs for AtomSim,PDF)
$(MAKE) $(MKFLAGS) -C $(doxy_dir) pdf
.PHONY: clean-doxy
clean-doxy: #t# Clean build files for Atomsim docs
$(call print_msg_root,Cleaning docs build files)
$(MAKE) $(MKFLAGS) -C $(doxy_dir) clean
# ======== clean ========
.PHONY: clean
clean: clean-sim clean-boot clean-lib #t# Alias for clean-sim, clean-lib
.PHONY: clean-all
clean-all: clean-sim clean-boot clean-scar clean-elfdump clean-lib clean-doxy #t# Clean all build files