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.

244 lines
7.4KB

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