Makefile.am 8.1 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. # first, our own stuff
  41. bfgminer_LDADD = lib/libgnu.a ccan.bfg/libccan.a
  42. bfgminer_LDFLAGS =
  43. bfgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/ccan-upstream
  44. # second, potentially embedded libs
  45. bfgminer_LDADD += $(libbase58_LIBS) $(libblkmaker_LIBS)
  46. bfgminer_CPPFLAGS += $(libbase58_CFLAGS) $(libblkmaker_CFLAGS)
  47. # finally, everything else
  48. bfgminer_LDFLAGS += $(PTHREAD_FLAGS)
  49. bfgminer_LDADD += $(DLOPEN_FLAGS) @LIBCURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ \
  50. @NCURSES_LIBS@ @PDCURSES_LIBS@ @WS2_LIBS@ \
  51. @UDEV_LIBS@ @LIBUSB_LIBS@ @MM_LIBS@ @RT_LIBS@ \
  52. $(MATH_LIBS)
  53. bfgminer_CPPFLAGS += @LIBUSB_CFLAGS@ @LIBCURL_CFLAGS@
  54. bfgminer_CPPFLAGS += -DCGMINER_PREFIX='"$(pkgdatadir)"'
  55. bfgminer_CPPFLAGS += @JANSSON_CFLAGS@
  56. bfgminer_CPPFLAGS += $(PTHREAD_FLAGS)
  57. bfgminer_CPPFLAGS += $(NCURSES_CPPFLAGS)
  58. bfgminer_CPPFLAGS += $(AUTOSCAN_CPPFLAGS)
  59. bfgminer_LDADD += $(AUTOSCAN_LIBS)
  60. # common sources
  61. bfgminer_SOURCES := miner.c
  62. bfgminer_SOURCES += miner.h compat.h \
  63. deviceapi.c deviceapi.h \
  64. util.c util.h logging.h \
  65. sha2.c sha2.h api.c
  66. EXTRA_bfgminer_DEPENDENCIES =
  67. TESTS = test-bfgminer.sh
  68. EXTRA_DIST += test-bfgminer.sh
  69. SH_LOG_COMPILER = /bin/sh
  70. AM_TESTS_ENVIRONMENT = PATH='$(srcdir)':"$$PATH"; export PATH;
  71. TESTS_ENVIRONMENT = $(AM_TESTS_ENVIRONMENT)
  72. TEST_EXTENSIONS = .sh
  73. .PHONY: update-version
  74. update-version:
  75. ./gen-version.sh >version.h.new
  76. cmp version.h version.h.new && rm version.h.new || mv version.h.new version.h
  77. version.h: update-version
  78. bfgminer_SOURCES += version.h
  79. BUILT_SOURCES = version.h
  80. SUBDIRS += $(libbase58_SUBDIRS) $(libblkmaker_SUBDIRS)
  81. EXTRA_bfgminer_DEPENDENCIES += $(libbase58_EXTRADEPS) $(libblkmaker_EXTRADEPS)
  82. @BUNDLED_LIB_RULES@
  83. bfgminer_SOURCES += logging.c
  84. if HAVE_WINDOWS
  85. bfgminer_SOURCES += winhacks.h
  86. endif
  87. if USE_UDEVRULES
  88. dist_udevrules_DATA = 70-bfgminer.rules
  89. endif
  90. if NEED_BFG_DRIVER_PROXY
  91. bfgminer_SOURCES += driver-proxy.c driver-proxy.h
  92. endif
  93. if USE_LIBMICROHTTPD
  94. bfgminer_SOURCES += httpsrv.c httpsrv.h driver-getwork.c
  95. bfgminer_LDADD += $(libmicrohttpd_LIBS)
  96. bfgminer_LDFLAGS += $(libmicrohttpd_LDFLAGS)
  97. bfgminer_CPPFLAGS += $(libmicrohttpd_CFLAGS)
  98. endif
  99. if USE_LIBEVENT
  100. bfgminer_SOURCES += driver-stratum.c
  101. bfgminer_LDADD += $(libevent_LIBS)
  102. bfgminer_LDFLAGS += $(libevent_LDFLAGS)
  103. bfgminer_CPPFLAGS += $(libevent_CFLAGS)
  104. endif
  105. if HAVE_OPENCL
  106. bfgminer_SOURCES += driver-opencl.h driver-opencl.c
  107. bfgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
  108. bfgminer_SOURCES += adl.c adl.h adl_functions.h
  109. bfgminer_SOURCES += opencl/*.cl
  110. kernelsdir = $(pkgdatadir)/opencl
  111. dist_kernels_DATA = $(top_srcdir)/opencl/*.cl
  112. dist_doc_DATA += README.GPU
  113. if HAVE_SENSORS
  114. bfgminer_LDADD += $(sensors_LIBS)
  115. endif
  116. endif
  117. if HAS_SCRYPT
  118. bfgminer_SOURCES += scrypt.c scrypt.h
  119. dist_doc_DATA += README.scrypt
  120. endif
  121. if HAS_CPUMINE
  122. dist_doc_DATA += README.CPU
  123. bfgminer_SOURCES += \
  124. sha256_generic.c sha256_via.c \
  125. sha256_cryptopp.c sha256_sse2_amd64.c \
  126. sha256_sse4_amd64.c \
  127. sha256_altivec_4way.c
  128. # the CPU portion extracted from original main.c
  129. bfgminer_SOURCES += driver-cpu.h driver-cpu.c
  130. if HAVE_SSE2
  131. bfgminer_LDADD += libsse2cpuminer.a
  132. noinst_LIBRARIES = libsse2cpuminer.a
  133. libsse2cpuminer_a_SOURCES = sha256_4way.c
  134. libsse2cpuminer_a_CFLAGS = $(bfgminer_CPPFLAGS) $(SSE2_CFLAGS)
  135. endif
  136. if HAS_YASM
  137. AM_CFLAGS = -DHAS_YASM
  138. if HAVE_x86_64
  139. SUBDIRS += x86_64
  140. x86_64/libx8664.a:
  141. $(MAKE) -C x86_64 $*
  142. bfgminer_LDADD += x86_64/libx8664.a
  143. else # HAVE_x86_64
  144. SUBDIRS += x86_32
  145. x86_32/libx8632.a:
  146. $(MAKE) -C x86_32 $*
  147. bfgminer_LDADD += x86_32/libx8632.a
  148. if HAVE_SSE2
  149. libsse2cpuminer_a_SOURCES += sha256_sse2_i386.c
  150. endif
  151. endif # HAVE_x86_64
  152. endif # HAS_YASM
  153. endif # HAS_CPUMINE
  154. if NEED_BFG_LOWL_VCOM
  155. bfgminer_SOURCES += lowl-vcom.c lowl-vcom.h
  156. if HAVE_WINDOWS
  157. else
  158. bfgminer_SOURCES += iospeeds.h iospeeds_posix.h
  159. endif
  160. endif
  161. if HAVE_LIBUSB
  162. bfgminer_SOURCES += lowl-usb.c lowl-usb.h
  163. endif
  164. if NEED_BFG_BINLOADER
  165. bfgminer_SOURCES += binloader.c binloader.h
  166. endif
  167. if NEED_BFG_LOWLEVEL
  168. bfgminer_SOURCES += lowlevel.c lowlevel.h
  169. endif
  170. if NEED_DYNCLOCK
  171. bfgminer_SOURCES += dynclock.c dynclock.h
  172. endif
  173. if NEED_BFG_WORK2D
  174. bfgminer_SOURCES += work2d.c work2d.h
  175. endif
  176. if HAS_FPGA
  177. dist_doc_DATA += README.FPGA
  178. endif
  179. if HAS_ASIC
  180. dist_doc_DATA += README.ASIC
  181. endif
  182. if HAS_BITFORCE
  183. bfgminer_SOURCES += driver-bitforce.c
  184. endif
  185. if HAS_BIGPIC
  186. bfgminer_SOURCES += driver-bigpic.c driver-bigpic.h
  187. endif
  188. if USE_DRILLBIT
  189. bfgminer_SOURCES += driver-drillbit.c
  190. endif
  191. if HAS_TWINFURY
  192. bfgminer_SOURCES += driver-twinfury.c driver-twinfury.h
  193. endif
  194. if HAS_ICARUS
  195. bfgminer_SOURCES += driver-icarus.c driver-icarus.h
  196. bfgminer_SOURCES += driver-cairnsmore.c
  197. bfgminer_SOURCES += driver-erupter.c
  198. bfgminer_SOURCES += driver-antminer.c
  199. endif
  200. if USE_GC3355
  201. bfgminer_SOURCES += gc3355.c gc3355.h
  202. endif
  203. if USE_GRIDSEED
  204. bfgminer_SOURCES += driver-gridseed.c
  205. endif
  206. if USE_DUALMINER
  207. bfgminer_SOURCES += driver-dualminer.c
  208. endif
  209. if USE_ZEUSMINER
  210. bfgminer_SOURCES += driver-zeusminer.c
  211. endif
  212. if HAS_AVALON
  213. bfgminer_SOURCES += driver-avalon.c driver-avalon.h hexdump.c
  214. endif
  215. if USE_AVALONMM
  216. bfgminer_SOURCES += driver-avalonmm.c
  217. endif
  218. if USE_KNC
  219. bfgminer_SOURCES += driver-knc.c
  220. endif
  221. if HAS_KLONDIKE
  222. bfgminer_SOURCES += driver-klondike.c driver-klondike.h driver-hashbusteravalon.c
  223. endif
  224. if HAS_MODMINER
  225. bfgminer_SOURCES += driver-modminer.c
  226. endif
  227. if HAS_X6500
  228. bfgminer_SOURCES += driver-x6500.c jtag.c jtag.h
  229. endif
  230. if HAS_ZTEX
  231. bfgminer_SOURCES += driver-ztex.c libztex.c libztex.h
  232. endif
  233. if USE_BIFURY
  234. bfgminer_SOURCES += driver-bifury.c
  235. endif
  236. if HAS_BITFURY
  237. bfgminer_SOURCES += driver-bitfury.c driver-bitfury.h libbitfury.c libbitfury.h
  238. if HAS_BFSB
  239. bfgminer_SOURCES += driver-bfsb.c
  240. endif
  241. if USE_BFX
  242. bfgminer_SOURCES += driver-bfx.c
  243. endif
  244. if HAS_METABANK
  245. bfgminer_SOURCES += driver-metabank.c tm_i2c.h tm_i2c.c
  246. endif
  247. if HAS_LITTLEFURY
  248. bfgminer_SOURCES += driver-littlefury.c
  249. endif
  250. if HAS_NANOFURY
  251. bfgminer_SOURCES += driver-nanofury.c mcp2210.c mcp2210.h
  252. endif
  253. if USE_HASHBUSTER
  254. bfgminer_SOURCES += driver-hashbuster.c
  255. endif
  256. if USE_HASHBUSTERUSB
  257. bfgminer_SOURCES += driver-hashbusterusb.c
  258. endif
  259. endif
  260. if USE_COINTERRA
  261. bfgminer_SOURCES += driver-cointerra.c driver-cointerra.h
  262. endif
  263. if USE_HASHFAST
  264. bfgminer_SOURCES += driver-hashfast.c
  265. endif
  266. if USE_JINGTIAN
  267. bfgminer_SOURCES += driver-aan.c driver-aan.h
  268. bfgminer_SOURCES += driver-jingtian.c
  269. endif
  270. if USE_MINERGATE
  271. bfgminer_SOURCES += driver-minergate.c
  272. endif
  273. if USE_ROCKMINER
  274. bfgminer_SOURCES += driver-rockminer.c
  275. endif
  276. if NEED_BFG_LOWL_FTDI
  277. bfgminer_SOURCES += lowl-ftdi.c lowl-ftdi.h
  278. endif
  279. if NEED_BFG_LOWL_HID
  280. bfgminer_SOURCES += lowl-hid.c lowl-hid.h
  281. bfgminer_CPPFLAGS += $(hidapi_CFLAGS)
  282. endif
  283. if NEED_BFG_LOWL_MSWIN
  284. bfgminer_SOURCES += lowl-mswin.c lowl-mswin.h
  285. endif
  286. if NEED_BFG_LOWL_PCI
  287. bfgminer_SOURCES += lowl-pci.c lowl-pci.h
  288. if USE_VFIO
  289. sbin_SCRIPTS += setup-vfio
  290. endif
  291. endif
  292. if NEED_BFG_LOWL_SPI
  293. bfgminer_SOURCES += lowl-spi.h lowl-spi.c
  294. endif
  295. bin_PROGRAMS += bfgminer-rpc
  296. bfgminer_rpc_SOURCES = api-example.c
  297. bfgminer_rpc_LDADD = @WS2_LIBS@