1 |
4 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: OpenArty, an entirely open SoC based upon the Arty platform
|
6 |
|
|
##
|
7 |
|
|
## Purpose:
|
8 |
|
|
## Targets:
|
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 |
|
|
.PHONY: all
|
40 |
30 |
dgisselq |
PROGRAMS := wbregs netuart wbsettime dumpflash wbprogram netsetup manping zipload zipstate zipdbg
|
41 |
|
|
SCOPES := eqspiscope etxscope erxscope cpuscope
|
42 |
34 |
dgisselq |
all: $(PROGRAMS) $(SCOPES) gps
|
43 |
4 |
dgisselq |
CXX := g++
|
44 |
|
|
OBJDIR := obj-pc
|
45 |
|
|
BUSOBJS := $(OBJDIR)/ttybus.o $(OBJDIR)/llcomms.o $(OBJDIR)/regdefs.o
|
46 |
30 |
dgisselq |
SOURCES := wbregs.cpp wbprogram.cpp netuart.cpp wbsettime.cpp \
|
47 |
14 |
dgisselq |
ttybus.cpp llcomms.cpp dumpflash.cpp eqspiscope.cpp flashdrvr.cpp \
|
48 |
30 |
dgisselq |
regdefs.cpp scopecls.cpp sdramscope.cpp ttybus.cpp \
|
49 |
|
|
cfgscope.cpp zipload.cpp zipstate.cpp zipdbg.cpp \
|
50 |
|
|
erxscope.cpp etxscope.cpp netsetup.cpp cpuscope.cpp \
|
51 |
|
|
mdioscope.cpp manping.cpp
|
52 |
|
|
# ziprun.cpp
|
53 |
4 |
dgisselq |
HEADERS := llcomms.h ttybus.h devbus.h
|
54 |
|
|
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
55 |
30 |
dgisselq |
ZIPD := ../../../../../zipcpu/trunk/sw/zasm
|
56 |
4 |
dgisselq |
|
57 |
|
|
%.o: $(OBJDIR)/%.o
|
58 |
|
|
$(OBJDIR)/%.o: %.cpp
|
59 |
|
|
$(CXX) -g -c $< -o $@
|
60 |
|
|
|
61 |
34 |
dgisselq |
.PHONY: gps
|
62 |
|
|
gps: $(BUSOBJS) $(OBJDIR)/scopecls.o
|
63 |
|
|
@bash -c "if [[ -e gps/Makefile ]]; then cd gps; make --no-print-directory; fi"
|
64 |
|
|
|
65 |
4 |
dgisselq |
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
66 |
|
|
$(CXX) -g -c -DHIGH_SPEED $< -o $@
|
67 |
|
|
|
68 |
|
|
.PHONY: clean
|
69 |
|
|
clean:
|
70 |
|
|
rm -rf $(OBJDIR)/*.o $(PROGRAMS)
|
71 |
|
|
|
72 |
14 |
dgisselq |
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h
|
73 |
|
|
$(OBJDIR)/eqspiscope.o: eqspiscope.cpp scopecls.h
|
74 |
|
|
$(OBJDIR)/dumpflash.o: dumpflash.cpp regdefs.h
|
75 |
|
|
|
76 |
4 |
dgisselq |
netuart: $(OBJDIR)/netuart.o
|
77 |
|
|
$(CXX) -g $^ -o $@
|
78 |
|
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
79 |
|
|
$(CXX) -g $^ -o $@
|
80 |
34 |
dgisselq |
#
|
81 |
|
|
# Some simple programs that just depend upon the ability to talk to the FPGA,
|
82 |
|
|
# and little more.
|
83 |
4 |
dgisselq |
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
84 |
|
|
$(CXX) -g $^ -o $@
|
85 |
6 |
dgisselq |
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
86 |
|
|
$(CXX) -g $^ -o $@
|
87 |
30 |
dgisselq |
manping: $(OBJDIR)/manping.o $(BUSOBJS)
|
88 |
|
|
$(CXX) -g $^ -o $@
|
89 |
4 |
dgisselq |
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
90 |
|
|
$(CXX) -g $^ -o $@
|
91 |
30 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
92 |
|
|
$(CXX) -g $^ -o $@
|
93 |
|
|
netsetup: $(OBJDIR)/netsetup.o $(BUSOBJS)
|
94 |
|
|
$(CXX) -g $^ -o $@
|
95 |
4 |
dgisselq |
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
96 |
|
|
$(CXX) -g $^ -o $@
|
97 |
34 |
dgisselq |
|
98 |
|
|
#
|
99 |
|
|
# Programs that depend upon not just the bus objects, but the flash driver
|
100 |
|
|
# as well.
|
101 |
30 |
dgisselq |
wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
102 |
|
|
$(CXX) -g $^ -o $@
|
103 |
|
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
104 |
|
|
$(CXX) -g $^ -lelf -o $@
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
## SCOPES
|
108 |
34 |
dgisselq |
# These depend upon the scopecls.o, the bus objects, as well as their
|
109 |
|
|
# main file(s).
|
110 |
|
|
eqspiscope: $(OBJDIR)/eqspiscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
111 |
|
|
$(CXX) -g $^ -o $@
|
112 |
|
|
sdramscope: $(OBJDIR)/sdramscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
113 |
|
|
$(CXX) -g $^ -o $@
|
114 |
14 |
dgisselq |
cfgscope: $(OBJDIR)/cfgscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
115 |
|
|
$(CXX) -g $^ -o $@
|
116 |
30 |
dgisselq |
cpuscope: $(OBJDIR)/cpuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
117 |
14 |
dgisselq |
$(CXX) -g $^ -o $@
|
118 |
30 |
dgisselq |
erxscope: $(OBJDIR)/erxscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
119 |
|
|
$(CXX) -g $^ -o $@
|
120 |
|
|
etxscope: $(OBJDIR)/etxscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
121 |
|
|
$(CXX) -g $^ -o $@
|
122 |
|
|
mdioscope: $(OBJDIR)/mdioscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
123 |
|
|
$(CXX) -g $^ -o $@
|
124 |
|
|
wbuscope: $(OBJDIR)/wbuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
125 |
|
|
$(CXX) -g $^ -o $@
|
126 |
4 |
dgisselq |
|
127 |
34 |
dgisselq |
#
|
128 |
|
|
# The ZipDebugger is a bit more difficult to build, as it wants to be able
|
129 |
|
|
# to disassemble opcodes given to it. Hence, it depends upon the zparser.cpp,
|
130 |
|
|
# zopcodes.cpp, and twoc.cpp files from the ZipCPU build directory.
|
131 |
|
|
#
|
132 |
30 |
dgisselq |
DBGRAW := zparser.cpp zopcodes.cpp twoc.cpp
|
133 |
|
|
DBGSRCS := $(addprefix $(ZIPD)/,$(DBGRAW))
|
134 |
|
|
DBGOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DBGRAW)))
|
135 |
|
|
$(OBJDIR)/zipdbg.o: zipdbg.cpp
|
136 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
137 |
|
|
$(OBJDIR)/zparser.o: $(ZIPD)/zparser.cpp
|
138 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
139 |
|
|
$(OBJDIR)/zopcodes.o: $(ZIPD)/zopcodes.cpp
|
140 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
141 |
|
|
$(OBJDIR)/twoc.o: $(ZIPD)/twoc.cpp
|
142 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
143 |
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(DBGOBJS)
|
144 |
|
|
$(CXX) -g -I$(ZIPD) $^ -lcurses -o $@
|
145 |
|
|
|
146 |
4 |
dgisselq |
define build-depends
|
147 |
|
|
@echo "Building dependency file(s)"
|
148 |
30 |
dgisselq |
$(CXX) $(CPPFLAGS) -I$(ZIPD) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
149 |
4 |
dgisselq |
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
150 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
151 |
|
|
endef
|
152 |
|
|
|
153 |
|
|
tags: $(SOURCES) $(HEADERS)
|
154 |
|
|
@echo "Generating tags"
|
155 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
156 |
|
|
|
157 |
|
|
.PHONY: depends
|
158 |
|
|
depends: tags
|
159 |
|
|
$(build-depends)
|
160 |
|
|
|
161 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
162 |
|
|
$(build-depends)
|
163 |
|
|
|
164 |
|
|
$(OBJDIR)/:
|
165 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
|
166 |
|
|
|
167 |
|
|
-include $(OBJDIR)/depends.txt
|