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 |
11 |
dgisselq |
dumpsdram ziprun ramscope zipstate zipdbg
|
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 |
|
|
SOURCES := ziprun.cpp zipdbg.cpp dumpsdram.cpp wbregs.cpp netusb.cpp $(BUSSRCS)
|
45 |
|
|
HEADERS := llcomms.h ttybus.h devbus.h regdefs.h usbi.h
|
46 |
|
|
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
47 |
|
|
BUSOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
48 |
|
|
CFLAGS := -g -Wall $(LIBUSBINC) -I. -I../../fpgalib/sw
|
49 |
|
|
LIBS := -lusb-1.0
|
50 |
|
|
|
51 |
|
|
all: $(PROGRAMS)
|
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 |
|
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
73 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
74 |
|
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
75 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
76 |
|
|
cfgscope: $(OBJDIR)/cfgscope.o $(BUSOBJS)
|
77 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
78 |
|
|
ramscope: $(OBJDIR)/ramscope.o $(BUSOBJS)
|
79 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
80 |
|
|
dumpsdram: $(OBJDIR)/dumpsdram.o $(BUSOBJS)
|
81 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
82 |
|
|
ziprun: $(OBJDIR)/ziprun.o $(BUSOBJS)
|
83 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
84 |
11 |
dgisselq |
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
85 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
86 |
5 |
dgisselq |
ZIPOBJS_RAW := twoc.o zparser.o zopcodes.o
|
87 |
|
|
ZIPOBJS := $(addprefix $(ZIPD)/$(OBJDIR)/,$(ZIPOBJS_RAW))
|
88 |
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(ZIPOBJS)
|
89 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -lncurses -o $@
|
90 |
|
|
cpuscope: $(OBJDIR)/cpuscope.o $(BUSOBJS) $(ZIPOBJS)
|
91 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
92 |
|
|
|
93 |
|
|
nothing:
|
94 |
|
|
@echo
|
95 |
|
|
|
96 |
|
|
# ziprun: $(OBJDIR)/ziprun.o $(BUSOBJS)
|
97 |
|
|
# $(CXX) -g $^ -o $@
|
98 |
|
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
99 |
|
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
100 |
|
|
|
101 |
|
|
usbtst: usbtst.cpp
|
102 |
|
|
$(CXX) $(CFLAGS) usbtst.cpp $(LIBS) -o usbtst
|
103 |
|
|
txtest: txtest.cpp
|
104 |
|
|
$(CXX) $(CFLAGS) txtest.cpp $(LIBS) -o txtest
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
define build-depends
|
108 |
|
|
@echo "Building dependency file(s)"
|
109 |
|
|
@$(CXX) $(CPPFLAGS) -MM -I$(ZIPD) $(SOURCES) > $(OBJDIR)/xdepends.txt
|
110 |
|
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
111 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
112 |
|
|
endef
|
113 |
|
|
|
114 |
|
|
tags: $(SOURCES) $(HEADERS)
|
115 |
|
|
@echo "Generating tags"
|
116 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
117 |
|
|
|
118 |
|
|
.PHONY: depends
|
119 |
|
|
depends: tags
|
120 |
|
|
$(build-depends)
|
121 |
|
|
|
122 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
123 |
|
|
$(build-depends)
|
124 |
|
|
|
125 |
|
|
$(OBJDIR)/:
|
126 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
127 |
|
|
|
128 |
|
|
# obj-pc/usbi.o: usbi.cpp
|
129 |
|
|
# $(CXX) $(LIBUSBINC) -I../../fpgalib/sw -c usbi.cpp -o $@
|
130 |
|
|
|
131 |
|
|
-include $(OBJDIR)/depends.txt
|