| 1 |
39 |
julius |
#
|
| 2 |
|
|
#****************************************************************************#
|
| 3 |
|
|
# #
|
| 4 |
|
|
# H E A D E R I N F O R M A T I O N #
|
| 5 |
|
|
# #
|
| 6 |
|
|
#****************************************************************************#
|
| 7 |
|
|
|
| 8 |
|
|
# Project Name : OpenRISC Debug Proxy
|
| 9 |
|
|
# File Name : Makefile
|
| 10 |
|
|
# Prepared By : jb
|
| 11 |
|
|
# Project Start : 2008-10-01
|
| 12 |
|
|
|
| 13 |
|
|
#$$COPYRIGHT NOTICE#
|
| 14 |
|
|
#****************************************************************************#
|
| 15 |
|
|
# #
|
| 16 |
|
|
# C O P Y R I G H T N O T I C E #
|
| 17 |
|
|
# #
|
| 18 |
|
|
#****************************************************************************#
|
| 19 |
|
|
|
| 20 |
|
|
# This library is free software; you can redistribute it and/or
|
| 21 |
|
|
# modify it under the terms of the GNU Lesser General Public
|
| 22 |
|
|
# License as published by the Free Software Foundation;
|
| 23 |
|
|
# version 2.1 of the License, a copy of which is available from
|
| 24 |
|
|
# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
|
| 25 |
|
|
#
|
| 26 |
|
|
# This library is distributed in the hope that it will be useful,
|
| 27 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 28 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 29 |
|
|
# Lesser General Public License for more details.
|
| 30 |
|
|
#
|
| 31 |
|
|
# You should have received a copy of the GNU Lesser General Public
|
| 32 |
|
|
# License along with this library; if not, write to the Free Software
|
| 33 |
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
| 34 |
|
|
# USA.
|
| 35 |
|
|
#
|
| 36 |
|
|
|
| 37 |
|
|
#$$CHANGE HISTORY#
|
| 38 |
|
|
#****************************************************************************#
|
| 39 |
|
|
# #
|
| 40 |
|
|
# C H A N G E H I S T O R Y #
|
| 41 |
|
|
# #
|
| 42 |
|
|
#****************************************************************************#
|
| 43 |
|
|
|
| 44 |
|
|
# Date Version Description
|
| 45 |
|
|
#------------------------------------------------------------------------
|
| 46 |
|
|
# 090301 0.1.0 Makefile for OpenRISC debug proxy. jb
|
| 47 |
|
|
# 2 Apr 09 0.1.1 Jeremy Bennett. Added static target
|
| 48 |
|
|
# 1 May 09 0.1.3 Added specific make target for VPI jb
|
| 49 |
|
|
|
| 50 |
|
|
#DBGCPPFLAGS=-DDEBUG_GDB=1
|
| 51 |
|
|
#DBGCPPFLAGS=-DDEBUG_USB_DRVR_FUNCS=1
|
| 52 |
|
|
#DBGCPPFLAGS=-DDEBUG_USB_DRVR_FUNCS=1 -DDEBUG_GDB=1 -DDEBUG_CMDS=1
|
| 53 |
|
|
|
| 54 |
|
|
# Common Flags
|
| 55 |
|
|
COMMON_CPPFLAGS = -I./includes
|
| 56 |
|
|
COMMON_CXXFLAGS = -O2 -g
|
| 57 |
|
|
COMMON_LDFLAGS =
|
| 58 |
|
|
|
| 59 |
|
|
# Flags for static library
|
| 60 |
|
|
STATIC_LIBDIR = lib
|
| 61 |
|
|
STATIC_LIB = libftd2xx.a.0.4.16
|
| 62 |
|
|
STATIC_LDFLAGS = $(COMMON_LDFLAGS) $(STATIC_LIBDIR)/$(STATIC_LIB) \
|
| 63 |
|
|
-lpthread -ldl
|
| 64 |
|
|
# Defines to enable certain endpoint handling functions to be used
|
| 65 |
|
|
USB_FLAGS = -D USB_ENDPOINT_ENABLED=1
|
| 66 |
|
|
VPI_FLAGS = -D VPI_ENDPOINT_ENABLED=1
|
| 67 |
|
|
|
| 68 |
|
|
#Determine whether we're on Cygwin
|
| 69 |
|
|
ifndef OSTYPE
|
| 70 |
|
|
# Basically we're interested in finding out if we're
|
| 71 |
|
|
# in a cygwin environement, so let's find out this way
|
| 72 |
|
|
# Note: Typically in a bash environment, $OSTYPE is set
|
| 73 |
|
|
# but sometimes make can't figure it out. So we'll do it
|
| 74 |
|
|
# this way:
|
| 75 |
|
|
ifeq (CYGWIN, $(findstring CYGWIN, $(shell uname)))
|
| 76 |
|
|
OSTYPE=cygwin
|
| 77 |
|
|
endif
|
| 78 |
|
|
endif
|
| 79 |
|
|
|
| 80 |
|
|
ifeq ($(OSTYPE),cygwin)
|
| 81 |
|
|
OR_DEBUG_PROXY_SRC = src/or_debug_proxy.c \
|
| 82 |
|
|
src/gdb.c \
|
| 83 |
|
|
src/usb_functions.c \
|
| 84 |
|
|
src/win_usb_driver_calls.c \
|
| 85 |
|
|
src/vpi_functions.c
|
| 86 |
|
|
CXX = gcc
|
| 87 |
|
|
CPPFLAGS = $(COMMON_CPPFLAGS) -I./obj -DCYGWIN_COMPILE=1 $(DBGCPPFLAGS)
|
| 88 |
|
|
CXXFLAGS = $(COMMON_CXXFLAGS)
|
| 89 |
|
|
DYNAMIC_LDFLAGS = $(COMMON_LDFLAGS)
|
| 90 |
|
|
EXE = .exe
|
| 91 |
|
|
else
|
| 92 |
|
|
OR_DEBUG_PROXY_SRC = src/or_debug_proxy.c \
|
| 93 |
|
|
src/gdb.c
|
| 94 |
|
|
OR_DEBUG_PROXY_USB_SRC = src/FT2232c.cpp \
|
| 95 |
|
|
src/FT2232cMpsseJtag.cpp \
|
| 96 |
|
|
src/usb_functions.c \
|
| 97 |
|
|
src/linux_usb_driver_calls.c
|
| 98 |
|
|
OR_DEBUG_PROXY_VPI_SRC = src/vpi_functions.c
|
| 99 |
|
|
CXX = g++
|
| 100 |
|
|
CPPFLAGS = $(COMMON_CPPFLAGS) $(DBGCPPFLAGS)
|
| 101 |
|
|
CXXFLAGS = $(COMMON_CXXFLAGS)
|
| 102 |
|
|
DYNAMIC_LDFLAGS = $(COMMON_LDFLAGS) -lftd2xx
|
| 103 |
|
|
EXE =
|
| 104 |
|
|
endif
|
| 105 |
|
|
|
| 106 |
|
|
APP = or_debug_proxy
|
| 107 |
|
|
APP_DYNAMIC = $(APP)$(EXE)
|
| 108 |
|
|
APP_STATIC = $(APP)_static$(EXE)
|
| 109 |
|
|
APP_VPI = $(APP)_vpi$(EXE)
|
| 110 |
|
|
|
| 111 |
|
|
# -----------------------------------------------------------------------------
|
| 112 |
|
|
# Build dynamic and static targets from scratch
|
| 113 |
|
|
.PHONY: all
|
| 114 |
|
|
all: clean $(APP_DYNAMIC)
|
| 115 |
|
|
|
| 116 |
|
|
static: clean $(APP_STATIC)
|
| 117 |
|
|
|
| 118 |
|
|
vpi: clean $(APP_VPI)
|
| 119 |
|
|
|
| 120 |
|
|
# Dynamic target
|
| 121 |
|
|
$(APP_DYNAMIC): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_USB_SRC)
|
| 122 |
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(USB_FLAGS) $+ $(DYNAMIC_LDFLAGS) -o $@
|
| 123 |
|
|
|
| 124 |
|
|
# Static target
|
| 125 |
|
|
$(APP_STATIC): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_USB_SRC) $(STATIC_LIBDIR)/$(STATIC_LIB)
|
| 126 |
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(USB_FLAGS) $+ $(STATIC_LDFLAGS) -o $@
|
| 127 |
|
|
cp $(APP_STATIC) $(APP)
|
| 128 |
|
|
|
| 129 |
|
|
# VPI target only
|
| 130 |
|
|
$(APP_VPI): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_VPI_SRC)
|
| 131 |
|
|
$(CXX) $(CPPFLAGS) $(VPI_FLAGS) $(CXXFLAGS) $+ -o $@
|
| 132 |
|
|
|
| 133 |
|
|
# -----------------------------------------------------------------------------
|
| 134 |
|
|
# Target for checking the static lib is in the place it should be
|
| 135 |
|
|
$(STATIC_LIBDIR)/$(STATIC_LIB):
|
| 136 |
|
|
@echo
|
| 137 |
|
|
@echo "The static library, $(STATIC_LIB), is missing."
|
| 138 |
|
|
@echo "Please download the driver to build a statically linked version"
|
| 139 |
|
|
@echo "of this app. For Linux, try:"
|
| 140 |
|
|
@echo "\twget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.16.tar.gz"
|
| 141 |
|
|
@echo "\ttar xzf libftd2xx0.4.16.tar.gz"
|
| 142 |
|
|
@echo "\tcp libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 lib"
|
| 143 |
|
|
@echo
|
| 144 |
|
|
@exit 1
|
| 145 |
|
|
# -----------------------------------------------------------------------------
|
| 146 |
|
|
# Tidy up
|
| 147 |
|
|
clean:
|
| 148 |
|
|
$(RM) $(APP_DYNAMIC)
|
| 149 |
|
|
$(RM) $(APP_STATIC)
|
| 150 |
|
|
$(RM) $(APP_VPI)
|
| 151 |
|
|
find ./ -name "*~" | xargs $(RM)
|