1 # -*- mode: makefile -*-
8 SRC_DIR ?= $(HERE)/openocd
9 BUILD_SUFFIX ?= $(BUILD_MACHINE)
10 BUILD_DIR =$(HERE)/openocd.$(BUILD_SUFFIX)
13 svn co https://svn.berlios.de/svnroot/repos/openocd/trunk openocd
18 #========================================
19 # Win32 Build Permutations
24 CONFIG_OPTIONS_win32_none =
25 CONFIG_OPTIONS_win32_parport = --enable-parport
26 CONFIG_OPTIONS_win32_ftd2xx = --enable-parport --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_WIN32_DIR)
28 CYGWIN_EASY_PERMUTATIONS += none
29 CYGWIN_EASY_PERMUTATIONS += parport
30 CYGWIN_EASY_PERMUTATIONS += ftd2xx
32 MINGW32_EASY_PERMUTATIONS += none
33 MINGW32_EASY_PERMUTATIONS += parport
34 MINGW32_EASY_PERMUTATIONS += ftd2xx
37 # This is not a possible permutation, it is manual :-(
38 # Why? Because "libftdi" installs things into install/include
39 # which would efect the 'ftd2xx' win32 build
40 CONFIG_OPTIONS_win32_libftdi = --enable-parport --enable-ft2232_libftdi
42 # Default build for win32... is the ftd2xx type build.
43 PERMUTE_win32 ?= ftd2xx
44 CONFIG_OPTIONS_win32 ?= $(CONFIG_OPTIONS_win32_$(PERMUTE_win32))
45 CONFIG_OPTIONS_cygwin = $(CONFIG_OPTIONS_win32)
46 CONFIG_OPTIONS_mingw32 = $(CONFIG_OPTIONS_win32)
48 #========================================
49 # Linux Build Permuatations
54 CONFIG_OPTIONS_linux_none =
55 LINUX_EASY_PERMUTATIONS += none
57 CONFIG_OPTIONS_linux_parport = --enable-parport
58 LINUX_EASY_PERMUTATIONS += parport
60 CONFIG_OPTIONS_linux_ft2232_libftdi = --enable-parport --enable-ft2232-libftdi
61 #this cannot be done as part of the permutations.
62 #LINUX_EASY_PERMUTATIONS += ft2232_libftdi
64 CONFIG_OPTIONS_linux_ft2232_ftd2xx_static = \
66 --enable-ft2232-ftd2xx --with-ftd2xx-lib=static --with-ftd2xx-linux-tardir=$(FTD2XX_LINUX_DIR)
67 LINUX_EASY_PERMUTATIONS += ft2232_ftd2xx_static
69 # this is not a possible permutation it is manual :-(
70 # why? because it interfers with the other permutations
71 # by "installing files" in the $(INSTALL_DIR)
72 CONFIG_OPTIONS_linux_ftd2xx_installed = \
74 --enable-ft2232-ftd2xx \
75 --with-ftd2xx-lib=shared
77 # The default build permutation is
78 PERMUTE_linux ?= ft2232_ftd2xx_static
79 CONFIG_OPTIONS_linux = $(CONFIG_OPTIONS_linux_$(PERMUTE_linux))
81 CONFIG_OPTIONS_darwin=\
82 --enable-ftd2232-libftdi
84 # Which build are we doing?
85 CONFIG_OPTIONS := $(CONFIG_OPTIONS_$(BUILD_SYSNAME))
88 cd $(SRC_DIR) && bash ./bootstrap
96 _CFLAGS=export CFLAGS="${CFLAGS}"
100 # if this was given... then pass it on
102 @echo " Build Sysname: $(BUILD_SYSNAME)"
103 @echo " Config Options: $(CONFIG_OPTIONS)"
108 $(SRC_DIR)/configure \
110 --exec-prefix=$(EXEC_PREFIX) \
114 cd $(BUILD_DIR) && $(MAKE)
117 cd $(BUILD_DIR) && $(MAKE) install
119 all: configure build install
123 # The "cygwin.libftdi" requires that libftdi be built
124 # and installed *PRIOR* to running this target.
125 # it is not part of the permutations because ...
126 # it interfers with the ftd2xx based builds
128 $(MAKE) -f Makefile.openocd bootstrap
129 $(MAKE) BUILD_SUFFIX=$@ PERMUTE_win32=libftdi -f Makefile.openocd all
131 cygwin.easy.permutations: remove.install ${CYGWIN_EASY_PERMUTATIONS:%=_cygwin.%}
136 @echo "========================================"
137 @echo "Permutation Build... $@"
138 @echo "========================================"
141 $(MAKE) PERMUTE_win32=$* BUILD_SUFFIX=cygwin.$* -f Makefile.openocd all
142 $(EXEC_PREFIX)/bin/openocd -v
144 mingw32.easy.permutations: remove.install ${MINGW32_EASY_PERMUTATIONS:%=_mingw32.%}
146 # I (duane) build openocd-mingw32 via Cygwin.
147 # Sadly, the "mingw32" buid for cygwin does not include
148 # the required "elf.h" header files... so ...
149 # we have them in our own private helper place.
153 @echo "========================================"
154 @echo "Permutation Build... $@"
155 @echo "========================================"
158 CFLAGS="-mno-cygwin -I$(HERE)/mingw32_help/include" \
159 $(MAKE) -f Makefile.openocd all ;\
160 $(EXEC_PREFIX)/bin/openocd -v
162 win32.permutations: mingw32.permutations cygwin.permutations
165 # SMOKE TEST - Build every linux permuation...
166 # If "openocd -v" does exit(0) we are good enough.
168 linux.easy.permutations: remove.install ${LINUX_EASY_PERMUTATIONS:%=_linux.%}
174 @echo "========================================"
175 @echo "Permutation Build... $@"
176 @echo "========================================"
179 $(MAKE) PERMUTE_linux=$* BUILD_SUFFIX=linux.$* -f Makefile.openocd all
180 $(EXEC_PREFIX)/bin/openocd -v
182 linux.ftd2xx_installed:
183 ${MAKE} -f Makefile.openocd _$@
185 linux.ft2232_libftdi:
186 ${MAKE} -f Makefile.openocd _$@
190 @echo "Please try one of these targets: bootstrap, clean, configure, build, install"
191 @echo " Or read the makefile and learn about the permutation test targets"