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.

231 lines
7.0KB

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