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.

252 lines
7.7KB

  1. RACK_DIR ?= .
  2. VERSION = 0.6.0
  3. FLAGS += \
  4. -Iinclude \
  5. -Idep/include -Idep/lib/libzip/include
  6. ifdef RELEASE
  7. FLAGS += -DRELEASE
  8. endif
  9. include arch.mk
  10. STRIP ?= strip
  11. # Sources and build flags
  12. SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
  13. SOURCES += dep/nanovg/src/nanovg.c
  14. ifeq ($(ARCH), lin)
  15. SOURCES += dep/osdialog/osdialog_gtk2.c
  16. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  17. LDFLAGS += -rdynamic \
  18. -lpthread -lGL -ldl \
  19. $(shell pkg-config --libs gtk+-2.0) \
  20. -Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl
  21. TARGET := Rack
  22. endif
  23. ifeq ($(ARCH), mac)
  24. SOURCES += dep/osdialog/osdialog_mac.m
  25. CXXFLAGS += -stdlib=libc++
  26. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  27. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \
  28. -Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl
  29. TARGET := Rack
  30. BUNDLE := dist/$(TARGET).app
  31. endif
  32. ifeq ($(ARCH), win)
  33. SOURCES += dep/osdialog/osdialog_win.c
  34. LDFLAGS += -static-libgcc -static-libstdc++ -lpthread -lws2_32 \
  35. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  36. -lgdi32 -lopengl32 -lcomdlg32 -lole32 \
  37. -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl \
  38. -Wl,-Bstatic -ljansson -lspeexdsp
  39. TARGET := Rack.exe
  40. OBJECTS += Rack.res
  41. endif
  42. # Convenience targets
  43. all: dep $(TARGET)
  44. dep:
  45. $(MAKE) -C dep
  46. run: $(TARGET)
  47. ifeq ($(ARCH), lin)
  48. LD_LIBRARY_PATH=dep/lib ./$<
  49. endif
  50. ifeq ($(ARCH), mac)
  51. DYLD_FALLBACK_LIBRARY_PATH=dep/lib ./$<
  52. endif
  53. ifeq ($(ARCH), win)
  54. env PATH="$(PATH)":dep/bin ./$<
  55. endif
  56. debug: $(TARGET)
  57. ifeq ($(ARCH), lin)
  58. LD_LIBRARY_PATH=dep/lib gdb -ex run ./Rack
  59. endif
  60. ifeq ($(ARCH), mac)
  61. DYLD_FALLBACK_LIBRARY_PATH=dep/lib gdb -ex run ./Rack
  62. endif
  63. ifeq ($(ARCH), win)
  64. env PATH="$(PATH)":dep/bin gdb -ex run ./Rack
  65. endif
  66. perf: $(TARGET)
  67. ifeq ($(ARCH), lin)
  68. LD_LIBRARY_PATH=dep/lib perf record --call-graph dwarf ./Rack
  69. endif
  70. clean:
  71. rm -rfv $(TARGET) libRack.a Rack.res build dist
  72. ifeq ($(ARCH), win)
  73. # For Windows resources
  74. %.res: %.rc
  75. windres $^ -O coff -o $@
  76. endif
  77. # This target is not intended for public use
  78. dist: all
  79. ifndef RELEASE
  80. exit 1 # Must enable RELEASE for dist target
  81. endif
  82. rm -rf dist
  83. # Rack distribution
  84. $(MAKE) -C plugins/Fundamental dist
  85. ifeq ($(ARCH), mac)
  86. mkdir -p $(BUNDLE)
  87. mkdir -p $(BUNDLE)/Contents
  88. mkdir -p $(BUNDLE)/Contents/Resources
  89. cp Info.plist $(BUNDLE)/Contents/
  90. cp -R LICENSE* res $(BUNDLE)/Contents/Resources
  91. mkdir -p $(BUNDLE)/Contents/MacOS
  92. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  93. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  94. cp icon.icns $(BUNDLE)/Contents/Resources/
  95. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  96. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  97. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  98. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  99. cp dep/lib/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/
  100. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  101. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  102. cp dep/lib/librtaudio.dylib $(BUNDLE)/Contents/MacOS/
  103. cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/
  104. cp dep/lib/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/
  105. cp dep/lib/libssl.1.1.dylib $(BUNDLE)/Contents/MacOS/
  106. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  107. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  108. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  109. install_name_tool -change $(PWD)/dep/lib/libspeexdsp.1.dylib @executable_path/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  110. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  111. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  112. install_name_tool -change librtaudio.dylib @executable_path/librtaudio.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  113. install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  114. install_name_tool -change $(PWD)/dep/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  115. install_name_tool -change $(PWD)/dep/lib/libssl.1.1.dylib @executable_path/libssl.1.1.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  116. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  117. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  118. cp -R Bridge/au/dist/VCV-Bridge.component dist/
  119. cp -R Bridge/vst/dist/VCV-Bridge.vst dist/
  120. # Make DMG image
  121. cd dist && ln -s /Applications Applications
  122. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  123. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  124. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  125. endif
  126. ifeq ($(ARCH), win)
  127. mkdir -p dist/Rack
  128. mkdir -p dist/Rack/Bridge
  129. cp Bridge/vst/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
  130. cp Bridge/vst/dist/VCV-Bridge-32.dll dist/Rack/Bridge/
  131. cp -R LICENSE* res dist/Rack/
  132. cp $(TARGET) dist/Rack/
  133. $(STRIP) -s dist/Rack/$(TARGET)
  134. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  135. cp /mingw64/bin/zlib1.dll dist/Rack/
  136. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  137. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  138. cp dep/bin/glew32.dll dist/Rack/
  139. cp dep/bin/glfw3.dll dist/Rack/
  140. cp dep/bin/libcurl-4.dll dist/Rack/
  141. cp dep/bin/libjansson-4.dll dist/Rack/
  142. cp dep/bin/librtmidi-4.dll dist/Rack/
  143. cp dep/bin/libspeexdsp-1.dll dist/Rack/
  144. cp dep/bin/libzip-5.dll dist/Rack/
  145. cp dep/bin/librtaudio.dll dist/Rack/
  146. cp dep/bin/libcrypto-1_1-x64.dll dist/Rack/
  147. cp dep/bin/libssl-1_1-x64.dll dist/Rack/
  148. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  149. # Make ZIP
  150. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  151. # Make NSIS installer
  152. makensis installer.nsi
  153. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  154. endif
  155. ifeq ($(ARCH), lin)
  156. mkdir -p dist/Rack
  157. cp -R LICENSE* res dist/Rack/
  158. cp $(TARGET) Rack.sh dist/Rack/
  159. $(STRIP) -s dist/Rack/$(TARGET)
  160. cp dep/lib/libspeexdsp.so dist/Rack/
  161. cp dep/lib/libjansson.so.4 dist/Rack/
  162. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  163. cp dep/lib/libglfw.so.3 dist/Rack/
  164. cp dep/lib/libcurl.so.4 dist/Rack/
  165. cp dep/lib/libzip.so.5 dist/Rack/
  166. cp dep/lib/librtaudio.so dist/Rack/
  167. cp dep/lib/librtmidi.so.4 dist/Rack/
  168. cp dep/lib/libssl.so.1.1 dist/Rack/
  169. cp dep/lib/libcrypto.so.1.1 dist/Rack/
  170. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  171. # Make ZIP
  172. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  173. endif
  174. # Rack SDK distribution
  175. mkdir -p dist/Rack-SDK
  176. cp LICENSE* dist/Rack-SDK/
  177. cp *.mk dist/Rack-SDK/
  178. cp -R include dist/Rack-SDK/
  179. mkdir -p dist/Rack-SDK/dep/
  180. cp -R dep/include dist/Rack-SDK/dep/
  181. ifeq ($(ARCH), win)
  182. cp libRack.a dist/Rack-SDK/
  183. endif
  184. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  185. # Obviously this will only work if you have the private keys to my server
  186. UPLOAD_URL := vortico@vcvrack.com:files/
  187. upload:
  188. ifeq ($(ARCH), mac)
  189. rsync dist/*.dmg $(UPLOAD_URL) -zP
  190. endif
  191. ifeq ($(ARCH), win)
  192. rsync dist/*.exe $(UPLOAD_URL) -P
  193. rsync dist/*.zip $(UPLOAD_URL) -P
  194. endif
  195. ifeq ($(ARCH), lin)
  196. rsync dist/*.zip $(UPLOAD_URL) -zP
  197. endif
  198. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  199. # Plugin helpers
  200. allplugins:
  201. for f in plugins/*; do $(MAKE) -C "$$f"; done
  202. cleanplugins:
  203. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  204. distplugins:
  205. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  206. plugins:
  207. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  208. # Includes
  209. include compile.mk
  210. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  211. .DEFAULT_GOAL := all