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 391

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 353 julius
                             src/win_usb_driver_calls.c
86 39 julius
        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)
152 46 julius
 
153
ifneq ($(OSTYPE),cygwin)
154
reset_driver:
155
        @echo; echo "    Re-installing FTDI serial IO drivers"echo
156
        @echo "    This will require root privileges."
157
        sudo modprobe -r ftdi_sio
158
        sudo modprobe ftdi_sio vendor=0x0403 product=0x6010
159
        @echo
160
endif

powered by: WebSVN 2.1.0

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