1 |
4 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: A wishbone controlled DDR3 SDRAM memory controller.
|
6 |
|
|
##
|
7 |
|
|
## Purpose: This coordinates the build of the singular test bench C++
|
8 |
|
|
## program found in this directory: ddrsdram_tb.
|
9 |
|
|
##
|
10 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
11 |
|
|
## Gisselquist Technology, LLC
|
12 |
|
|
##
|
13 |
|
|
################################################################################
|
14 |
|
|
##
|
15 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
16 |
|
|
##
|
17 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
18 |
|
|
## modify it under the terms of the GNU General Public License as published
|
19 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
20 |
|
|
## your option) any later version.
|
21 |
|
|
##
|
22 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
23 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
24 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
25 |
|
|
## for more details.
|
26 |
|
|
##
|
27 |
|
|
## You should have received a copy of the GNU General Public License along
|
28 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
29 |
|
|
## target there if the PDF file isn't present.) If not, see
|
30 |
|
|
## for a copy.
|
31 |
|
|
##
|
32 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
33 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
34 |
|
|
##
|
35 |
|
|
##
|
36 |
|
|
################################################################################
|
37 |
|
|
##
|
38 |
|
|
##
|
39 |
|
|
all: $(OBJDIR)/ ddrsdram_tb
|
40 |
|
|
|
41 |
|
|
CXX := g++
|
42 |
|
|
OBJDIR := obj-pc
|
43 |
|
|
YYMMDD := `date +%Y%m%d`
|
44 |
|
|
RTLD := ../../rtl
|
45 |
|
|
VOBJDR := $(RTLD)/obj_dir
|
46 |
|
|
VROOT := /usr/share/verilator
|
47 |
|
|
VINC := -I$(VROOT)/include -I$(VOBJDR)
|
48 |
|
|
CFLAGS := -Wall -c -Og -g -I. $(VINC)
|
49 |
|
|
SOURCES := ddrsdramsim.cpp ddrsdram_tb.cpp
|
50 |
|
|
VOBJDR := $(RTLD)/obj_dir
|
51 |
|
|
VLIB := $(VROOT)/include/verilated.cpp
|
52 |
|
|
|
53 |
|
|
$(OBJDIR)/:
|
54 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
55 |
|
|
|
56 |
|
|
$(OBJDIR)/ddrsdramsim.o: ddrsdramsim.cpp ddrsdramsim.h $(VOBJDR)/Vwbddrsdram.h
|
57 |
|
|
$(CXX) $(CFLAGS) ddrsdramsim.cpp -o $@
|
58 |
|
|
$(OBJDIR)/verilated.o: $(VLIB) $(OBJDIR)/
|
59 |
|
|
$(CXX) $(CFLAGS) $(VLIB) -o $@
|
60 |
|
|
$(OBJDIR)/ddrsdram_tb.o: ddrsdram_tb.cpp ddrsdramsim.h $(VOBJDR)/Vwbddrsdram.h
|
61 |
|
|
$(CXX) $(CFLAGS) ddrsdram_tb.cpp -o $@
|
62 |
|
|
|
63 |
|
|
OBJECTS := ddrsdramsim.o ddrsdram_tb.o verilated.o
|
64 |
|
|
OBJECTSDR:= $(addprefix $(OBJDIR)/,$(OBJECTS))
|
65 |
|
|
ddrsdram_tb: $(OBJECTSDR) $(VOBJDR)/Vwbddrsdram__ALL.a
|
66 |
|
|
$(CXX) -Wall $(INCS) $^ -o $@
|
67 |
|
|
|
68 |
|
|
.PHONY: clean
|
69 |
|
|
clean:
|
70 |
|
|
rm -rf $(OBJDIR)/ ddrsdram_tb
|
71 |
|
|
|