aboutsummaryrefslogtreecommitdiff
path: root/testing/build.test1/Makefile.openocd
blob: 6b0cb56ff0f8188a3a99f93a78f050c541ad4830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# -*- mode: makefile -*-
#
default: _complain_

include ./local.uses


SRC_DIR      ?= $(HERE)/openocd
BUILD_SUFFIX ?= $(BUILD_MACHINE)
BUILD_DIR =$(HERE)/openocd.$(BUILD_SUFFIX)

checkout:
	svn co https://svn.berlios.de/svnroot/repos/openocd/trunk openocd

remove.install:
	rm -rf ${INSTALL_DIR}

#========================================
# Win32 Build Permutations
#   none
#   parport
#   ftd2xx - (ftdichip)
#   libftd
CONFIG_OPTIONS_win32_none     = 
CONFIG_OPTIONS_win32_parport  = --enable-parport
CONFIG_OPTIONS_win32_ftd2xx   = --enable-parport --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_WIN32_DIR)

CYGWIN_EASY_PERMUTATIONS += none
CYGWIN_EASY_PERMUTATIONS += parport
CYGWIN_EASY_PERMUTATIONS += ftd2xx

MINGW32_EASY_PERMUTATIONS += none
MINGW32_EASY_PERMUTATIONS += parport
MINGW32_EASY_PERMUTATIONS += ftd2xx


# This is not a possible permutation, it is manual :-(
# Why? Because "libftdi" installs things into install/include
# which would efect the 'ftd2xx' win32 build
CONFIG_OPTIONS_win32_libftdi  = --enable-parport --enable-ft2232_libftdi

# Default build for win32... is the ftd2xx type build.
PERMUTE_win32          ?= ftd2xx
CONFIG_OPTIONS_win32   ?= $(CONFIG_OPTIONS_win32_$(PERMUTE_win32))
CONFIG_OPTIONS_cygwin   = $(CONFIG_OPTIONS_win32)
CONFIG_OPTIONS_mingw32  = $(CONFIG_OPTIONS_win32)

#========================================
# Linux Build Permuatations
#    none
#    parport
#    ft2232_ftd2xx
#    ft2232_libftdi 
CONFIG_OPTIONS_linux_none    =
LINUX_EASY_PERMUTATIONS     += none

CONFIG_OPTIONS_linux_parport = --enable-parport
LINUX_EASY_PERMUTATIONS     += parport

CONFIG_OPTIONS_linux_ft2232_libftdi = --enable-parport --enable-ft2232-libftdi
#this cannot be done as part of the permutations.
#LINUX_EASY_PERMUTATIONS += ft2232_libftdi

CONFIG_OPTIONS_linux_ft2232_ftd2xx_static  = \
	--enable-parport \
	--enable-ft2232-ftd2xx --with-ftd2xx-lib=static --with-ftd2xx-linux-tardir=$(FTD2XX_LINUX_DIR)
LINUX_EASY_PERMUTATIONS += ft2232_ftd2xx_static

# this is not a possible permutation it is manual :-(
# why? because it interfers with the other permutations
# by "installing files" in the $(INSTALL_DIR)
CONFIG_OPTIONS_linux_ftd2xx_installed  = \
	--enable-parport \
	--enable-ft2232-ftd2xx \
	--with-ftd2xx-lib=shared

# The default build permutation is
PERMUTE_linux ?= ft2232_ftd2xx_static
CONFIG_OPTIONS_linux = $(CONFIG_OPTIONS_linux_$(PERMUTE_linux))

CONFIG_OPTIONS_darwin=\
	--enable-ftd2232-libftdi

# Which build are we doing?
CONFIG_OPTIONS := $(CONFIG_OPTIONS_$(BUILD_SYSNAME))

bootstrap:
	cd $(SRC_DIR) && bash ./bootstrap

clean::
	rm -rf $(BUILD_DIR)

ifndef CFLAGS
_CFLAGS=true
else
_CFLAGS=export CFLAGS="${CFLAGS}"
endif


# if this was given... then pass it on 
configure:
	@echo "     Build Sysname: $(BUILD_SYSNAME)"
	@echo "    Config Options: $(CONFIG_OPTIONS)"
	rm -rf $(BUILD_DIR)
	mkdir $(BUILD_DIR)
	${_CFLAGS} && \
	cd $(BUILD_DIR) && \
		$(SRC_DIR)/configure \
			--prefix=$(PREFIX) \
			--exec-prefix=$(EXEC_PREFIX) \
			$(CONFIG_OPTIONS)

build:
	cd $(BUILD_DIR) && $(MAKE)

install:
	cd $(BUILD_DIR) && $(MAKE) install

all: configure build install

.PHONY: install

# The "cygwin.libftdi" requires that libftdi be built
# and installed *PRIOR* to running this target.
# it is not part of the permutations because ... 
# it interfers with the ftd2xx based builds
cygwin.libftdi: 
	$(MAKE) -f Makefile.openocd bootstrap
	$(MAKE) BUILD_SUFFIX=$@ PERMUTE_win32=libftdi -f Makefile.openocd all

cygwin.easy.permutations: remove.install ${CYGWIN_EASY_PERMUTATIONS:%=_cygwin.%}

_cygwin.%:
	@echo ""
	@echo ""
	@echo "========================================"
	@echo "Permutation Build... $@"
	@echo "========================================"
	@echo ""
	@echo ""
	$(MAKE) PERMUTE_win32=$* BUILD_SUFFIX=cygwin.$* -f Makefile.openocd all 
	$(EXEC_PREFIX)/bin/openocd -v   

mingw32.easy.permutations: remove.install ${MINGW32_EASY_PERMUTATIONS:%=_mingw32.%}

# I (duane) build openocd-mingw32 via Cygwin.
# Sadly, the "mingw32" buid for cygwin does not include
# the required "elf.h" header files... so ... 
# we have them in our own private helper place.
_mingw32.%:
	@echo ""
	@echo ""
	@echo "========================================"
	@echo "Permutation Build... $@"
	@echo "========================================"
	@echo ""
	@echo ""
	CFLAGS="-mno-cygwin -I$(HERE)/mingw32_help/include" \
	$(MAKE) -f Makefile.openocd all ;\
	$(EXEC_PREFIX)/bin/openocd -v   

win32.permutations: mingw32.permutations cygwin.permutations


# SMOKE TEST - Build every linux permuation...
# If "openocd -v" does exit(0) we are good enough.

linux.easy.permutations: remove.install ${LINUX_EASY_PERMUTATIONS:%=_linux.%}


_linux.%:
	@echo ""
	@echo ""
	@echo "========================================"
	@echo "Permutation Build... $@"
	@echo "========================================"
	@echo ""
	@echo ""
	$(MAKE) PERMUTE_linux=$* BUILD_SUFFIX=linux.$* -f Makefile.openocd all 
	$(EXEC_PREFIX)/bin/openocd -v   

linux.ftd2xx_installed:
	${MAKE} -f Makefile.openocd _$@

linux.ft2232_libftdi:
	${MAKE} -f Makefile.openocd _$@

_complain_:
	@echo ""
	@echo "Please try one of these targets: bootstrap, clean, configure, build, install"
	@echo " Or read the makefile and learn about the permutation test targets"
	@echo ""
	@exit 1