You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

194 lines
5.2 KiB

  1. # -*- mode: makefile -*-
  2. #
  3. default: _complain_
  4. include ./local.uses
  5. SRC_DIR ?= $(HERE)/openocd
  6. BUILD_SUFFIX ?= $(BUILD_MACHINE)
  7. BUILD_DIR =$(HERE)/openocd.$(BUILD_SUFFIX)
  8. checkout:
  9. svn co https://svn.berlios.de/svnroot/repos/openocd/trunk openocd
  10. remove.install:
  11. rm -rf ${INSTALL_DIR}
  12. #========================================
  13. # Win32 Build Permutations
  14. # none
  15. # parport
  16. # ftd2xx - (ftdichip)
  17. # libftd
  18. CONFIG_OPTIONS_win32_none =
  19. CONFIG_OPTIONS_win32_parport = --enable-parport
  20. CONFIG_OPTIONS_win32_ftd2xx = --enable-parport --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_WIN32_DIR)
  21. CYGWIN_EASY_PERMUTATIONS += none
  22. CYGWIN_EASY_PERMUTATIONS += parport
  23. CYGWIN_EASY_PERMUTATIONS += ftd2xx
  24. MINGW32_EASY_PERMUTATIONS += none
  25. MINGW32_EASY_PERMUTATIONS += parport
  26. MINGW32_EASY_PERMUTATIONS += ftd2xx
  27. # This is not a possible permutation, it is manual :-(
  28. # Why? Because "libftdi" installs things into install/include
  29. # which would efect the 'ftd2xx' win32 build
  30. CONFIG_OPTIONS_win32_libftdi = --enable-parport --enable-ft2232_libftdi
  31. # Default build for win32... is the ftd2xx type build.
  32. PERMUTE_win32 ?= $(BUILD_SYSNAME)_ftd2xx
  33. CONFIG_OPTIONS_win32 ?= $(CONFIG_OPTIONS_win32_$(PERMUTE_win32))
  34. CONFIG_OPTIONS_cygwin = $(CONFIG_OPTIONS_win32)
  35. CONFIG_OPTIONS_mingw32 = $(CONFIG_OPTIONS_win32)
  36. #========================================
  37. # Linux Build Permuatations
  38. # none
  39. # parport
  40. # ft2232_ftd2xx
  41. # ft2232_libftdi
  42. CONFIG_OPTIONS_linux_none =
  43. LINUX_EASY_PERMUTATIONS += none
  44. CONFIG_OPTIONS_linux_parport = --enable-parport
  45. LINUX_EASY_PERMUTATIONS += parport
  46. CONFIG_OPTIONS_linux_ft2232_libftdi = --enable-parport --enable-ft2232-libftdi
  47. #this cannot be done as part of the permutations.
  48. #LINUX_EASY_PERMUTATIONS += ft2232_libftdi
  49. CONFIG_OPTIONS_linux_ft2232_ftd2xx_static = \
  50. --enable-parport \
  51. --enable-ft2232-ftd2xx --with-ftd2xx-lib=static --with-ftd2xx-linux-tardir=$(FTD2XX_LINUX_DIR)
  52. LINUX_EASY_PERMUTATIONS += ft2232_ftd2xx_static
  53. # this is not a possible permutation it is manual :-(
  54. # why? because it interfers with the other permutations
  55. # by "installing files" in the $(INSTALL_DIR)
  56. CONFIG_OPTIONS_linux_ftd2xx_installed = \
  57. --enable-parport \
  58. --enable-ft2232-ftd2xx \
  59. --with-ftd2xx-lib=shared
  60. # The default build permutation is
  61. PERMUTE_linux ?= ft2232_ftd2xx_static
  62. CONFIG_OPTIONS_linux = $(CONFIG_OPTIONS_linux_$(PERMUTE_linux))
  63. CONFIG_OPTIONS_darwin=\
  64. --enable-ftd2232-libftdi
  65. # Which build are we doing?
  66. CONFIG_OPTIONS := $(CONFIG_OPTIONS_$(BUILD_SYSNAME))
  67. bootstrap:
  68. cd $(SRC_DIR) && bash ./bootstrap
  69. clean::
  70. rm -rf $(BUILD_DIR)
  71. ifndef CFLAGS
  72. _CFLAGS=true
  73. else
  74. _CFLAGS=export CFLAGS="${CFLAGS}"
  75. endif
  76. # if this was given... then pass it on
  77. configure:
  78. @echo " Build Sysname: $(BUILD_SYSNAME)"
  79. @echo " Config Options: $(CONFIG_OPTIONS)"
  80. rm -rf $(BUILD_DIR)
  81. mkdir $(BUILD_DIR)
  82. ${_CFLAGS} && \
  83. cd $(BUILD_DIR) && \
  84. $(SRC_DIR)/configure \
  85. --prefix=$(PREFIX) \
  86. --exec-prefix=$(EXEC_PREFIX) \
  87. $(CONFIG_OPTIONS)
  88. build:
  89. cd $(BUILD_DIR) && $(MAKE)
  90. install:
  91. cd $(BUILD_DIR) && $(MAKE) install
  92. all: configure build install
  93. .PHONY: install
  94. # The "cygwin.libftdi" requires that libftdi be built
  95. # and installed *PRIOR* to running this target.
  96. # it is not part of the permutations because ...
  97. # it interfers with the ftd2xx based builds
  98. cygwin.libftdi:
  99. $(MAKE) -f Makefile.openocd bootstrap
  100. $(MAKE) BUILD_SUFFIX=$@ PERMUTE_win32=libftdi -f Makefile.openocd all
  101. cygwin.easy.permutations: remove.install ${CYGWIN_EASY_PERMUTATIONS:%=_cygwin.%}
  102. _cygwin.%:
  103. @echo ""
  104. @echo ""
  105. @echo "========================================"
  106. @echo "Permutation Build... $@"
  107. @echo "========================================"
  108. @echo ""
  109. @echo ""
  110. $(MAKE) PERMUTE_win32=$* BUILD_SUFFIX=cygwin.$* -f Makefile.openocd all
  111. $(EXEC_PREFIX)/bin/openocd -v
  112. mingw32.easy.permutations: remove.install ${MINGW32_EASY_PERMUTATIONS:%=_mingw32.%}
  113. # I (duane) build openocd-mingw32 via Cygwin.
  114. # Sadly, the "mingw32" buid for cygwin does not include
  115. # the required "elf.h" header files... so ...
  116. # we have them in our own private helper place.
  117. _mingw32.%:
  118. @echo ""
  119. @echo ""
  120. @echo "========================================"
  121. @echo "Permutation Build... $@"
  122. @echo "========================================"
  123. @echo ""
  124. @echo ""
  125. CFLAGS="-mno-cygwin -I$(HERE)/mingw32_help/include" \
  126. $(MAKE) -f Makefile.openocd all ;\
  127. $(EXEC_PREFIX)/bin/openocd -v
  128. win32.permutations: mingw32.permutations cygwin.permutations
  129. # SMOKE TEST - Build every linux permuation...
  130. # If "openocd -v" does exit(0) we are good enough.
  131. linux.easy.permutations: remove.install ${LINUX_EASY_PERMUTATIONS:%=_linux.%}
  132. _linux.%:
  133. @echo ""
  134. @echo ""
  135. @echo "========================================"
  136. @echo "Permutation Build... $@"
  137. @echo "========================================"
  138. @echo ""
  139. @echo ""
  140. $(MAKE) PERMUTE_linux=$* BUILD_SUFFIX=linux.$* -f Makefile.openocd all
  141. $(EXEC_PREFIX)/bin/openocd -v
  142. linux.ftd2xx_installed:
  143. ${MAKE} -f Makefile.openocd _$@
  144. linux.ft2232_libftdi:
  145. ${MAKE} -f Makefile.openocd _$@
  146. _complain_:
  147. @echo ""
  148. @echo "Please try one of these targets: bootstrap, clean, configure, build, install"
  149. @echo " Or read the makefile and learn about the permutation test targets"
  150. @echo ""
  151. @exit 1