################################################################################
|
################################################################################
|
##
|
##
|
## Filename: Makefile
|
## Filename: Makefile
|
##
|
##
|
## Project: OpenArty, an entirely open SoC based upon the Arty platform
|
## Project: OpenArty, an entirely open SoC based upon the Arty platform
|
##
|
##
|
## Purpose:
|
## Purpose:
|
## Targets:
|
## Targets:
|
##
|
##
|
## Creator: Dan Gisselquist, Ph.D.
|
## Creator: Dan Gisselquist, Ph.D.
|
## Gisselquist Technology, LLC
|
## Gisselquist Technology, LLC
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
##
|
##
|
## This program is free software (firmware): you can redistribute it and/or
|
## This program is free software (firmware): you can redistribute it and/or
|
## modify it under the terms of the GNU General Public License as published
|
## modify it under the terms of the GNU General Public License as published
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## your option) any later version.
|
## your option) any later version.
|
##
|
##
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## for more details.
|
## for more details.
|
##
|
##
|
## You should have received a copy of the GNU General Public License along
|
## You should have received a copy of the GNU General Public License along
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
## target there if the PDF file isn't present.) If not, see
|
## target there if the PDF file isn't present.) If not, see
|
## for a copy.
|
## for a copy.
|
##
|
##
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## http://www.gnu.org/licenses/gpl.html
|
## http://www.gnu.org/licenses/gpl.html
|
##
|
##
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
.PHONY: all
|
.PHONY: all
|
PROGRAMS := wbregs netuart wbsettime dumpflash # wbprogram
|
PROGRAMS := wbregs netuart wbsettime dumpflash wbprogram
|
all: $(PROGRAMS)
|
all: $(PROGRAMS)
|
CXX := g++
|
CXX := g++
|
OBJDIR := obj-pc
|
OBJDIR := obj-pc
|
# ZIPD := /home/dan/work/rnd/zipcpu/trunk/sw/zasm
|
|
BUSOBJS := $(OBJDIR)/ttybus.o $(OBJDIR)/llcomms.o $(OBJDIR)/regdefs.o
|
BUSOBJS := $(OBJDIR)/ttybus.o $(OBJDIR)/llcomms.o $(OBJDIR)/regdefs.o
|
# BUSOBJS := $(OBJDIR)/portbus.o $(OBJDIR)/llcomms.o $(OBJDIR)/regdefs.o
|
|
SOURCES := wbregs.cpp wbprogram.cpp netuart.cpp wbsettime.cpp \
|
SOURCES := wbregs.cpp wbprogram.cpp netuart.cpp wbsettime.cpp \
|
ttybus.cpp llcomms.cpp
|
ttybus.cpp llcomms.cpp dumpflash.cpp eqspiscope.cpp flashdrvr.cpp \
|
# ziprun.cpp
|
portbus.cpp regdefs.cpp scopecls.cpp sdramscope.cpp ttybus.cpp \
|
# dumpmem.cpp nmea.cpp display.cpp
|
cfgscope.cpp
|
|
# ziprun.cpp zipload.cpp
|
HEADERS := llcomms.h ttybus.h devbus.h
|
HEADERS := llcomms.h ttybus.h devbus.h
|
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
|
|
|
%.o: $(OBJDIR)/%.o
|
%.o: $(OBJDIR)/%.o
|
$(OBJDIR)/%.o: %.cpp
|
$(OBJDIR)/%.o: %.cpp
|
$(CXX) -g -c $< -o $@
|
$(CXX) -g -c $< -o $@
|
|
|
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
$(CXX) -g -c -DHIGH_SPEED $< -o $@
|
$(CXX) -g -c -DHIGH_SPEED $< -o $@
|
|
|
.PHONY: clean
|
.PHONY: clean
|
clean:
|
clean:
|
rm -rf $(OBJDIR)/*.o $(PROGRAMS)
|
rm -rf $(OBJDIR)/*.o $(PROGRAMS)
|
|
|
# dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h
|
# $(CXX) -g $^ -o $@
|
$(OBJDIR)/eqspiscope.o: eqspiscope.cpp scopecls.h
|
# wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
$(OBJDIR)/dumpflash.o: dumpflash.cpp regdefs.h
|
# $(CXX) -g $^ -o $@
|
|
netuart: $(OBJDIR)/netuart.o
|
netuart: $(OBJDIR)/netuart.o
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
eqspiscope: $(OBJDIR)/eqspiscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
eqspiscope: $(OBJDIR)/eqspiscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
sdramscope: $(OBJDIR)/sdramscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
sdramscope: $(OBJDIR)/sdramscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
|
cfgscope: $(OBJDIR)/cfgscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
|
$(CXX) -g $^ -o $@
|
|
wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
|
$(CXX) -g $^ -o $@
|
# ziprun: $(OBJDIR)/ziprun.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
# ziprun: $(OBJDIR)/ziprun.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
# $(CXX) -g $^ -lelf -o $@
|
# $(CXX) -g $^ -lelf -o $@
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
# zipdbg: zipdbg.cpp $(ZIPD)/zparser.cpp $(ZIPD)/zopcodes.cpp $(ZIPD)/twoc.cpp $(BUSOBJS)
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
# $(CXX) -g -I../bench/cpp -I $(ZIPD)/ $^ -lncurses -o $@
|
# zipstate: zipstate.cpp $(BUSOBJS)
|
# zipstate: zipstate.cpp $(BUSOBJS)
|
# $(CXX) -g $^ -o $@
|
# $(CXX) -g $^ -o $@
|
|
|
define build-depends
|
define build-depends
|
@echo "Building dependency file(s)"
|
@echo "Building dependency file(s)"
|
@$(CXX) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
@$(CXX) $(CPPFLAGS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
|
@rm $(OBJDIR)/xdepends.txt
|
@rm $(OBJDIR)/xdepends.txt
|
endef
|
endef
|
|
|
tags: $(SOURCES) $(HEADERS)
|
tags: $(SOURCES) $(HEADERS)
|
@echo "Generating tags"
|
@echo "Generating tags"
|
@ctags $(SOURCES) $(HEADERS)
|
@ctags $(SOURCES) $(HEADERS)
|
|
|
.PHONY: depends
|
.PHONY: depends
|
depends: tags
|
depends: tags
|
$(build-depends)
|
$(build-depends)
|
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
$(build-depends)
|
$(build-depends)
|
|
|
$(OBJDIR)/:
|
$(OBJDIR)/:
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
|
|
|
-include $(OBJDIR)/depends.txt
|
-include $(OBJDIR)/depends.txt
|
|
|