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 |
|
|
## Copyright (C) 2015, 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 |
|
|
## 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 |
17 |
dgisselq |
dumpsdram ziprun ramscope zipstate zipdbg cfgscope
|
37 |
5 |
dgisselq |
all: $(PROGRAMS)
|
38 |
|
|
CXX := g++
|
39 |
|
|
LIBUSBINC := -I/usr/include/libusb-1.0/
|
40 |
|
|
LIBUSBDIR := -L/usr/lib/x86_64-linux-gnu
|
41 |
|
|
OBJDIR := obj-pc
|
42 |
|
|
ZIPD := /home/dan/work/rnd/zipcpu/trunk/sw/zasm
|
43 |
|
|
BUSSRCS := ttybus.cpp llcomms.cpp regdefs.cpp usbi.cpp
|
44 |
29 |
dgisselq |
SOURCES := ziprun.cpp zipdbg.cpp dumpsdram.cpp wbregs.cpp netusb.cpp \
|
45 |
|
|
flashdrvr.cpp $(BUSSRCS)
|
46 |
|
|
HEADERS := llcomms.h ttybus.h devbus.h regdefs.h usbi.h flashdrvr.h
|
47 |
5 |
dgisselq |
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
48 |
|
|
BUSOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
49 |
|
|
CFLAGS := -g -Wall $(LIBUSBINC) -I. -I../../fpgalib/sw
|
50 |
|
|
LIBS := -lusb-1.0
|
51 |
|
|
|
52 |
|
|
all: $(PROGRAMS)
|
53 |
|
|
|
54 |
|
|
%.o: $(OBJDIR)/ $(OBJDIR)/%.o
|
55 |
|
|
$(OBJDIR)/%.o: %.cpp
|
56 |
|
|
$(CXX) $(CFLAGS) -c $< -o $@
|
57 |
|
|
$(OBJDIR)/zipdbg.o: zipdbg.cpp
|
58 |
|
|
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
59 |
|
|
$(OBJDIR)/cpuscope.o: cpuscope.cpp
|
60 |
|
|
$(CXX) $(CFLAGS) -I$(ZIPD) -c $< -o $@
|
61 |
|
|
|
62 |
|
|
.PHONY: clean
|
63 |
|
|
clean:
|
64 |
|
|
rm -rf $(OBJDIR)/ $(PROGRAMS)
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
# wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
68 |
|
|
# $(CXX) -g $^ -o $@
|
69 |
|
|
netusb: $(OBJDIR)/netusb.o $(OBJDIR)/usbi.o $(OBJDIR)/llcomms.o
|
70 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
71 |
|
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
72 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
73 |
|
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
74 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
75 |
|
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
76 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
77 |
|
|
cfgscope: $(OBJDIR)/cfgscope.o $(BUSOBJS)
|
78 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
79 |
|
|
ramscope: $(OBJDIR)/ramscope.o $(BUSOBJS)
|
80 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
81 |
|
|
dumpsdram: $(OBJDIR)/dumpsdram.o $(BUSOBJS)
|
82 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
83 |
29 |
dgisselq |
ziprun: $(OBJDIR)/ziprun.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
84 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@
|
85 |
11 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
86 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
87 |
38 |
dgisselq |
ZIPSRCS := $(addprefix $(ZIPD)/,twoc.cpp zparser.cpp zopcodes.cpp)
|
88 |
|
|
ZIPOBJS := twoc.o zparser.o zopcodes.o
|
89 |
5 |
dgisselq |
ZIPOBJS := $(addprefix $(ZIPD)/$(OBJDIR)/,$(ZIPOBJS_RAW))
|
90 |
38 |
dgisselq |
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(ZIPSRCS)
|
91 |
5 |
dgisselq |
$(CXX) $(CFLAGS) $^ $(LIBS) -lncurses -o $@
|
92 |
|
|
cpuscope: $(OBJDIR)/cpuscope.o $(BUSOBJS) $(ZIPOBJS)
|
93 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
94 |
|
|
|
95 |
|
|
nothing:
|
96 |
|
|
@echo
|
97 |
|
|
|
98 |
|
|
# ziprun: $(OBJDIR)/ziprun.o $(BUSOBJS)
|
99 |
|
|
# $(CXX) -g $^ -o $@
|
100 |
|
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
101 |
|
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
102 |
|
|
|
103 |
|
|
usbtst: usbtst.cpp
|
104 |
|
|
$(CXX) $(CFLAGS) usbtst.cpp $(LIBS) -o usbtst
|
105 |
|
|
txtest: txtest.cpp
|
106 |
|
|
$(CXX) $(CFLAGS) txtest.cpp $(LIBS) -o txtest
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
define build-depends
|
110 |
|
|
@echo "Building dependency file(s)"
|
111 |
|
|
@$(CXX) $(CPPFLAGS) -MM -I$(ZIPD) $(SOURCES) > $(OBJDIR)/xdepends.txt
|
112 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
113 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
114 |
|
|
endef
|
115 |
|
|
|
116 |
|
|
tags: $(SOURCES) $(HEADERS)
|
117 |
|
|
@echo "Generating tags"
|
118 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
119 |
|
|
|
120 |
|
|
.PHONY: depends
|
121 |
|
|
depends: tags
|
122 |
|
|
$(build-depends)
|
123 |
|
|
|
124 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
125 |
|
|
$(build-depends)
|
126 |
|
|
|
127 |
|
|
$(OBJDIR)/:
|
128 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
129 |
|
|
|
130 |
|
|
# obj-pc/usbi.o: usbi.cpp
|
131 |
|
|
# $(CXX) $(LIBUSBINC) -I../../fpgalib/sw -c usbi.cpp -o $@
|
132 |
|
|
|
133 |
|
|
-include $(OBJDIR)/depends.txt
|