OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or_debug_proxy/] [Makefile] - Blame information for rev 294

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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 46 julius
# 090828        0.1.4   Added ftdi_sio driver reload rule               jb
50 39 julius
 
51
#DBGCPPFLAGS=-DDEBUG_GDB=1
52
#DBGCPPFLAGS=-DDEBUG_USB_DRVR_FUNCS=1
53
#DBGCPPFLAGS=-DDEBUG_USB_DRVR_FUNCS=1 -DDEBUG_GDB=1 -DDEBUG_CMDS=1
54
 
55
# Common Flags
56
COMMON_CPPFLAGS = -I./includes
57 94 julius
COMMON_CXXFLAGS = -O3
58 39 julius
COMMON_LDFLAGS  =
59
 
60
# Flags for static library
61
STATIC_LIBDIR   = lib
62
STATIC_LIB      = libftd2xx.a.0.4.16
63
STATIC_LDFLAGS  = $(COMMON_LDFLAGS) $(STATIC_LIBDIR)/$(STATIC_LIB) \
64
                  -lpthread -ldl
65
# Defines to enable certain endpoint handling functions to be used
66
USB_FLAGS          = -D USB_ENDPOINT_ENABLED=1
67
VPI_FLAGS          = -D VPI_ENDPOINT_ENABLED=1
68
 
69
#Determine whether we're on Cygwin
70
ifndef OSTYPE
71
        # Basically we're interested in finding out if we're
72
        # in a cygwin environement, so let's find out this way
73
        # Note: Typically in a bash environment, $OSTYPE is set
74
        # but sometimes make can't figure it out. So we'll do it
75
        # this way:
76
        ifeq (CYGWIN, $(findstring CYGWIN, $(shell uname)))
77
                OSTYPE=cygwin
78
        endif
79
endif
80
 
81
ifeq ($(OSTYPE),cygwin)
82
        OR_DEBUG_PROXY_SRC = src/or_debug_proxy.c \
83
                             src/gdb.c \
84
                             src/usb_functions.c \
85
                             src/win_usb_driver_calls.c \
86
                             src/vpi_functions.c
87
        CXX                = gcc
88
        CPPFLAGS           = $(COMMON_CPPFLAGS) -I./obj -DCYGWIN_COMPILE=1 $(DBGCPPFLAGS)
89
        CXXFLAGS           = $(COMMON_CXXFLAGS)
90
        DYNAMIC_LDFLAGS    = $(COMMON_LDFLAGS)
91
        EXE                = .exe
92
else
93
        OR_DEBUG_PROXY_SRC = src/or_debug_proxy.c \
94
                             src/gdb.c
95
        OR_DEBUG_PROXY_USB_SRC = src/FT2232c.cpp \
96
                             src/FT2232cMpsseJtag.cpp \
97
                             src/usb_functions.c \
98
                             src/linux_usb_driver_calls.c
99
        OR_DEBUG_PROXY_VPI_SRC = src/vpi_functions.c
100
        CXX                = g++
101
        CPPFLAGS           = $(COMMON_CPPFLAGS) $(DBGCPPFLAGS)
102
        CXXFLAGS           = $(COMMON_CXXFLAGS)
103
        DYNAMIC_LDFLAGS    = $(COMMON_LDFLAGS) -lftd2xx
104
        EXE                =
105
endif
106
 
107
APP             = or_debug_proxy
108
APP_DYNAMIC = $(APP)$(EXE)
109
APP_STATIC  = $(APP)_static$(EXE)
110
APP_VPI     = $(APP)_vpi$(EXE)
111
 
112
# -----------------------------------------------------------------------------
113
# Build dynamic and static targets from scratch
114
.PHONY: all
115
all: clean $(APP_DYNAMIC)
116
 
117
static: clean $(APP_STATIC)
118
 
119
vpi: clean $(APP_VPI)
120
 
121
# Dynamic target
122
$(APP_DYNAMIC): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_USB_SRC)
123
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(USB_FLAGS) $+ $(DYNAMIC_LDFLAGS) -o $@
124
 
125
# Static target
126
$(APP_STATIC): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_USB_SRC) $(STATIC_LIBDIR)/$(STATIC_LIB)
127
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(USB_FLAGS) $+ $(STATIC_LDFLAGS) -o $@
128
        cp $(APP_STATIC) $(APP)
129
 
130
# VPI target only
131
$(APP_VPI): $(OR_DEBUG_PROXY_SRC) $(OR_DEBUG_PROXY_VPI_SRC)
132
        $(CXX) $(CPPFLAGS) $(VPI_FLAGS) $(CXXFLAGS) $+ -o $@
133
 
134
# -----------------------------------------------------------------------------
135
# Target for checking the static lib is in the place it should be
136
$(STATIC_LIBDIR)/$(STATIC_LIB):
137
        @echo
138
        @echo "The static library, $(STATIC_LIB), is missing."
139
        @echo "Please download the driver to build a statically linked version"
140
        @echo "of this app. For Linux, try:"
141
        @echo "\twget http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx0.4.16.tar.gz"
142
        @echo "\ttar xzf libftd2xx0.4.16.tar.gz"
143
        @echo "\tcp libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 lib"
144
        @echo
145
        @exit 1
146
# -----------------------------------------------------------------------------
147
# Tidy up
148
clean:
149
        $(RM) $(APP_DYNAMIC)
150
        $(RM) $(APP_STATIC)
151
        $(RM) $(APP_VPI)
152
        find ./ -name "*~" | xargs $(RM)
153 46 julius
 
154
ifneq ($(OSTYPE),cygwin)
155
reset_driver:
156
        @echo; echo "    Re-installing FTDI serial IO drivers"echo
157
        @echo "    This will require root privileges."
158
        sudo modprobe -r ftdi_sio
159
        sudo modprobe ftdi_sio vendor=0x0403 product=0x6010
160
        @echo
161
endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.