OpenCores
URL https://opencores.org/ocsvn/qspiflash/qspiflash/trunk

Subversion Repositories qspiflash

[/] [qspiflash/] [trunk/] [bench/] [cpp/] [Makefile] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
################################################################################
2
##
3
## Filename:    Makefile
4
##
5 24 dgisselq
## Project:     A Set of Wishbone Controlled SPI Flash Controllers
6 12 dgisselq
##
7
## Purpose:     This makefile coordinates the build of the extended quad spi
8
##              flash controller (not the normal quad spi flash controller also
9
##      in this directory).
10
##
11
## Creator:     Dan Gisselquist, Ph.D.
12
##              Gisselquist Technology, LLC
13
##
14
################################################################################
15
##
16 24 dgisselq
## Copyright (C) 2015-2019, Gisselquist Technology, LLC
17 12 dgisselq
##
18 24 dgisselq
## This file is part of the set of Wishbone controlled SPI flash controllers
19
## project
20 12 dgisselq
##
21 24 dgisselq
## The Wishbone SPI flash controller project is free software (firmware):
22
## you can redistribute it and/or modify it under the terms of the GNU Lesser
23
## General Public License as published by the Free Software Foundation, either
24
## version 3 of the License, or (at your option) any later version.
25 12 dgisselq
##
26 24 dgisselq
## The Wishbone SPI flash controller project is distributed in the hope
27
## that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
28
## warranty of MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
## GNU Lesser General Public License for more details.
30
##
31
## You should have received a copy of the GNU Lesser General Public License along
32 16 dgisselq
## with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
33 12 dgisselq
## target there if the PDF file isn't present.)  If not, see
34
##  for a copy.
35
##
36 24 dgisselq
## License:     LGPL, v3, as defined and found on www.gnu.org,
37
##              http://www.gnu.org/licenses/lgpl.html
38 12 dgisselq
##
39
##
40
################################################################################
41
##
42
##
43
CXX     := g++
44 16 dgisselq
CFLAGS  := -Wall -Og -g
45 12 dgisselq
OBJDIR  := obj-pc
46
RTLD    := ../../rtl
47 13 dgisselq
VERILATOR_ROOT   ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
48
VROOT   := $(VERILATOR_ROOT)
49 24 dgisselq
VDEFS   := $(shell ./vversion.sh)
50 16 dgisselq
VINCD   := $(VROOT)/include
51
INCS    := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VINCD) -I$(VINCD)/vltstd
52 24 dgisselq
SIMSRCS :=  flashsim.cpp byteswap.cpp
53
LEGACYSRC := wbqspiflash_tb.cpp $(SIMSRCS)
54
SPISRC  := spixpress_tb.cpp     $(SIMSRCS)
55
DSPISRC := dualflexpress_tb.cpp $(SIMSRCS)
56
QSPISRC := qflexpress_tb.cpp    $(SIMSRCS)
57
SOURCES := $(wildcard *_tb.cpp) flashsim.cpp
58 12 dgisselq
VOBJDR  := $(RTLD)/obj_dir
59 16 dgisselq
RAWVLIB := verilated.cpp verilated_vcd_c.cpp
60
VSRCS   := $(addprefix $(VROOT)/include/,$(RAWVLIB))
61
VOBJS   := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(RAWVLIB)))
62 24 dgisselq
LOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(LEGACYSRC))) $(VOBJS)
63
SOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SPISRC)))  $(VOBJS)
64
DOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DSPISRC))) $(VOBJS)
65
QOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(QSPISRC))) $(VOBJS)
66
all:    wbqspiflash_tb
67 12 dgisselq
 
68
$(OBJDIR)/%.o: %.cpp
69 16 dgisselq
        $(mk-objdir)
70 24 dgisselq
        $(CXX) $(CFLAGS) $(VDEFS) $(INCS) -c $< -o $@
71 12 dgisselq
 
72 16 dgisselq
$(OBJDIR)/%.o: $(VINCD)/%.cpp
73
        $(mk-objdir)
74
        $(CXX) $(CFLAGS) $(INCS) -c $< -o $@
75 12 dgisselq
 
76 24 dgisselq
wbqspiflash_tb: $(LOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a
77
        $(CXX) $(CFLAGS) $(INCS) $(LOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a -o $@
78 16 dgisselq
 
79 24 dgisselq
spixpress_tb: $(SOBJS) $(VOBJDR)/Vspixpress__ALL.a
80
        $(CXX) $(CFLAGS) $(INCS) $(SOBJS) $(VOBJDR)/Vspixpress__ALL.a -o $@
81 16 dgisselq
 
82 24 dgisselq
dualflexpress_tb: $(DOBJS) $(VOBJDR)/Vdualflexpress__ALL.a
83
        $(CXX) $(CFLAGS) $(INCS) $(DOBJS) $(VOBJDR)/Vdualflexpress__ALL.a -o $@
84
 
85
qflexpress_tb: $(QOBJS) $(VOBJDR)/Vqflexpress__ALL.a
86
        $(CXX) $(CFLAGS) $(INCS) $(QOBJS) $(VOBJDR)/Vqflexpress__ALL.a -o $@
87
 
88 12 dgisselq
.PHONY: pretest
89 24 dgisselq
pretest: spixpress_tb dualflexpress_tb qflexpress_tb
90 12 dgisselq
        @echo "The test bench has been created.  Type make test, and look at"
91
        @echo "the end of its output to see if it (still) works."
92
 
93 16 dgisselq
# .PHONY: test
94
# test: eqspiflash_tb
95
#       ./eqspiflash_tb
96
 
97 24 dgisselq
.PHONY: test stest dtest qtest legacytest
98
test: stest dtest qtest
99
stest: spixpress_tb
100
        ./spixpress_tb
101
dtest: dualflexpress_tb
102
        ./dualflexpress_tb
103
qtest: qflexpress_tb
104
        ./qflexpress_tb
105
legacytest: wbqpiflash_tb
106
        ./wbqpiflash_tb
107 12 dgisselq
 
108 16 dgisselq
define  mk-objdir
109
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
110
endef
111
 
112
 
113
define build-depends
114
        @echo "Building dependency file(s)"
115
        $(mk-objdir)
116
        @$(CXX) $(CFLAGS) $(INCS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
117
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
118
        @rm $(OBJDIR)/xdepends.txt
119
endef
120
 
121
tags: $(SOURCES) $(HEADERS)
122
        @echo "Generating tags"
123
        @ctags $(SOURCES) $(HEADERS)
124
 
125 12 dgisselq
.PHONY: clean
126
clean:
127 24 dgisselq
        rm -f spixpress_tb dualflexpress_tb qflexpress_tb
128
        rm -f *.vcd
129
        rm -rf wbqspiflash_tb $(OBJDIR)/
130 16 dgisselq
 
131
.PHONY: depends
132
depends: tags
133
        $(build-depends)
134
 
135
$(OBJDIR)/depends.txt: $(SOURCES) $(HEADERS)
136
        $(build-depends)
137
 
138 24 dgisselq
ifneq ($(MAKECMDGOALS),clean)
139 16 dgisselq
-include $(OBJDIR)/depends.txt
140 24 dgisselq
endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.