1 |
58 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: OpenArty, an entirely open SoC based upon the Arty platform
|
6 |
|
|
##
|
7 |
|
|
## Purpose:
|
8 |
|
|
##
|
9 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
10 |
|
|
## Gisselquist Technology, LLC
|
11 |
|
|
##
|
12 |
|
|
################################################################################
|
13 |
|
|
##
|
14 |
|
|
## Copyright (C) 2015-2017, Gisselquist Technology, LLC
|
15 |
|
|
##
|
16 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
17 |
|
|
## modify it under the terms of the GNU General Public License as published
|
18 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
19 |
|
|
## your option) any later version.
|
20 |
|
|
##
|
21 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
23 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
## for more details.
|
25 |
|
|
##
|
26 |
|
|
## You should have received a copy of the GNU General Public License along
|
27 |
|
|
## with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
28 |
|
|
## target there if the PDF file isn't present.) If not, see
|
29 |
|
|
## for a copy.
|
30 |
|
|
##
|
31 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
32 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
33 |
|
|
##
|
34 |
|
|
##
|
35 |
|
|
################################################################################
|
36 |
|
|
##
|
37 |
|
|
##
|
38 |
|
|
CXX := g++
|
39 |
|
|
OBJDIR := obj-pc
|
40 |
|
|
RTLD := ../../rtl
|
41 |
|
|
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
|
42 |
|
|
VROOT := $(VERILATOR_ROOT)
|
43 |
|
|
GFXFLAGS:= `pkg-config gtkmm-3.0 --cflags`
|
44 |
|
|
GFXLIBS := `pkg-config gtkmm-3.0 --cflags --libs`
|
45 |
|
|
FLAGS := -Wall -Og -g
|
46 |
|
|
VINCD := $(VROOT)/include
|
47 |
|
|
INCS := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VINCD) -I$(VINCD)/vltstd
|
48 |
|
|
SOURCES := fastmaster_tb.cpp eqspiflashsim.cpp eqspiflash_tb.cpp \
|
49 |
|
|
oledsim.cpp enetctrlsim.cpp zipelf.cpp byteswap.cpp \
|
50 |
|
|
memsim.cpp sdspisim.cpp uartsim.cpp ddrsdramsim.cpp
|
51 |
|
|
HEADERS := ddrsdramsim.h enetctrlsim.h eqspiflashsim.h memsim.h \
|
52 |
|
|
oledsim.h pipecmdr.h port.h sdspisim.h testb.h uartsim.h zipelf.h
|
53 |
|
|
VOBJDR := $(RTLD)/obj_dir
|
54 |
|
|
VOBJS := $(OBJDIR)/verilated.o $(OBJDIR)/verilated_vcd_c.o
|
55 |
|
|
SIMSRCS := enetctrlsim.cpp eqspiflashsim.cpp zipelf.cpp \
|
56 |
|
|
memsim.cpp sdspisim.cpp uartsim.cpp oledsim.cpp byteswap.cpp
|
57 |
|
|
SIMOBJ := $(subst .cpp,.o,$(SIMSRCS))
|
58 |
|
|
SIMOBJS:= $(addprefix $(OBJDIR)/,$(SIMOBJ))
|
59 |
|
|
PROGRAMS := busmaster_tb eqspiflash_tb enetctrl_tb
|
60 |
|
|
all: $(OBJDIR)/ $(PROGRAMS)
|
61 |
|
|
|
62 |
|
|
$(OBJDIR)/:
|
63 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
64 |
|
|
|
65 |
|
|
$(OBJDIR)/%.o: %.cpp
|
66 |
|
|
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
67 |
|
|
|
68 |
|
|
$(OBJDIR)/%.o: $(VINCD)/%.cpp
|
69 |
|
|
$(CXX) $(FLAGS) $(INCS) -c $< -o $@
|
70 |
|
|
|
71 |
|
|
.PHONY: oledsim.o
|
72 |
|
|
oledsim.o: $(OBJDIR)/oledsim.o
|
73 |
|
|
$(OBJDIR)/oledsim.o: oledsim.cpp
|
74 |
|
|
$(CXX) $(FLAGS) $(GFXFLAGS) -c $< -o $@
|
75 |
|
|
|
76 |
|
|
# While busmaster_tb.o isnt really dependent upon fastmaster_tb.o, this
|
77 |
|
|
# makes certain that all of the dependencies of fastmaster_tb are captured
|
78 |
|
|
# in busmaster. Hence, if fastmaster_tb is remade/rebuilt because one of
|
79 |
|
|
# its dependencies change, so too is busmaster_tb.
|
80 |
|
|
#
|
81 |
|
|
$(OBJDIR)/busmaster_tb.o: fastmaster_tb.cpp
|
82 |
|
|
$(CXX) $(FLAGS) $(GFXFLAGS) $(INCS) -c $< -o $@
|
83 |
|
|
|
84 |
|
|
$(OBJDIR)/fastmaster_tb.o: fastmaster_tb.cpp
|
85 |
|
|
$(CXX) -DFASTCLK $(FLAGS) $(GFXFLAGS) $(INCS) -c $< -o $@
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
eqspiflash_tb: $(OBJDIR)/eqspiflash_tb.o $(OBJDIR)/eqspiflashsim.o
|
90 |
|
|
eqspiflash_tb: $(VOBJS) $(VOBJDR)/Veqspiflash__ALL.a
|
91 |
|
|
$(CXX) $(FLAGS) $(INCS) $^ $(VOBJDR)/Veqspiflash__ALL.a -o $@
|
92 |
|
|
|
93 |
|
|
enetctrl_tb: enetctrl_tb.cpp $(OBJDIR)/enetctrlsim.o
|
94 |
|
|
enetctrl_tb: $(VOBJS) $(VOBJDR)/Venetctrl__ALL.a
|
95 |
|
|
$(CXX) $(FLAGS) $(INCS) $^ $(VOBJDR)/Venetctrl__ALL.a -o $@
|
96 |
|
|
|
97 |
|
|
fastmaster_tb: $(OBJDIR)/fastmaster_tb.o $(SIMOBJS)
|
98 |
|
|
fastmaster_tb: $(VOBJS) $(VOBJDR)/Vfastmaster__ALL.a
|
99 |
|
|
$(CXX) $(GFXLIBS) $^ $(VOBJDR)/Vfastmaster__ALL.a -lelf -o $@
|
100 |
|
|
busmaster_tb: $(OBJDIR)/busmaster_tb.o $(SIMOBJS)
|
101 |
|
|
busmaster_tb: $(VOBJS) $(VOBJDR)/Vbusmaster__ALL.a
|
102 |
|
|
$(CXX) $(GFXLIBS) $(INCS) $^ $(VOBJDR)/Vbusmaster__ALL.a $(GFXLIBS) -lelf -o $@
|
103 |
|
|
|
104 |
|
|
define build-depends
|
105 |
|
|
@echo "Building dependency file(s)"
|
106 |
|
|
@$(CXX) $(GFXFLAGS) $(INCS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
107 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt \
|
108 |
|
|
| sed -e 's/fastmaster_tb.o/busmaster_tb.o/g' \
|
109 |
|
|
> $(OBJDIR)/depends.txt
|
110 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
111 |
|
|
endef
|
112 |
|
|
|
113 |
|
|
tags: $(SOURCES) $(HEADERS)
|
114 |
|
|
@echo "Generating tags"
|
115 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
116 |
|
|
|
117 |
|
|
.PHONY: clean
|
118 |
|
|
clean:
|
119 |
|
|
rm -f *.vcd
|
120 |
|
|
rm -rf $(OBJDIR)/
|
121 |
|
|
rm -f $(PROGRAMS)
|
122 |
|
|
# rm -f ./fastmaster_tb
|
123 |
|
|
|
124 |
|
|
.PHONY: depends
|
125 |
|
|
depends:
|
126 |
|
|
$(build-depends)
|
127 |
|
|
|
128 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
129 |
|
|
$(build-depends)
|
130 |
|
|
|
131 |
|
|
-include $(OBJDIR)/depends.txt
|