1 |
75 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: XuLA2-LX25 SoC based upon the ZipCPU
|
6 |
|
|
##
|
7 |
|
|
## Purpose: To coordinate the build of a cycle accurate, Verilator based,
|
8 |
|
|
## simulation of the busmaster module. Access to the simulation
|
9 |
|
|
## is provided via the same software commands that will access the board,
|
10 |
|
|
## save that the parameters are a touch different. (See the access
|
11 |
|
|
## software for more information ...)
|
12 |
|
|
##
|
13 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
14 |
|
|
## Gisselquist Technology, LLC
|
15 |
|
|
##
|
16 |
|
|
################################################################################
|
17 |
|
|
##
|
18 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
19 |
|
|
##
|
20 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
21 |
|
|
## modify it under the terms of the GNU General Public License as published
|
22 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
23 |
|
|
## your option) any later version.
|
24 |
|
|
##
|
25 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
26 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
27 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
28 |
|
|
## for more details.
|
29 |
|
|
##
|
30 |
|
|
## You should have received a copy of the GNU General Public License along
|
31 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
32 |
|
|
## target there if the PDF file isn't present.) If not, see
|
33 |
|
|
## for a copy.
|
34 |
|
|
##
|
35 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
36 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
37 |
|
|
##
|
38 |
|
|
##
|
39 |
|
|
################################################################################
|
40 |
|
|
##
|
41 |
|
|
##
|
42 |
4 |
dgisselq |
.PHONY: all
|
43 |
75 |
dgisselq |
# Make certain the "all" target is the first and therefore the default target
|
44 |
|
|
all:
|
45 |
4 |
dgisselq |
CXX := g++
|
46 |
|
|
OBJDIR := obj-pc
|
47 |
|
|
YYMMDD := `date +%Y%m%d`
|
48 |
|
|
VOBJDR := ../../rtl/obj_dir
|
49 |
|
|
VROOT := /usr/share/verilator
|
50 |
|
|
VINC := -I$(VROOT)/include -I$(VOBJDR)
|
51 |
|
|
CFLAGS := -c -g -Wall -I. $(VINC)
|
52 |
75 |
dgisselq |
# Now return to the "all" target, and fill in some details
|
53 |
4 |
dgisselq |
all: $(OBJDIR)/ programs archive
|
54 |
|
|
|
55 |
|
|
# GFXFLAGS := `pkg-config gtkmm-3.0 --cflags`
|
56 |
|
|
# GFXLIBS := `pkg-config gtkmm-3.0 --cflags --libs`
|
57 |
|
|
|
58 |
|
|
.PHONY: programs
|
59 |
|
|
programs: busmaster_tb
|
60 |
|
|
|
61 |
|
|
.PHONY: clean
|
62 |
|
|
clean:
|
63 |
|
|
rm -f busmaster_rb $(OBJDIR)/*.o
|
64 |
|
|
|
65 |
|
|
$(OBJDIR)/:
|
66 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
67 |
|
|
|
68 |
75 |
dgisselq |
CLSHEADERS: qspiflashsim.h sdramsim.h sdspisim.h
|
69 |
|
|
CLSSOURCES: $(subst .h,.cpp,$(CLSHEADERS))
|
70 |
|
|
CLSOBJECTS: $(addprefix $(OBJDIR)/,$(subst .h,.o,$(CLSHEADERS)))
|
71 |
|
|
|
72 |
|
|
$(OBJDIR)/%.o: %.cpp
|
73 |
4 |
dgisselq |
$(CXX) $(CFLAGS) $< -o $@
|
74 |
|
|
$(OBJDIR)/busmaster_tb.o: busmaster_tb.cpp pipecmdr.h sdramsim.h
|
75 |
|
|
$(OBJDIR)/busmaster_tb.o: port.h $(VOBJDR)/Vbusmaster.h
|
76 |
|
|
$(CXX) $(CFLAGS) busmaster_tb.cpp -o $@
|
77 |
|
|
$(OBJDIR)/verilated.o: $(VROOT)/include/verilated.cpp
|
78 |
|
|
$(CXX) $(CFLAGS) $< -o $@
|
79 |
|
|
|
80 |
75 |
dgisselq |
busmaster_tb: $(OBJDIR)/qspiflashsim.o $(OBJDIR)/sdspisim.o
|
81 |
4 |
dgisselq |
busmaster_tb: $(OBJDIR)/verilated.o
|
82 |
|
|
busmaster_tb: $(VOBJDR)/Vbusmaster__ALL.a
|
83 |
|
|
busmaster_tb: $(OBJDIR)/busmaster_tb.o $(OBJDIR)/sdramsim.o
|
84 |
|
|
$(CXX) -g -o $@ $^
|
85 |
|
|
|
86 |
75 |
dgisselq |
define build-depends
|
87 |
|
|
@echo "Building dependency file"
|
88 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
89 |
|
|
@$(CXX) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
90 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
91 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
92 |
|
|
endef
|
93 |
|
|
|
94 |
|
|
tags: $(SOURCES) $(HEADERS)
|
95 |
|
|
@echo "Generating tags"
|
96 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
97 |
|
|
|
98 |
|
|
.PHONY: depends
|
99 |
|
|
depends: tags
|
100 |
|
|
$(build-depends)
|
101 |
|
|
|
102 |
4 |
dgisselq |
.PHONY: archive
|
103 |
|
|
archive:
|
104 |
|
|
tar --transform s,^,$(YYMMDD)-bench-cpp/, -chjf $(YYMMDD)-bench-cpp.tjz Makefile *.cpp *.h
|
105 |
75 |
dgisselq |
|
106 |
|
|
-include $(OBJDIR)/depends.txt
|