OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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

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

powered by: WebSVN 2.1.0

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