1 |
5 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile
|
4 |
|
|
##
|
5 |
|
|
## Project: XuLA2 board
|
6 |
|
|
##
|
7 |
|
|
## Purpose:
|
8 |
|
|
##
|
9 |
|
|
##
|
10 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
11 |
|
|
## Gisselquist Technology, LLC
|
12 |
|
|
##
|
13 |
|
|
################################################################################
|
14 |
|
|
##
|
15 |
105 |
dgisselq |
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
16 |
5 |
dgisselq |
##
|
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 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
28 |
|
|
## http:##www.gnu.org/licenses/gpl.html
|
29 |
|
|
##
|
30 |
|
|
##
|
31 |
|
|
################################################################################
|
32 |
|
|
##
|
33 |
|
|
##
|
34 |
|
|
.PHONY: all
|
35 |
|
|
PROGRAMS := $(OBJDIR) usbtst wbregs netusb wbsettime dumpflash \
|
36 |
105 |
dgisselq |
dumpsdram ziprun ramscope zipstate zipdbg cfgscope loadmem \
|
37 |
|
|
sdcardscop uartscope
|
38 |
5 |
dgisselq |
all: $(PROGRAMS)
|
39 |
|
|
CXX := g++
|
40 |
|
|
LIBUSBINC := -I/usr/include/libusb-1.0/
|
41 |
|
|
LIBUSBDIR := -L/usr/lib/x86_64-linux-gnu
|
42 |
|
|
OBJDIR := obj-pc
|
43 |
|
|
ZIPD := /home/dan/work/rnd/zipcpu/trunk/sw/zasm
|
44 |
|
|
BUSSRCS := ttybus.cpp llcomms.cpp regdefs.cpp usbi.cpp
|
45 |
29 |
dgisselq |
SOURCES := ziprun.cpp zipdbg.cpp dumpsdram.cpp wbregs.cpp netusb.cpp \
|
46 |
105 |
dgisselq |
flashdrvr.cpp loadmem.cpp $(BUSSRCS)
|
47 |
29 |
dgisselq |
HEADERS := llcomms.h ttybus.h devbus.h regdefs.h usbi.h flashdrvr.h
|
48 |
5 |
dgisselq |
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
49 |
|
|
BUSOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
50 |
105 |
dgisselq |
CFLAGS := -g -Wall $(LIBUSBINC) -I.
|
51 |
5 |
dgisselq |
LIBS := -lusb-1.0
|
52 |
|
|
|
53 |
|
|
%.o: $(OBJDIR)/ $(OBJDIR)/%.o
|
54 |
|
|
$(OBJDIR)/%.o: %.cpp
|
55 |
|
|
$(CXX) $(CFLAGS) -c $< -o $@
|
56 |
|
|
$(OBJDIR)/zipdbg.o: zipdbg.cpp
|
57 |
|
|
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
58 |
|
|
$(OBJDIR)/cpuscope.o: cpuscope.cpp
|
59 |
|
|
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
60 |
|
|
|
61 |
|
|
.PHONY: clean
|
62 |
|
|
clean:
|
63 |
|
|
rm -rf $(OBJDIR)/ $(PROGRAMS)
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
# wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
67 |
|
|
# $(CXX) -g $^ -o $@
|
68 |
|
|
netusb: $(OBJDIR)/netusb.o $(OBJDIR)/usbi.o $(OBJDIR)/llcomms.o
|
69 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
70 |
|
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
71 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
72 |
105 |
dgisselq |
bustest: $(OBJDIR)/bustest.o $(BUSOBJS)
|
73 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
74 |
5 |
dgisselq |
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
75 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
76 |
|
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
77 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
78 |
|
|
cfgscope: $(OBJDIR)/cfgscope.o $(BUSOBJS)
|
79 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
80 |
105 |
dgisselq |
sdcardscop: $(OBJDIR)/sdcardscop.o $(BUSOBJS)
|
81 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
82 |
|
|
uartscope: $(OBJDIR)/uartscope.o $(BUSOBJS)
|
83 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
84 |
5 |
dgisselq |
ramscope: $(OBJDIR)/ramscope.o $(BUSOBJS)
|
85 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
86 |
|
|
dumpsdram: $(OBJDIR)/dumpsdram.o $(BUSOBJS)
|
87 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
88 |
105 |
dgisselq |
loadmem: $(OBJDIR)/loadmem.o $(BUSOBJS)
|
89 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
90 |
29 |
dgisselq |
ziprun: $(OBJDIR)/ziprun.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
91 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@
|
92 |
11 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
93 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
94 |
105 |
dgisselq |
ZIPSRCS := $(addprefix $(ZIPD)/,zparser.cpp zopcodes.cpp)
|
95 |
38 |
dgisselq |
ZIPOBJS := twoc.o zparser.o zopcodes.o
|
96 |
105 |
dgisselq |
# ZIPOBJS := $(addprefix $(ZIPD)/$(OBJDIR)/,$(ZIPOBJS_RAW))
|
97 |
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(ZIPSRCS) $(OBJDIR)/twoc.o
|
98 |
5 |
dgisselq |
$(CXX) $(CFLAGS) $^ $(LIBS) -lncurses -o $@
|
99 |
|
|
cpuscope: $(OBJDIR)/cpuscope.o $(BUSOBJS) $(ZIPOBJS)
|
100 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
101 |
|
|
|
102 |
|
|
nothing:
|
103 |
|
|
@echo
|
104 |
|
|
|
105 |
|
|
# ziprun: $(OBJDIR)/ziprun.o $(BUSOBJS)
|
106 |
|
|
# $(CXX) -g $^ -o $@
|
107 |
|
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
108 |
|
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
109 |
|
|
|
110 |
|
|
usbtst: usbtst.cpp
|
111 |
|
|
$(CXX) $(CFLAGS) usbtst.cpp $(LIBS) -o usbtst
|
112 |
|
|
txtest: txtest.cpp
|
113 |
|
|
$(CXX) $(CFLAGS) txtest.cpp $(LIBS) -o txtest
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
define build-depends
|
117 |
|
|
@echo "Building dependency file(s)"
|
118 |
|
|
@$(CXX) $(CPPFLAGS) -MM -I$(ZIPD) $(SOURCES) > $(OBJDIR)/xdepends.txt
|
119 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
120 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
121 |
|
|
endef
|
122 |
|
|
|
123 |
|
|
tags: $(SOURCES) $(HEADERS)
|
124 |
|
|
@echo "Generating tags"
|
125 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
126 |
|
|
|
127 |
|
|
.PHONY: depends
|
128 |
|
|
depends: tags
|
129 |
|
|
$(build-depends)
|
130 |
|
|
|
131 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
132 |
|
|
$(build-depends)
|
133 |
|
|
|
134 |
|
|
$(OBJDIR)/:
|
135 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
136 |
|
|
|
137 |
|
|
# obj-pc/usbi.o: usbi.cpp
|
138 |
|
|
# $(CXX) $(LIBUSBINC) -I../../fpgalib/sw -c usbi.cpp -o $@
|
139 |
|
|
|
140 |
|
|
-include $(OBJDIR)/depends.txt
|