Makefile.am 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. # Copyright 2012-2014 Luke Dashjr
  2. # Copyright 2012 zefir
  3. # Copyright 2011-2013 Con Kolivas
  4. # Copyright 2013 James Z.M. Gao
  5. # Copyright 2013-2014 Nate Woolls
  6. #
  7. # This program is free software; you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License as published by the Free
  9. # Software Foundation; either version 3 of the License, or (at your option)
  10. # any later version. See COPYING for more details.
  11. ACLOCAL_AMFLAGS = -I m4
  12. EXTRA_DIST = \
  13. m4/gnulib-cache.m4 \
  14. linux-usb-bfgminer \
  15. windows-build.txt
  16. dist_doc_DATA = \
  17. AUTHORS COPYING HACKING NEWS README \
  18. example.conf \
  19. README.RPC
  20. rpcexamplesdir = $(docdir)/rpc-examples
  21. dist_rpcexamples_DATA = \
  22. api-example.php miner.php \
  23. api-example.c \
  24. api-example.py
  25. SUBDIRS = lib ccan.bfg
  26. # Without a redirected rule, code depending on different lib/*.h files may try to build dependencies of that in parallel, which can fail
  27. lib/%: lib_directory
  28. @test -e $@
  29. lib_directory:
  30. $(MAKE) -C lib
  31. ccan.bfg/libccan.a:
  32. $(MAKE) -C ccan.bfg $*
  33. INCLUDES = -fno-strict-aliasing
  34. bin_PROGRAMS = bfgminer
  35. sbin_SCRIPTS =
  36. if HAVE_WINDOWS
  37. else
  38. bin_SCRIPTS = start-bfgminer.sh
  39. endif
  40. bfgminer_LDFLAGS = $(PTHREAD_FLAGS)
  41. bfgminer_LDADD = $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
  42. @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
  43. @UDEV_LIBS@ @LIBUSB_LIBS@ @MM_LIBS@ @RT_LIBS@ \
  44. @MATH_LIBS@ lib/libgnu.a ccan.bfg/libccan.a
  45. bfgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @LIBUSB_CFLAGS@ @LIBCURL_CFLAGS@
  46. bfgminer_CPPFLAGS += -DCGMINER_PREFIX='"$(pkgdatadir)"'
  47. bfgminer_CPPFLAGS += -I$(top_srcdir)/ccan-upstream
  48. bfgminer_CPPFLAGS += @JANSSON_CFLAGS@
  49. bfgminer_CPPFLAGS += $(PTHREAD_FLAGS)
  50. bfgminer_CPPFLAGS += $(NCURSES_CPPFLAGS)
  51. bfgminer_CPPFLAGS += $(AUTOSCAN_CPPFLAGS)
  52. bfgminer_LDADD += $(AUTOSCAN_LIBS)
  53. bfgminer_LDADD += $(libblkmaker_LIBS)
  54. bfgminer_LDFLAGS += $(libblkmaker_LDFLAGS)
  55. bfgminer_CPPFLAGS += $(libblkmaker_CFLAGS)
  56. bfgminer_CPPFLAGS += $(zlib_CFLAGS)
  57. bfgminer_LDADD += $(zlib_LIBS)
  58. # common sources
  59. bfgminer_SOURCES := miner.c
  60. bfgminer_SOURCES += miner.h compat.h \
  61. deviceapi.c deviceapi.h \
  62. util.c util.h logging.h \
  63. sha2.c sha2.h api.c
  64. EXTRA_bfgminer_DEPENDENCIES =
  65. .PHONY: update-version
  66. update-version:
  67. ./gen-version.sh >version.h.new
  68. cmp version.h version.h.new && rm version.h.new || mv version.h.new version.h
  69. version.h: update-version
  70. bfgminer_SOURCES += version.h
  71. BUILT_SOURCES = version.h
  72. SUBDIRS += $(LIBBLKMAKER_SUBDIRS)
  73. LIBBLKMAKER_SUBDIRS =
  74. if NEED_LIBBLKMAKER
  75. LIBBLKMAKER_SUBDIRS += libblkmaker
  76. EXTRA_bfgminer_DEPENDENCIES += libblkmaker_directory
  77. libblkmaker_directory:
  78. cd libblkmaker && $(MAKE)
  79. if HAVE_CYGWIN
  80. EXTRA_bfgminer_DEPENDENCIES += cygblkmaker-0.1-0.dll cygblkmaker_jansson-0.1-0.dll
  81. cyg%.dll: libblkmaker/.libs/cyg%.dll
  82. cp -p $< $@
  83. endif
  84. endif
  85. bfgminer_SOURCES += logging.c
  86. if USE_UDEVRULES
  87. dist_udevrules_DATA = 70-bfgminer.rules
  88. endif
  89. if NEED_BFG_DRIVER_PROXY
  90. bfgminer_SOURCES += driver-proxy.c driver-proxy.h
  91. endif
  92. if USE_LIBMICROHTTPD
  93. bfgminer_SOURCES += httpsrv.c httpsrv.h driver-getwork.c
  94. bfgminer_LDADD += $(libmicrohttpd_LIBS)
  95. bfgminer_LDFLAGS += $(libmicrohttpd_LDFLAGS)
  96. bfgminer_CPPFLAGS += $(libmicrohttpd_CFLAGS)
  97. endif
  98. if USE_LIBEVENT
  99. bfgminer_SOURCES += driver-stratum.c
  100. bfgminer_LDADD += $(libevent_LIBS)
  101. bfgminer_LDFLAGS += $(libevent_LDFLAGS)
  102. bfgminer_CPPFLAGS += $(libevent_CFLAGS)
  103. endif
  104. if HAVE_OPENCL
  105. bfgminer_SOURCES += driver-opencl.h driver-opencl.c
  106. bfgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
  107. bfgminer_SOURCES += adl.c adl.h adl_functions.h
  108. bfgminer_SOURCES += opencl/*.cl
  109. kernelsdir = $(pkgdatadir)/opencl
  110. dist_kernels_DATA = $(top_srcdir)/opencl/*.cl
  111. dist_doc_DATA += README.GPU
  112. if HAVE_SENSORS
  113. bfgminer_LDADD += $(sensors_LIBS)
  114. endif
  115. endif
  116. if HAS_SCRYPT
  117. bfgminer_SOURCES += scrypt.c scrypt.h
  118. dist_doc_DATA += README.scrypt
  119. endif
  120. if HAS_CPUMINE
  121. dist_doc_DATA += README.CPU
  122. bfgminer_SOURCES += \
  123. sha256_generic.c sha256_via.c \
  124. sha256_cryptopp.c sha256_sse2_amd64.c \
  125. sha256_sse4_amd64.c \
  126. sha256_altivec_4way.c
  127. # the CPU portion extracted from original main.c
  128. bfgminer_SOURCES += driver-cpu.h driver-cpu.c
  129. if HAVE_SSE2
  130. bfgminer_LDADD += libsse2cpuminer.a
  131. noinst_LIBRARIES = libsse2cpuminer.a
  132. libsse2cpuminer_a_SOURCES = sha256_4way.c
  133. libsse2cpuminer_a_CFLAGS = $(bfgminer_CPPFLAGS) $(SSE2_CFLAGS)
  134. endif
  135. if HAS_YASM
  136. AM_CFLAGS = -DHAS_YASM
  137. if HAVE_x86_64
  138. SUBDIRS += x86_64
  139. x86_64/libx8664.a:
  140. $(MAKE) -C x86_64 $*
  141. bfgminer_LDADD += x86_64/libx8664.a
  142. else # HAVE_x86_64
  143. SUBDIRS += x86_32
  144. x86_32/libx8632.a:
  145. $(MAKE) -C x86_32 $*
  146. bfgminer_LDADD += x86_32/libx8632.a
  147. if HAVE_SSE2
  148. libsse2cpuminer_a_SOURCES += sha256_sse2_i386.c
  149. endif
  150. endif # HAVE_x86_64
  151. endif # HAS_YASM
  152. endif # HAS_CPUMINE
  153. if NEED_BFG_LOWL_VCOM
  154. bfgminer_SOURCES += lowl-vcom.c lowl-vcom.h
  155. if HAVE_WINDOWS
  156. else
  157. bfgminer_SOURCES += iospeeds.h iospeeds_posix.h
  158. endif
  159. endif
  160. if HAVE_LIBUSB
  161. bfgminer_SOURCES += lowl-usb.c lowl-usb.h
  162. endif
  163. if NEED_BFG_BINLOADER
  164. bfgminer_SOURCES += binloader.c binloader.h
  165. endif
  166. if NEED_BFG_LOWLEVEL
  167. bfgminer_SOURCES += lowlevel.c lowlevel.h
  168. endif
  169. if NEED_DYNCLOCK
  170. bfgminer_SOURCES += dynclock.c dynclock.h
  171. endif
  172. if NEED_BFG_WORK2D
  173. bfgminer_SOURCES += work2d.c work2d.h
  174. endif
  175. if HAS_FPGA
  176. dist_doc_DATA += README.FPGA
  177. endif
  178. if HAS_ASIC
  179. dist_doc_DATA += README.ASIC
  180. endif
  181. if HAS_BITFORCE
  182. bfgminer_SOURCES += driver-bitforce.c
  183. endif
  184. if HAS_BIGPIC
  185. bfgminer_SOURCES += driver-bigpic.c driver-bigpic.h
  186. endif
  187. if USE_DRILLBIT
  188. bfgminer_SOURCES += driver-drillbit.c
  189. endif
  190. if HAS_TWINFURY
  191. bfgminer_SOURCES += driver-twinfury.c driver-twinfury.h
  192. endif
  193. if HAS_ICARUS
  194. bfgminer_SOURCES += driver-icarus.c driver-icarus.h
  195. bfgminer_SOURCES += driver-cairnsmore.c
  196. bfgminer_SOURCES += driver-erupter.c
  197. bfgminer_SOURCES += driver-antminer.c
  198. endif
  199. if USE_GC3355
  200. bfgminer_SOURCES += gc3355.c gc3355.h
  201. endif
  202. if USE_GRIDSEED
  203. bfgminer_SOURCES += driver-gridseed.c
  204. endif
  205. if USE_DUALMINER
  206. bfgminer_SOURCES += driver-dualminer.c
  207. endif
  208. if USE_ZEUSMINER
  209. bfgminer_SOURCES += driver-zeusminer.c
  210. endif
  211. if HAS_AVALON
  212. bfgminer_SOURCES += driver-avalon.c driver-avalon.h hexdump.c
  213. endif
  214. if USE_AVALONMM
  215. bfgminer_SOURCES += driver-avalonmm.c
  216. endif
  217. if USE_KNC
  218. bfgminer_SOURCES += driver-knc.c
  219. endif
  220. if HAS_KLONDIKE
  221. bfgminer_SOURCES += driver-klondike.c driver-klondike.h driver-hashbusteravalon.c
  222. endif
  223. if HAS_MODMINER
  224. bfgminer_SOURCES += driver-modminer.c
  225. endif
  226. if USE_NEPTUNE
  227. bfgminer_SOURCES += driver-neptune.c
  228. endif
  229. if HAS_X6500
  230. bfgminer_SOURCES += driver-x6500.c jtag.c jtag.h
  231. endif
  232. if HAS_ZTEX
  233. bfgminer_SOURCES += driver-ztex.c libztex.c libztex.h
  234. endif
  235. if USE_BIFURY
  236. bfgminer_SOURCES += driver-bifury.c
  237. endif
  238. if HAS_BITFURY
  239. bfgminer_SOURCES += driver-bitfury.c driver-bitfury.h libbitfury.c libbitfury.h
  240. if HAS_BFSB
  241. bfgminer_SOURCES += driver-bfsb.c
  242. endif
  243. if USE_BFX
  244. bfgminer_SOURCES += driver-bfx.c
  245. endif
  246. if HAS_METABANK
  247. bfgminer_SOURCES += driver-metabank.c tm_i2c.h tm_i2c.c
  248. endif
  249. if HAS_LITTLEFURY
  250. bfgminer_SOURCES += driver-littlefury.c
  251. endif
  252. if HAS_NANOFURY
  253. bfgminer_SOURCES += driver-nanofury.c mcp2210.c mcp2210.h
  254. endif
  255. if USE_HASHBUSTER
  256. bfgminer_SOURCES += driver-hashbuster.c
  257. endif
  258. if USE_HASHBUSTERUSB
  259. bfgminer_SOURCES += driver-hashbusterusb.c
  260. endif
  261. endif
  262. if USE_HASHFAST
  263. bfgminer_SOURCES += driver-hashfast.c
  264. endif
  265. if USE_JINGTIAN
  266. bfgminer_SOURCES += driver-aan.c driver-aan.h
  267. bfgminer_SOURCES += driver-jingtian.c
  268. endif
  269. if USE_MINERGATE
  270. bfgminer_SOURCES += driver-minergate.c
  271. endif
  272. if USE_ROCKMINER
  273. bfgminer_SOURCES += driver-rockminer.c
  274. endif
  275. if NEED_BFG_LOWL_FTDI
  276. bfgminer_SOURCES += lowl-ftdi.c lowl-ftdi.h
  277. endif
  278. if NEED_BFG_LOWL_HID
  279. bfgminer_SOURCES += lowl-hid.c lowl-hid.h
  280. bfgminer_CPPFLAGS += $(hidapi_CFLAGS)
  281. endif
  282. if NEED_BFG_LOWL_MSWIN
  283. bfgminer_SOURCES += lowl-mswin.c lowl-mswin.h
  284. endif
  285. if NEED_BFG_LOWL_PCI
  286. bfgminer_SOURCES += lowl-pci.c lowl-pci.h
  287. if USE_VFIO
  288. sbin_SCRIPTS += setup-vfio
  289. endif
  290. endif
  291. if NEED_BFG_LOWL_SPI
  292. bfgminer_SOURCES += lowl-spi.h lowl-spi.c
  293. endif
  294. bin_PROGRAMS += bfgminer-rpc
  295. bfgminer_rpc_SOURCES = api-example.c
  296. bfgminer_rpc_LDADD = @WS2_LIBS@