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.

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