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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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