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 |
|
|
all: $(PROGRAMS) $(SCOPES)
|
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 |
|
|
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
62 |
|
|
$(CXX) -g -c -DHIGH_SPEED $< -o $@
|
63 |
|
|
|
64 |
|
|
.PHONY: clean
|
65 |
|
|
clean:
|
66 |
|
|
rm -rf $(OBJDIR)/*.o $(PROGRAMS)
|
67 |
|
|
|
68 |
14 |
dgisselq |
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h
|
69 |
|
|
$(OBJDIR)/eqspiscope.o: eqspiscope.cpp scopecls.h
|
70 |
|
|
$(OBJDIR)/dumpflash.o: dumpflash.cpp regdefs.h
|
71 |
|
|
|
72 |
4 |
dgisselq |
netuart: $(OBJDIR)/netuart.o
|
73 |
|
|
$(CXX) -g $^ -o $@
|
74 |
|
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
75 |
|
|
$(CXX) -g $^ -o $@
|
76 |
|
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
77 |
|
|
$(CXX) -g $^ -o $@
|
78 |
6 |
dgisselq |
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
79 |
|
|
$(CXX) -g $^ -o $@
|
80 |
30 |
dgisselq |
manping: $(OBJDIR)/manping.o $(BUSOBJS)
|
81 |
|
|
$(CXX) -g $^ -o $@
|
82 |
4 |
dgisselq |
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
83 |
|
|
$(CXX) -g $^ -o $@
|
84 |
30 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
85 |
|
|
$(CXX) -g $^ -o $@
|
86 |
|
|
netsetup: $(OBJDIR)/netsetup.o $(BUSOBJS)
|
87 |
|
|
$(CXX) -g $^ -o $@
|
88 |
4 |
dgisselq |
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
89 |
|
|
$(CXX) -g $^ -o $@
|
90 |
|
|
eqspiscope: $(OBJDIR)/eqspiscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
91 |
|
|
$(CXX) -g $^ -o $@
|
92 |
6 |
dgisselq |
sdramscope: $(OBJDIR)/sdramscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
93 |
|
|
$(CXX) -g $^ -o $@
|
94 |
30 |
dgisselq |
wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
95 |
|
|
$(CXX) -g $^ -o $@
|
96 |
|
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
97 |
|
|
$(CXX) -g $^ -lelf -o $@
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
## SCOPES
|
101 |
14 |
dgisselq |
cfgscope: $(OBJDIR)/cfgscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
102 |
|
|
$(CXX) -g $^ -o $@
|
103 |
30 |
dgisselq |
cpuscope: $(OBJDIR)/cpuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
104 |
14 |
dgisselq |
$(CXX) -g $^ -o $@
|
105 |
30 |
dgisselq |
erxscope: $(OBJDIR)/erxscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
106 |
|
|
$(CXX) -g $^ -o $@
|
107 |
|
|
etxscope: $(OBJDIR)/etxscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
108 |
|
|
$(CXX) -g $^ -o $@
|
109 |
|
|
mdioscope: $(OBJDIR)/mdioscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
110 |
|
|
$(CXX) -g $^ -o $@
|
111 |
|
|
wbuscope: $(OBJDIR)/wbuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
112 |
|
|
$(CXX) -g $^ -o $@
|
113 |
4 |
dgisselq |
|
114 |
30 |
dgisselq |
DBGRAW := zparser.cpp zopcodes.cpp twoc.cpp
|
115 |
|
|
DBGSRCS := $(addprefix $(ZIPD)/,$(DBGRAW))
|
116 |
|
|
DBGOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DBGRAW)))
|
117 |
|
|
$(OBJDIR)/zipdbg.o: zipdbg.cpp
|
118 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
119 |
|
|
$(OBJDIR)/zparser.o: $(ZIPD)/zparser.cpp
|
120 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
121 |
|
|
$(OBJDIR)/zopcodes.o: $(ZIPD)/zopcodes.cpp
|
122 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
123 |
|
|
$(OBJDIR)/twoc.o: $(ZIPD)/twoc.cpp
|
124 |
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
125 |
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(DBGOBJS)
|
126 |
|
|
$(CXX) -g -I$(ZIPD) $^ -lcurses -o $@
|
127 |
|
|
|
128 |
4 |
dgisselq |
define build-depends
|
129 |
|
|
@echo "Building dependency file(s)"
|
130 |
30 |
dgisselq |
$(CXX) $(CPPFLAGS) -I$(ZIPD) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
131 |
4 |
dgisselq |
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
132 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
133 |
|
|
endef
|
134 |
|
|
|
135 |
|
|
tags: $(SOURCES) $(HEADERS)
|
136 |
|
|
@echo "Generating tags"
|
137 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
138 |
|
|
|
139 |
|
|
.PHONY: depends
|
140 |
|
|
depends: tags
|
141 |
|
|
$(build-depends)
|
142 |
|
|
|
143 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
144 |
|
|
$(build-depends)
|
145 |
|
|
|
146 |
|
|
$(OBJDIR)/:
|
147 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
|
148 |
|
|
|
149 |
|
|
-include $(OBJDIR)/depends.txt
|