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 |
19 |
dgisselq |
PROGRAMS := wbregs readflash zipload buildsamples dumpuart
|
43 |
8 |
dgisselq |
all: $(PROGRAMS)
|
44 |
|
|
|
45 |
|
|
CXX := g++
|
46 |
|
|
OBJDIR := obj-pc
|
47 |
11 |
dgisselq |
# BUSSRCS:= deppbus.cpp regdefs.cpp
|
48 |
|
|
BUSSRCS:= deppi.cpp regdefs.cpp llcomms.cpp ttybus.cpp
|
49 |
|
|
SOURCES:= wbregs.cpp readflash.cpp zipload.cpp flashdrvr.cpp # flashload.cpp/ziprun.cpp
|
50 |
8 |
dgisselq |
ADEPT := ../../../refs/digilent.adept.sdk_2.3.1
|
51 |
|
|
HEADERS:= deppbus.h devbus.h flashdrvr.h regdefs.h twoc.h
|
52 |
|
|
OBJECTS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
53 |
|
|
BUSOBJS:= $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
54 |
|
|
CFLAGS := -g -Wall -I$(ADEPT)/inc -I.
|
55 |
|
|
LIBS := -L /usr/lib64/digilent/adept -ldmgr -ldepp
|
56 |
|
|
|
57 |
|
|
%.o: $(OBJDIR)/ $(OBJDIR)/%.o
|
58 |
|
|
$(OBJDIR)/%.o: %.cpp
|
59 |
|
|
$(CXX) $(CFLAGS) -c $< -o $@
|
60 |
|
|
|
61 |
|
|
.PHONY: clean
|
62 |
|
|
clean:
|
63 |
|
|
rm -rf $(OBJDIR)/ $(PROGRAMS)
|
64 |
|
|
|
65 |
|
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
66 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
67 |
|
|
|
68 |
11 |
dgisselq |
readflash: $(OBJDIR)/readflash.o $(BUSOBJS)
|
69 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
70 |
|
|
|
71 |
|
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
72 |
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -lelf -o $@
|
73 |
|
|
|
74 |
12 |
dgisselq |
buildsamples: buildsamples.cpp
|
75 |
|
|
$(CXX) $(CFLAGS) $^ -o $@
|
76 |
|
|
|
77 |
19 |
dgisselq |
dumpuart: dumpuart.cpp
|
78 |
|
|
$(CXX) $(CFLAGS) $^ -o $@
|
79 |
|
|
|
80 |
8 |
dgisselq |
define build-depends
|
81 |
|
|
@echo "Building dependency file(s)"
|
82 |
11 |
dgisselq |
@$(CXX) $(CFLAGS) -MM $(SOURCES) $(BUSSRCS) > $(OBJDIR)/xdepends.txt
|
83 |
8 |
dgisselq |
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
84 |
|
|
@rm $(OBJDIR)/xdepends.txt
|
85 |
|
|
endef
|
86 |
|
|
|
87 |
|
|
tags: $(SOURCES) $(HEADERS)
|
88 |
|
|
@ctags $(SOURCES) $(HEADERS)
|
89 |
|
|
|
90 |
|
|
.PHONY: depends
|
91 |
|
|
depends: tags
|
92 |
|
|
$(build-depends)
|
93 |
|
|
|
94 |
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
95 |
|
|
$(build-depends)
|
96 |
|
|
|
97 |
|
|
$(OBJDIR)/:
|
98 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
99 |
|
|
|
100 |
|
|
-include $(OBJDIR)/depends.txt
|