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.

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