Line 35... |
Line 35... |
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
.PHONY: all
|
.PHONY: all
|
PROGRAMS := wbregs netuart wbsettime dumpflash wbprogram netsetup manping zipload zipstate zipdbg
|
PROGRAMS := wbregs netuart wbsettime wbprogram netsetup manping \
|
|
zipload zipstate zipdbg divutb
|
SCOPES := eqspiscope etxscope erxscope cpuscope
|
SCOPES := eqspiscope etxscope erxscope cpuscope
|
all: $(PROGRAMS) $(SCOPES) gps
|
all: $(PROGRAMS) $(SCOPES) gps
|
CXX := g++
|
CXX := g++
|
OBJDIR := obj-pc
|
OBJDIR := obj-pc
|
BUSOBJS := $(OBJDIR)/ttybus.o $(OBJDIR)/llcomms.o $(OBJDIR)/regdefs.o
|
BUSSRCS := ttybus.cpp llcomms.cpp regdefs.cpp byteswap.cpp
|
SOURCES := wbregs.cpp wbprogram.cpp netuart.cpp wbsettime.cpp \
|
SOURCES := wbregs.cpp wbprogram.cpp netuart.cpp wbsettime.cpp \
|
ttybus.cpp llcomms.cpp dumpflash.cpp eqspiscope.cpp flashdrvr.cpp \
|
dumpflash.cpp eqspiscope.cpp flashdrvr.cpp \
|
regdefs.cpp scopecls.cpp sdramscope.cpp ttybus.cpp \
|
scopecls.cpp sdramscope.cpp \
|
cfgscope.cpp zipload.cpp zipstate.cpp zipdbg.cpp \
|
zipload.cpp zipstate.cpp zipdbg.cpp \
|
erxscope.cpp etxscope.cpp netsetup.cpp cpuscope.cpp \
|
erxscope.cpp etxscope.cpp netsetup.cpp cpuscope.cpp \
|
mdioscope.cpp manping.cpp
|
mdioscope.cpp manping.cpp $(BUSSRCS)
|
# ziprun.cpp
|
# ziprun.cpp cfgscope.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)))
|
ZIPD := ../../../../../zipcpu/trunk/sw/zasm
|
BUSOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(BUSSRCS)))
|
|
CFLAGS := -g -Wall -I.
|
|
LIBS :=
|
|
SUBMAKE := $(MAKE) --no-print-directory
|
|
|
%.o: $(OBJDIR)/%.o
|
%.o: $(OBJDIR)/%.o
|
$(OBJDIR)/%.o: %.cpp
|
$(OBJDIR)/%.o: %.cpp
|
$(CXX) -g -c $< -o $@
|
$(CXX) $(CFLAGS) -c $< -o $@
|
|
$(OBJDIR)/%.o: %.c
|
|
$(CXX) $(CFLAGS) -c $< -o $@
|
|
|
.PHONY: gps
|
.PHONY: gps
|
gps: $(BUSOBJS) $(OBJDIR)/scopecls.o
|
gps: $(BUSOBJS) $(OBJDIR)/scopecls.o
|
@bash -c "if [[ -e gps/Makefile ]]; then cd gps; make --no-print-directory; fi"
|
@bash -c "if [[ -e gps/Makefile ]]; then $(SUBMAKE) --directory=gps; fi"
|
|
|
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
$(OBJDIR)/hsnetuart.o: netuart.cpp
|
$(CXX) -g -c -DHIGH_SPEED $< -o $@
|
$(CXX) $(CFLAGS) -c -DHIGH_SPEED $< -o $@
|
|
|
.PHONY: clean
|
.PHONY: clean
|
clean:
|
clean:
|
rm -rf $(OBJDIR)/*.o $(PROGRAMS)
|
rm -rf $(OBJDIR)/ $(PROGRAMS) a.out
|
|
|
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h
|
$(OBJDIR)/scopecls.o: scopecls.cpp scopecls.h $(OBJDIR)/
|
$(OBJDIR)/eqspiscope.o: eqspiscope.cpp scopecls.h
|
$(OBJDIR)/eqspiscope.o: eqspiscope.cpp scopecls.h $(OBJDIR)/
|
$(OBJDIR)/dumpflash.o: dumpflash.cpp regdefs.h
|
$(OBJDIR)/dumpflash.o: dumpflash.cpp regdefs.h $(OBJDIR)/
|
|
|
netuart: $(OBJDIR)/netuart.o
|
netuart: $(OBJDIR)/netuart.o
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ -o $@
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
hsnetuart: $(OBJDIR)/hsnetuart.o
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ -o $@
|
#
|
#
|
# Some simple programs that just depend upon the ability to talk to the FPGA,
|
# Some simple programs that just depend upon the ability to talk to the FPGA,
|
# and little more.
|
# and little more.
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
wbsettime: $(OBJDIR)/wbsettime.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ -o $@
|
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
mtest: $(OBJDIR)/mtest.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ -o $@
|
manping: $(OBJDIR)/manping.o $(BUSOBJS)
|
manping: $(OBJDIR)/manping.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ -o $@
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
|
$(CXX) -g $^ -o $@
|
|
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
zipstate: $(OBJDIR)/zipstate.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
netsetup: $(OBJDIR)/netsetup.o $(BUSOBJS)
|
netsetup: $(OBJDIR)/netsetup.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
|
wbregs: $(OBJDIR)/wbregs.o $(BUSOBJS)
|
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
dumpflash: $(OBJDIR)/dumpflash.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) $(CFLAGS) $^ $(LIBS) -o $@
|
|
divutb: $(OBJDIR)/divutb.o
|
|
$(CXX) $(CFLAGS) $^ -o $@
|
|
|
#
|
#
|
# Programs that depend upon not just the bus objects, but the flash driver
|
# Programs that depend upon not just the bus objects, but the flash driver
|
# as well.
|
# as well.
|
wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
wbprogram: $(OBJDIR)/wbprogram.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS)
|
zipload: $(OBJDIR)/zipload.o $(OBJDIR)/flashdrvr.o $(BUSOBJS) $(OBJDIR)/zipelf.o
|
$(CXX) -g $^ -lelf -o $@
|
$(CXX) -g $^ -lelf -o $@
|
|
|
|
|
## SCOPES
|
## SCOPES
|
# These depend upon the scopecls.o, the bus objects, as well as their
|
# These depend upon the scopecls.o, the bus objects, as well as their
|
Line 123... |
Line 131... |
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
wbuscope: $(OBJDIR)/wbuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
wbuscope: $(OBJDIR)/wbuscope.o $(OBJDIR)/scopecls.o $(BUSOBJS)
|
$(CXX) -g $^ -o $@
|
$(CXX) -g $^ -o $@
|
|
|
#
|
#
|
# The ZipDebugger is a bit more difficult to build, as it wants to be able
|
DBGSRCS := zopcodes.cpp twoc.cpp
|
# to disassemble opcodes given to it. Hence, it depends upon the zparser.cpp,
|
DBGOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DBGSRCS)))
|
# zopcodes.cpp, and twoc.cpp files from the ZipCPU build directory.
|
|
#
|
|
DBGRAW := zparser.cpp zopcodes.cpp twoc.cpp
|
|
DBGSRCS := $(addprefix $(ZIPD)/,$(DBGRAW))
|
|
DBGOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DBGRAW)))
|
|
$(OBJDIR)/zipdbg.o: zipdbg.cpp
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
|
$(OBJDIR)/zparser.o: $(ZIPD)/zparser.cpp
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
|
$(OBJDIR)/zopcodes.o: $(ZIPD)/zopcodes.cpp
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
|
$(OBJDIR)/twoc.o: $(ZIPD)/twoc.cpp
|
|
$(CXX) -g -I$(ZIPD) -c $< -o $@
|
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(DBGOBJS)
|
zipdbg: $(OBJDIR)/zipdbg.o $(BUSOBJS) $(DBGOBJS)
|
$(CXX) -g -I$(ZIPD) $^ -lcurses -o $@
|
$(CXX) -g $^ -lcurses -o $@
|
|
|
define build-depends
|
define build-depends
|
@echo "Building dependency file(s)"
|
@echo "Building dependency file(s)"
|
$(CXX) $(CPPFLAGS) -I$(ZIPD) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR)/; fi"
|
|
$(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)
|
Line 156... |
Line 152... |
|
|
.PHONY: depends
|
.PHONY: depends
|
depends: tags
|
depends: tags
|
$(build-depends)
|
$(build-depends)
|
|
|
$(OBJDIR)/depends.txt: $(OBJDIR)/ $(SOURCES) $(HEADERS)
|
$(OBJDIR)/depends.txt: $(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"
|
|
|