1 |
12 |
dgisselq |
################################################################################
|
2 |
|
|
##
|
3 |
|
|
## Filename: Makefile (sw/host)
|
4 |
|
|
##
|
5 |
|
|
## Project: CMod S6 System on a Chip, ZipCPU demonstration project
|
6 |
|
|
##
|
7 |
|
|
## Purpose: Supports the building of the various host (i.e. PC) software
|
8 |
|
|
## that will be used to support the Cmod S6 board. None of this
|
9 |
|
|
## software will actually run on the board, but it may be used for
|
10 |
|
|
## communicating with and configuring the board.
|
11 |
|
|
##
|
12 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
13 |
|
|
## Gisselquist Technology, LLC
|
14 |
|
|
##
|
15 |
|
|
################################################################################
|
16 |
|
|
##
|
17 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
18 |
|
|
##
|
19 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
20 |
|
|
## modify it under the terms of the GNU General Public License as published
|
21 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
22 |
|
|
## your option) any later version.
|
23 |
|
|
##
|
24 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
25 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
26 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
27 |
|
|
## for more details.
|
28 |
|
|
##
|
29 |
|
|
## You should have received a copy of the GNU General Public License along
|
30 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
31 |
|
|
## target there if the PDF file isn't present.) If not, see
|
32 |
|
|
## for a copy.
|
33 |
|
|
##
|
34 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
35 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
36 |
|
|
##
|
37 |
|
|
##
|
38 |
|
|
################################################################################
|
39 |
|
|
##
|
40 |
|
|
##
|
41 |
8 |
dgisselq |
all:
|
42 |
45 |
dgisselq |
PROGRAMS := wbregs readflash zipload dumpuart
|
43 |
8 |
dgisselq |
all: $(PROGRAMS)
|
44 |
|
|
|
45 |
|
|
CXX := g++
|
46 |
|
|
OBJDIR := obj-pc
|
47 |
11 |
dgisselq |
# BUSSRCS:= deppbus.cpp regdefs.cpp
|
48 |
45 |
dgisselq |
BUSSRCS:= deppi.cpp regdefs.cpp llcomms.cpp ttybus.cpp byteswap.cpp
|
49 |
|
|
CPUSRCS:= zipelf.cpp
|
50 |
|
|
SOURCES:= wbregs.cpp readflash.cpp zipload.cpp flashdrvr.cpp
|
51 |
|
|
ALLSRCS:= $(SOURCES) $(CPUSRCS) $(BUSSRCS)
|
52 |
8 |
dgisselq |
ADEPT := ../../../refs/digilent.adept.sdk_2.3.1
|
53 |
|
|
HEADERS:= deppbus.h devbus.h flashdrvr.h regdefs.h twoc.h
|
54 |
45 |
dgisselq |
OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(ALLSRCS)))
|
55 |
8 |
dgisselq |
BUSOBJS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
56 |
|
|
CFLAGS := -g -Wall -I$(ADEPT)/inc -I.
|
57 |
45 |
dgisselq |
LIBS := -L /usr/local/lib64/digilent/adept -ldmgr -ldepp -ldpcomm -ldftd2xx -ldabs
|
58 |
8 |
dgisselq |
|
59 |
|
|
%.o: $(OBJDIR)/ $(OBJDIR)/%.o
|
60 |
|
|
$(OBJDIR)/%.o: %.cpp
|
61 |
|
|
$(CXX) $(CFLAGS) -c $< -o $@
|
62 |
|
|
|
63 |
|
|
.PHONY: clean
|
64 |
|
|
clean:
|
65 |
|
|
rm -rf $(OBJDIR)/ $(PROGRAMS)
|
66 |
|
|
|
67 |
|
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
68 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
69 |
|
|
|
70 |
45 |
dgisselq |
scope: $(OBJDIR)/scope.o $(BUSOBJS)
|
71 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
72 |
|
|
|
73 |
11 |
dgisselq |
readflash: $(OBJDIR)/readflash.o $(BUSOBJS)
|
74 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
75 |
|
|
|
76 |
45 |
dgisselq |
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS) $(OBJDIR)/zipelf.o
|
77 |
11 |
dgisselq |
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@
|
78 |
|
|
|
79 |
19 |
dgisselq |
dumpuart: dumpuart.cpp
|
80 |
|
|
$(CXX) $(CFLAGS) $^ -o $@
|
81 |
|
|
|
82 |
8 |
dgisselq |
define build-depends
|
83 |
|
|
@echo "Building dependency file(s)"
|
84 |
45 |
dgisselq |
@$(CXX) $(CFLAGS) -MM $(ALLSRCS) > $(OBJDIR)/xdepends.txt
|
85 |
8 |
dgisselq |
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
86 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
87 |
|
|
endef
|
88 |
|
|
|
89 |
|
|
tags: $(SOURCES) $(HEADERS)
|
90 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
91 |
|
|
|
92 |
|
|
.PHONY: depends
|
93 |
|
|
depends: tags
|
94 |
|
|
$(build-depends)
|
95 |
|
|
|
96 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
97 |
|
|
$(build-depends)
|
98 |
|
|
|
99 |
|
|
$(OBJDIR)/:
|
100 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
101 |
|
|
|
102 |
|
|
-include $(OBJDIR)/depends.txt
|