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

Subversion Repositories wbpwmaudio

[/] [wbpwmaudio/] [trunk/] [demo-rtl/] [Makefile] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 dgisselq
################################################################################
2
##
3
## Filename:    rtl/Makefile
4
##
5
## Project:     A Wishbone Controlled PWM (audio) controller
6
##
7
## Purpose:     To direct the Verilator build of the PWM example demo sources.
8
##              The result is C++ code (built by Verilator), that is then built
9
##      (herein) into an executable library.
10
##
11
## Targets:     The default target, all, builds the target test, which includes
12
##              the libraries necessary for Verilator testing.  It also builds
13
##      the pdmdemo target--building a C++ program which can be used to drive
14
##      this test via Verilator.
15
##
16
## Creator:     Dan Gisselquist, Ph.D.
17
##              Gisselquist Technology, LLC
18
##
19
################################################################################
20
##
21
## Copyright (C) 2017, Gisselquist Technology, LLC
22
##
23
## This program is free software (firmware): you can redistribute it and/or
24
## modify it under the terms of  the GNU General Public License as published
25
## by the Free Software Foundation, either version 3 of the License, or (at
26
## your option) any later version.
27
##
28
## This program is distributed in the hope that it will be useful, but WITHOUT
29
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
30
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31
## for more details.
32
##
33
## You should have received a copy of the GNU General Public License along
34
## with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
35
## target there if the PDF file isn't present.)  If not, see
36
##  for a copy.
37
##
38
## License:     GPL, v3, as defined and found on www.gnu.org,
39
##              http://www.gnu.org/licenses/gpl.html
40
##
41
################################################################################
42
##
43
##
44
all:    test pdmdemo
45
FBDIR := .
46
VDIRFB:= $(FBDIR)/obj_dir
47
 
48
.PHONY: test
49
test: $(VDIRFB)/Vtoplevel__ALL.a
50
VOBJ := obj_dir
51
SUBMAKE := $(MAKE) --no-print-directory --directory=$(VOBJ) -f
52
ifeq ($(VERILATOR_ROOT),)
53
VERILATOR := verilator
54
VERILATOR_ROOT ?= $(shell bash -c '$(VERILATOR) -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
55
else
56
VERILATOR := $(VERILATOR_ROOT)/bin/verilator
57
endif
58
export $(VERILATOR)
59
VROOT := $(VERILATOR_ROOT)
60
VINCD := $(VROOT)/include
61
VINC  := -I$(VINCD) -I$(VINCD)/vlstd -I$(VDIRFB)
62
VFLAGS := -Wall -MMD --trace -y ../rtl -cc
63
 
64
$(VDIRFB)/Vtoplevel__ALL.a: $(VDIRFB)/Vcordic.h $(VDIRFB)/Vcordic.cpp
65
$(VDIRFB)/Vtoplevel__ALL.a: $(VDIRFB)/Vcordic.mk
66
$(VDIRFB)/Vtoplevel.h $(VDIRFB)/Vtoplevel.cpp $(VDIRFB)/Vtoplevel.mk: toplevel.v
67
 
68
$(VDIRFB)/V%.cpp $(VDIRFB)/V%.h $(VDIRFB)/V%.mk: $(FBDIR)/%.v
69
        $(VERILATOR) $(VFLAGS) $*.v
70
 
71
$(VDIRFB)/V%__ALL.a: $(VDIRFB)/V%.mk
72
        $(SUBMAKE) V$*.mk
73
 
74
.PHONY: clean
75
clean:
76
        rm -rf $(VDIRFB)/
77
 
78
pdmdemo: pdmdemo.cpp $(VDIRFB)/Vtoplevel__ALL.a
79
        g++ -Wall $(VINC) $(VINCD)/verilated.cpp $(VINCD)/verilated_vcd_c.cpp $^ -o pdmdemo
80
 
81
#
82
# Note Verilator's dependency created information, and include it here if we
83
# can
84
DEPS := $(wildcard $(VDIRFB)/*.d)
85
 
86
ifneq ($(DEPS),)
87
include $(DEPS)
88
endif

powered by: WebSVN 2.1.0

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