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

Subversion Repositories qspiflash

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
################################################################################
2
##
3
## Filename:    Makefile
4
##
5
## Project:     Wishbone Controlled Quad SPI Flash Controller
6
##
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 16 dgisselq
## Copyright (C) 2015-2017, Gisselquist Technology, LLC
17 12 dgisselq
##
18
## This program is free software (firmware): you can redistribute it and/or
19
## modify it under the terms of  the GNU General Public License as published
20
## by the Free Software Foundation, either version 3 of the License, or (at
21
## your option) any later version.
22
##
23
## This program is distributed in the hope that it will be useful, but WITHOUT
24
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26
## for more details.
27
##
28
## You should have received a copy of the GNU General Public License along
29 16 dgisselq
## with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
30 12 dgisselq
## target there if the PDF file isn't present.)  If not, see
31
##  for a copy.
32
##
33
## License:     GPL, v3, as defined and found on www.gnu.org,
34
##              http://www.gnu.org/licenses/gpl.html
35
##
36
##
37
################################################################################
38
##
39
##
40
CXX     := g++
41 16 dgisselq
CFLAGS  := -Wall -Og -g
42 12 dgisselq
OBJDIR  := obj-pc
43
RTLD    := ../../rtl
44 13 dgisselq
VERILATOR_ROOT   ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
45
VROOT   := $(VERILATOR_ROOT)
46 16 dgisselq
VINCD   := $(VROOT)/include
47
INCS    := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VINCD) -I$(VINCD)/vltstd
48
EQSOURCES := eqspiflashsim.cpp eqspiflash_tb.cpp
49
QSOURCES  :=  qspiflashsim.cpp  qspiflash_tb.cpp
50
SOURCES := $(EQSOURCES) $(QSOURCES)
51 12 dgisselq
VOBJDR  := $(RTLD)/obj_dir
52 16 dgisselq
RAWVLIB := verilated.cpp verilated_vcd_c.cpp
53
VSRCS   := $(addprefix $(VROOT)/include/,$(RAWVLIB))
54
VOBJS   := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(RAWVLIB)))
55
QOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(QSOURCES))) $(VOBJS)
56
EQOBJS   :=  $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(EQSOURCES))) $(VOBJS)
57 12 dgisselq
SIMSRCS := enetctrlsim.cpp eqspiflashsim.cpp
58 16 dgisselq
all:    qspiflash_tb pretest
59 12 dgisselq
 
60
$(OBJDIR)/%.o: %.cpp
61 16 dgisselq
        $(mk-objdir)
62
        $(CXX) $(CFLAGS) $(INCS) -c $< -o $@
63 12 dgisselq
 
64 16 dgisselq
$(OBJDIR)/%.o: $(VINCD)/%.cpp
65
        $(mk-objdir)
66
        $(CXX) $(CFLAGS) $(INCS) -c $< -o $@
67 12 dgisselq
 
68 16 dgisselq
eqspiflash_tb: $(EQOBJS) $(VOBJDR)/Veqspiflash__ALL.a
69
        $(CXX) $(CFLAGS) $(INCS) $(EQOBJS) $(VOBJDR)/Veqspiflash__ALL.a -o $@
70
 
71
qspiflash_tb: $(QOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a $(VOBJS)
72
        $(CXX) $(CFLAGS) $(INCS) $(QOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a -o $@
73
 
74 12 dgisselq
.PHONY: pretest
75 16 dgisselq
pretest: qspiflash_tb eqspiflash_tb
76 12 dgisselq
        @echo "The test bench has been created.  Type make test, and look at"
77
        @echo "the end of its output to see if it (still) works."
78
 
79 16 dgisselq
# .PHONY: test
80
# test: eqspiflash_tb
81
#       ./eqspiflash_tb
82
 
83
.PHONY: test qtest eqtest
84
test: qtest eqtest
85
qtest: qspiflash_tb
86
        ./qspiflash_tb
87
eqtest: eqspiflash_tb qtest
88 12 dgisselq
        ./eqspiflash_tb
89
 
90 16 dgisselq
define  mk-objdir
91
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
92
endef
93
 
94
 
95
define build-depends
96
        @echo "Building dependency file(s)"
97
        $(mk-objdir)
98
        @$(CXX) $(CFLAGS) $(INCS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
99
        @sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
100
        @rm $(OBJDIR)/xdepends.txt
101
endef
102
 
103
tags: $(SOURCES) $(HEADERS)
104
        @echo "Generating tags"
105
        @ctags $(SOURCES) $(HEADERS)
106
 
107 12 dgisselq
.PHONY: clean
108
clean:
109 16 dgisselq
        rm -f ./eqspiflash_tb qspiflash_tb
110
        rm -rf $(OBJDIR)/
111
 
112
.PHONY: depends
113
depends: tags
114
        $(build-depends)
115
 
116
$(OBJDIR)/depends.txt: $(SOURCES) $(HEADERS)
117
        $(build-depends)
118
 
119
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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