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.

415 lines
9.8KB

  1. #
  2. # Common makefile include for tks-source and plugins
  3. # (requires MSYS shell, MSVC and GNU make)
  4. #
  5. # n=32bit build ("x86", jit)
  6. # y=64bit build ("amd64", no jit)
  7. BUILD_64=y
  8. MK=msvc
  9. # invalid path, will be overwritten later on
  10. LIB_INSTALL_PREFIX=/f/git/VeeSeeVSTRack/dep/lib/msvc/
  11. # y=use Windows 10 SDK
  12. # n=use Windows 7 SDK
  13. ifeq ($(BUILD_64),y)
  14. HAVE_WIN10=y
  15. else
  16. HAVE_WIN10=n
  17. endif
  18. #
  19. # Where to install tks
  20. # (creates
  21. # $(TKS_SITE_PREFIX)/plugins
  22. # $(TKS_SITE_PREFIX)/libraries
  23. # $(TKS_SITE_PREFIX)/applications
  24. # $(TKS_SITE_PREFIX)/modules
  25. # directories,
  26. # copies tks.exe to $(TKS_SITE_PREFIX)/tks.exe
  27. # )
  28. #
  29. ifeq ($(BUILD_64),y)
  30. TKS_PREFIX=/c/Program Files/tks
  31. else
  32. TKS_PREFIX=/c/Program Files (x86)/tks
  33. endif
  34. TKS_SITE_PREFIX=$(TKS_PREFIX)
  35. # Target installation paths for executable and libraries/plugins/modules
  36. # (also used to build "tks.sh" startup script, see tks-source/install.tks)
  37. # (these vars must NOT be prefixed by $CROSS_ROOT)
  38. TKS_TARGET_PREFIX=$(TKS_PREFIX)
  39. TKS_TARGET_SITE_PREFIX=$(TKS_SITE_PREFIX)
  40. #
  41. # Number of parallel targets to make
  42. #
  43. NUMJOBS=$(NUMBER_OF_PROCESSORS)
  44. #NUMJOBS=4
  45. #
  46. # Set to 'y' to use shared "msvcrtXX.dll"
  47. # (decreases file size considerably but requires the user to have e.g. msvcrt90.dll
  48. # installed)
  49. # (if unsure, choose 'y')
  50. #
  51. #USE_SHARED_MSVCRT=y
  52. USE_SHARED_MSVCRT=n
  53. #
  54. # Set this to != 'n' to use VC/Platform libs from WinDDK
  55. # (requires USE_SHARED_MSVCRT=y)
  56. # (This is used to get of the "dll hell" msvcrtXX.dll dependencies)
  57. # (this disables compiler security checks because _security_check_cookie()
  58. # does not seem to be exported by this version of msvcrt)
  59. #
  60. #WINDDK_PATH=f:/dev/winddk_msvcrt/3790.1830
  61. # needs Windows Driver Kit Version 7.1.0
  62. WINDDK_PATH=c:/WinDDK/7600.16385.1
  63. #WINDDK_PATH=n
  64. #
  65. # Set to 'y' to use shared "zlib1.dll"
  66. # (otherwise compile and statically link zlib sources)
  67. # (if unsure, choose 'y' because zlib is also used by the tkopengl plugin)
  68. #
  69. ifeq ($(BUILD_64),y)
  70. USE_SHARED_ZLIB=y
  71. else
  72. USE_SHARED_ZLIB=n
  73. endif
  74. #
  75. # Set to 'y' to use shared libpng.dll
  76. # (otherwise compile and statically link libpng sources)
  77. # (actually you need to keep this set to 'n' on Win32
  78. # since the official libpng Win32 binaries are for GCC
  79. # and I've been too lazy to build the .dll myself ._°)
  80. #
  81. ifeq ($(BUILD_64),y)
  82. USE_SHARED_LIBPNG=n
  83. else
  84. USE_SHARED_LIBPNG=n
  85. endif
  86. #
  87. # Common source directory for 3rd party libs (libpng, zlib)
  88. #
  89. # Now this is a bit tricky: The directory name MUST use the
  90. # MSDOS style drive:/path naming convention, NOT the MSYS
  91. # /drive/path one! (required by the MSVC compiler)
  92. #
  93. OTHER_SRC=f:/sources
  94. #
  95. # Path to zlib sources (required if USE_SHARED_ZLIB != y)
  96. # (zlib123.zip distribution)
  97. # (note) [19Jan2018] superceded by tks-source/zlib-1.2.11/ in windows build
  98. #
  99. ZLIB_SRC=$(OTHER_SRC)/zlib123
  100. #
  101. # Path to zlib binaries (required if USE_SHARED_ZLIB=y)
  102. # (zlib123-dll.zip distribution)
  103. # (note) [19Jan2018] superceded by tks-source/zlib-1.2.11/ in windows build
  104. #
  105. ZLIB_BIN=$(OTHER_SRC)/zlib123-dll
  106. #
  107. # Path to libpng sources (required if USE_SHARED_LIBPNG != y)
  108. # (lpng1235.zip)
  109. # (Note: you may need to fix "fileno" to "_fileno" in pngwio.c:140
  110. # because of ISO-C++ compliance)
  111. #
  112. LIBPNG_SRC=$(OTHER_SRC)/lpng1235
  113. #
  114. # Set this to the Visual Studio installation directory.
  115. # Includes/libraries will be searched in $VCTK/include and $VCTK/lib
  116. #
  117. #VCTK=c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC
  118. VCTK=c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC
  119. #
  120. # Set this to the Windows Kits paths that contains the standard header and ucrt lib files
  121. # (installed by Visual Studio 15)
  122. # Note: not needed when using older version of VC
  123. #
  124. WINKITS_INC=$(VCTK)/../../Windows Kits/10/Include/10.0.10240.0/ucrt/
  125. ifeq ($(BUILD_64),y)
  126. WINKITS_LIB=$(VCTK)/../../Windows Kits/10/Lib/10.0.10240.0/ucrt/x64/
  127. else
  128. WINKITS_LIB=$(VCTK)/../../Windows Kits/10/Lib/10.0.10240.0/ucrt/x86/
  129. endif
  130. #
  131. # Set this to the platform SDK installation directory
  132. #
  133. ifeq ($(HAVE_WIN10),y)
  134. W32API_INC=C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um
  135. ifeq ($(BUILD_64),y)
  136. W32API_LIB=C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x64
  137. else
  138. W32API_LIB=C:/Program Files (x86)/Windows Kits/10/Lib/10.0.16299.0/um/x86
  139. endif
  140. else
  141. #W32API=d:/Programme/Microsoft Platform SDK
  142. #W32API=f:/fli/tools/dev/MSVCTK2003/w32api
  143. #W32API=c:/Programme/Microsoft Platform SDK
  144. #W32API=c:/Program Files/Microsoft SDKs/Windows/v6.0a
  145. W32API=c:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A
  146. W32API_INC=$(W32API)/include
  147. ifeq ($(BUILD_64),y)
  148. W32API_LIB=$(W32API)/lib/x64
  149. else
  150. W32API_LIB=$(W32API)/lib
  151. endif
  152. endif
  153. #
  154. # Set this to the DirectX SDK installation directory
  155. #
  156. #DXSDK_LIB=f:/fli/tools/dev/MSVCTK2003/w32api/lib
  157. #DXSDK_LIB=c:/Programme/Microsoft DirectX SDK (December 2005)/lib/x86
  158. #DXSDK_LIB='c:/Programme/Microsoft DirectX SDK (August 2006)/Lib/x86'
  159. #DXSDK_LIB=c:/Program Files/Microsoft DirectX SDK (August 2008)/Lib/x86
  160. ifeq ($(BUILD_64),y)
  161. DXSDK_LIB=c:/Program Files (x86)/Microsoft DirectX SDK (August 2008)/Lib/x64
  162. else
  163. DXSDK_LIB=c:/Program Files (x86)/Microsoft DirectX SDK (August 2008)/Lib/x86
  164. endif
  165. #DXSDK_LIB=C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86
  166. #DXSDK_INC=f:/fli/tools/dev/MSVCTK2003/w32api/include
  167. #DXSDK_INC=c:/Programme/Microsoft DirectX SDK (December 2005)/include
  168. #DXSDK_INC='c:/Programme/Microsoft DirectX SDK (August 2006)/Include'
  169. #DXSDK_INC=c:/Program Files/Microsoft DirectX SDK (August 2008)/Include
  170. DXSDK_INC=c:/Program Files (x86)/Microsoft DirectX SDK (August 2008)/Include
  171. #DXSDK_INC=C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include
  172. #
  173. # Tool setup
  174. #
  175. ifeq ($(BUILD_64),y)
  176. CC = "$(VCTK)/bin/amd64/cl.exe"
  177. LD = "$(VCTK)/bin/amd64/link.exe"
  178. LIB = "$(VCTK)/bin/amd64/lib.exe"
  179. else
  180. CC = "$(VCTK)/bin/cl.exe"
  181. LD = "$(VCTK)/bin/link.exe"
  182. LIB = "$(VCTK)/bin/lib.exe"
  183. endif
  184. CP = cp -f
  185. MAKE = make
  186. FIND = /c/msys/1.0/bin/find.exe
  187. MKDIR = mkdir -p
  188. RM = rm -f
  189. SED = sed
  190. TKS = "$(TKS_PREFIX)/tks"
  191. ZIP = zip
  192. MD5SUM = md5sum
  193. #
  194. # UPX binary [optional]
  195. # (Note: UPX303w crashes without -q option during parallel build (-j 4))
  196. #
  197. #UPX=/h/fli/tools/dev/upx304w/upx.exe -q
  198. UPX=/f/fli/tools/dev/upx303w/upx.exe -q
  199. #
  200. # C compiler flags
  201. #
  202. #CFLAGS= -nologo -W3 -Zp8 -GR- -EHs-c- -D_CRT_SECURE_NO_DEPRECATE -DWIN32 -MP4
  203. CFLAGS= -nologo -W3 -Zp8 -EHs-c- -D_CRT_SECURE_NO_DEPRECATE -DWIN32
  204. #CFLAGS += /arch:SSE3
  205. #CFLAGS += -arch:AVX2
  206. CFLAGS += -wo4250
  207. #-GR-
  208. ifeq ($(BUILD_64),y)
  209. CFLAGS+= -DBUILD_64
  210. endif
  211. CFLAGS+= -I"$(WINKITS_INC)"
  212. # workaround for windows sdk sal_supp.h __useHeader/__on_failure macro redefinitions
  213. CFLAGS += -D_USING_V110_SDK71_
  214. #-MP4
  215. #-fp:fast
  216. ####CFLAGS= -nologo -W3 -Zp8 -GR- -EHs-c- -D_CRT_SECURE_NO_DEPRECATE -DWIN32 -MT -MP4
  217. ####CFLAGS= -nologo -W3 -Zp8 -GR- -D_CRT_SECURE_NO_DEPRECATE -DWIN32 -MD -MP4
  218. #
  219. # C++ compiler flags
  220. #
  221. CPPFLAGS= $(CFLAGS)
  222. CPPFLAGS+= -I"$(WINKITS_INC)"
  223. #
  224. # Default linker flags
  225. #
  226. LDFLAGS= -INCREMENTAL:NO -VERSION:0.9
  227. #LDFLAGS= -INCREMENTAL:NO -MACHINE:X86 -VERSION:0.9 -DEBUG -FIXED:NO
  228. ifeq ($(BUILD_64),y)
  229. LDFLAGS += -MACHINE:X64
  230. else
  231. LDFLAGS += -MACHINE:X86
  232. endif
  233. #
  234. # Size optimization linker flags (used by plugins)
  235. #
  236. LDFLAGS_SIZE=
  237. #LDFLAGS_SIZE= -MACHINE:X86 -VERSION:0.9 -OPT:REF -OPT:ICF=10 -LTCG -INCREMENTAL:NO -NOASSEMBLY -SUBSYSTEM:CONSOLE
  238. #####-FORCE
  239. #####-NODEFAULTLIB:LIBCMT
  240. #####-OPT:NOWIN98 -NODEFAULTLIB
  241. #
  242. # Extra includes
  243. #
  244. EXTRA_INCLUDES=
  245. #
  246. # Extra library paths
  247. #
  248. EXTRA_LIBS=
  249. EXTRA_LIBS+= -LIBPATH:"$(WINKITS_LIB)"
  250. #
  251. # Default Optimization flags
  252. #
  253. OPTFLAGS= -Ox -Ot
  254. #OPTFLAGS= -Od -D_DEBUG
  255. #-Ox
  256. #OPTFLAGS = /Os /O1
  257. #/Oy
  258. #/fp:strict /GS-
  259. #
  260. # Size optimization flags (used by plugins)
  261. #
  262. OPTFLAGS_SIZE= -Os -GL -GF -Gy -GA
  263. #
  264. # Which flags to use for plugins
  265. #
  266. #OPTFLAGS_PLUGIN = $(OPTFLAGS_SIZE)
  267. OPTFLAGS_PLUGIN = $(OPTFLAGS)
  268. #
  269. # Debug flags
  270. #
  271. DBGFLAGS=
  272. #
  273. # Do not define if msvcrt is missing hypotf() (old versions only)
  274. # Set to 'y' if it has.
  275. #
  276. #HAVE_HYPOTF=y
  277. #
  278. # Nothing to change after this line-----------------------------
  279. #
  280. CFLAGS+= $(EXTRA_INCLUDES) $(DBGFLAGS)
  281. CPPFLAGS+= $(EXTRA_INCLUDES) $(DBGFLAGS)
  282. LDFLAGS+= $(EXTRA_LIBS)
  283. # hack for portaudio plugin
  284. # (uses alloca resulting in unresolved __alloca_probe_16 reference)
  285. ifeq ($(FORCE_NO_WINDDK),y)
  286. WINDDK_PATH=n
  287. endif
  288. ifeq ($(USE_SHARED_MSVCRT),y)
  289. # link runtime libs dynamically..
  290. SHARED_MSVCRT_CFLAGS = -MD
  291. ifneq ($(WINDDK_PATH),n)
  292. # ..using WinDDK
  293. ifeq ($(BUILD_64),y)
  294. SHARED_MSVCRT_LDFLAGS = -LIBPATH:"$(WINDDK_PATH)/lib/crt/amd64" -LIBPATH:"$(WINDDK_PATH)/lib/win7/amd64"
  295. else
  296. SHARED_MSVCRT_LDFLAGS = -LIBPATH:"$(WINDDK_PATH)/lib/crt/i386" -LIBPATH:"$(WINDDK_PATH)/lib/wxp/i386"
  297. endif # BUILD_64
  298. SHARED_MSVCRT_LDFLAGS += msvcrt.lib kernel32.lib bufferoverflow.lib ntdll.lib
  299. # (note) inc/wxp does not exist in WinDDK 7.1.0
  300. SHARED_MSVCRT_CFLAGS += -I"$(WINDDK_PATH)/inc/crt" -I"$(WINDDK_PATH)/inc/wxp" -QIfist -DDX_NEED_FPUFIX
  301. else
  302. # ..using VC install + Platform SDK
  303. SHARED_MSVCRT_LDFLAGS = -LIBPATH:"$(W32API_LIB)" msvcrt.lib kernel32.lib
  304. #-LIBPATH:"$(VCTK)/lib"
  305. SHARED_MSVCRT_CFLAGS += -I"$(VCTK)/include" -I"$(W32API_INC)"
  306. endif # WINDDK_PATH
  307. else
  308. # link runtime libs statically
  309. ifeq ($(TKS_LIB),y)
  310. ifeq ($(TKS_LIB_DEBUG),y)
  311. SHARED_MSVCRT_CFLAGS = -MDd
  312. else
  313. SHARED_MSVCRT_CFLAGS = -MD
  314. endif
  315. else
  316. SHARED_MSVCRT_CFLAGS = -MT
  317. endif
  318. SHARED_MSVCRT_CFLAGS += -I"$(VCTK)/include" -I"$(W32API_INC)"
  319. ifeq ($(BUILD_64),y)
  320. SHARED_MSVCRT_LDFLAGS = -LIBPATH:"$(VCTK)/lib/amd64" -LIBPATH:"$(W32API_LIB)"
  321. else
  322. SHARED_MSVCRT_LDFLAGS = -LIBPATH:"$(VCTK)/lib" -LIBPATH:"$(W32API_LIB)"
  323. endif # BUILD_64
  324. endif # USE_SHARED_MSVCRT
  325. LDFLAGS += $(SHARED_MSVCRT_LDFLAGS)
  326. LDFLAGS_SIZE += $(SHARED_MSVCRT_LDFLAGS)
  327. CFLAGS += $(SHARED_MSVCRT_CFLAGS)
  328. CPPFLAGS += $(SHARED_MSVCRT_CFLAGS)
  329. # for plugins only:
  330. LDFLAGS_SIZE += -LIBPATH:"$(WINKITS_LIB)"
  331. #
  332. # HYPOTF emulation (tkmath)
  333. #
  334. ifeq ($(HAVE_HYPOTF),y)
  335. CFLAGS += -DHAVE_HYPOTF
  336. CPPFLAGS += -DHAVE_HYPOTF
  337. endif