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 |
113 |
dgisselq |
$(OBJDIR)/cpuscope.o: cpuscope.cpp scopecls.h
|
59 |
5 |
dgisselq |
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
60 |
113 |
dgisselq |
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h
|
61 |
|
|
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
62 |
5 |
dgisselq |
|
63 |
|
|
.PHONY: clean
|
64 |
|
|
clean:
|
65 |
|
|
rm -rf $(OBJDIR)/ $(PROGRAMS)
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
# wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
69 |
|
|
# $(CXX) -g $^ -o $@
|
70 |
|
|
netusb: $(OBJDIR)/netusb.o $(OBJDIR)/usbi.o $(OBJDIR)/llcomms.o
|
71 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
72 |
|
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
73 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
74 |
105 |
dgisselq |
bustest: $(OBJDIR)/bustest.o $(BUSOBJS)
|
75 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
76 |
5 |
dgisselq |
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
77 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
78 |
|
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
79 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
80 |
|
|
cfgscope: $(OBJDIR)/cfgscope.o $(BUSOBJS)
|
81 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
82 |
105 |
dgisselq |
sdcardscop: $(OBJDIR)/sdcardscop.o $(BUSOBJS)
|
83 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
84 |
|
|
uartscope: $(OBJDIR)/uartscope.o $(BUSOBJS)
|
85 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
86 |
5 |
dgisselq |
ramscope: $(OBJDIR)/ramscope.o $(BUSOBJS)
|
87 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
88 |
|
|
dumpsdram: $(OBJDIR)/dumpsdram.o $(BUSOBJS)
|
89 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
90 |
105 |
dgisselq |
loadmem: $(OBJDIR)/loadmem.o $(BUSOBJS)
|
91 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
92 |
29 |
dgisselq |
ziprun: $(OBJDIR)/ziprun.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
93 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@
|
94 |
11 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
95 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
96 |
105 |
dgisselq |
ZIPSRCS := $(addprefix $(ZIPD)/,zparser.cpp zopcodes.cpp)
|
97 |
38 |
dgisselq |
ZIPOBJS := twoc.o zparser.o zopcodes.o
|
98 |
105 |
dgisselq |
# ZIPOBJS := $(addprefix $(ZIPD)/$(OBJDIR)/,$(ZIPOBJS_RAW))
|
99 |
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(ZIPSRCS) $(OBJDIR)/twoc.o
|
100 |
5 |
dgisselq |
$(CXX) $(CFLAGS) $^ $(LIBS) -lncurses -o $@
|
101 |
113 |
dgisselq |
cpuscope: $(OBJDIR)/cpuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
102 |
5 |
dgisselq |
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
103 |
|
|
|
104 |
|
|
nothing:
|
105 |
|
|
@echo
|
106 |
|
|
|
107 |
|
|
# ziprun: $(OBJDIR)/ziprun.o $(BUSOBJS)
|
108 |
|
|
# $(CXX) -g $^ -o $@
|
109 |
|
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
110 |
|
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
111 |
|
|
|
112 |
|
|
usbtst: usbtst.cpp
|
113 |
|
|
$(CXX) $(CFLAGS) usbtst.cpp $(LIBS) -o usbtst
|
114 |
|
|
txtest: txtest.cpp
|
115 |
|
|
$(CXX) $(CFLAGS) txtest.cpp $(LIBS) -o txtest
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
define build-depends
|
119 |
|
|
@echo "Building dependency file(s)"
|
120 |
|
|
@$(CXX) $(CPPFLAGS) -MM -I$(ZIPD) $(SOURCES) > $(OBJDIR)/xdepends.txt
|
121 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
122 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
123 |
|
|
endef
|
124 |
|
|
|
125 |
|
|
tags: $(SOURCES) $(HEADERS)
|
126 |
|
|
@echo "Generating tags"
|
127 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
128 |
|
|
|
129 |
|
|
.PHONY: depends
|
130 |
|
|
depends: tags
|
131 |
|
|
$(build-depends)
|
132 |
|
|
|
133 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
134 |
|
|
$(build-depends)
|
135 |
|
|
|
136 |
|
|
$(OBJDIR)/:
|
137 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
138 |
|
|
|
139 |
|
|
# obj-pc/usbi.o: usbi.cpp
|
140 |
|
|
# $(CXX) $(LIBUSBINC) -I../../fpgalib/sw -c usbi.cpp -o $@
|
141 |
|
|
|
142 |
|
|
-include $(OBJDIR)/depends.txt
|