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.

238 lines
7.1KB

  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. 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 += -DAPPLE -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. dist: all
  77. rm -rf dist
  78. # Rack distribution
  79. $(MAKE) -C plugins/Fundamental dist
  80. ifeq ($(ARCH), mac)
  81. mkdir -p $(BUNDLE)
  82. mkdir -p $(BUNDLE)/Contents
  83. mkdir -p $(BUNDLE)/Contents/Resources
  84. cp Info.plist $(BUNDLE)/Contents/
  85. cp -R LICENSE* res $(BUNDLE)/Contents/Resources
  86. mkdir -p $(BUNDLE)/Contents/MacOS
  87. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  88. strip $(BUNDLE)/Contents/MacOS/$(TARGET)
  89. cp icon.icns $(BUNDLE)/Contents/Resources/
  90. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  91. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  92. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  93. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  94. cp dep/lib/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/
  95. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  96. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  97. cp dep/lib/librtaudio.dylib $(BUNDLE)/Contents/MacOS/
  98. cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/
  99. cp dep/lib/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/
  100. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  101. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  102. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  103. install_name_tool -change $(PWD)/dep/lib/libspeexdsp.1.dylib @executable_path/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  104. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  105. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  106. install_name_tool -change librtaudio.dylib @executable_path/librtaudio.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  107. install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  108. install_name_tool -change $(PWD)/dep/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/$(TARGET)
  109. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  110. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  111. # Make DMG image
  112. cd dist && ln -s /Applications Applications
  113. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  114. endif
  115. ifeq ($(ARCH), win)
  116. mkdir -p dist/Rack
  117. cp -R LICENSE* res dist/Rack/
  118. cp $(TARGET) dist/Rack/
  119. strip dist/Rack/$(TARGET)
  120. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  121. cp /mingw64/bin/zlib1.dll dist/Rack/
  122. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  123. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  124. cp dep/bin/glew32.dll dist/Rack/
  125. cp dep/bin/glfw3.dll dist/Rack/
  126. cp dep/bin/libcurl-4.dll dist/Rack/
  127. cp dep/bin/libjansson-4.dll dist/Rack/
  128. cp dep/bin/librtmidi-4.dll dist/Rack/
  129. cp dep/bin/libspeexdsp-1.dll dist/Rack/
  130. cp dep/bin/libzip-5.dll dist/Rack/
  131. cp dep/bin/librtaudio.dll dist/Rack/
  132. cp dep/bin/libcrypto-1_1-x64.dll dist/Rack/
  133. cp dep/bin/libssl-1_1-x64.dll dist/Rack/
  134. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  135. # Make ZIP
  136. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  137. # Make NSIS installer
  138. makensis installer.nsi
  139. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  140. endif
  141. ifeq ($(ARCH), lin)
  142. mkdir -p dist/Rack
  143. cp -R LICENSE* res dist/Rack/
  144. cp $(TARGET) Rack.sh dist/Rack/
  145. strip dist/Rack/$(TARGET)
  146. cp dep/lib/libspeexdsp.so dist/Rack/
  147. cp dep/lib/libjansson.so.4 dist/Rack/
  148. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  149. cp dep/lib/libglfw.so.3 dist/Rack/
  150. cp dep/lib/libcurl.so.4 dist/Rack/
  151. cp dep/lib/libzip.so.5 dist/Rack/
  152. cp dep/lib/librtaudio.so dist/Rack/
  153. cp dep/lib/librtmidi.so.4 dist/Rack/
  154. cp dep/lib/libssl.so.1.1 dist/Rack/
  155. cp dep/lib/libcrypto.so.1.1 dist/Rack/
  156. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  157. # Make ZIP
  158. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  159. endif
  160. # Rack SDK distribution
  161. mkdir -p dist/Rack-SDK
  162. cp LICENSE* dist/Rack-SDK/
  163. cp *.mk dist/Rack-SDK/
  164. cp -R include dist/Rack-SDK/
  165. mkdir -p dist/Rack-SDK/dep/
  166. cp -R dep/include dist/Rack-SDK/dep/
  167. ifeq ($(ARCH), win)
  168. cp libRack.a dist/Rack-SDK/
  169. endif
  170. cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).zip Rack-SDK
  171. # Obviously this will only work if you have the private keys to my server
  172. UPLOAD_URL := vortico@vcvrack.com:files/
  173. upload: dist distplugins
  174. ifeq ($(ARCH), mac)
  175. rsync dist/*.dmg $(UPLOAD_URL) -zP
  176. endif
  177. ifeq ($(ARCH), win)
  178. rsync dist/*.exe $(UPLOAD_URL) -P
  179. rsync dist/*.zip $(UPLOAD_URL) -P
  180. endif
  181. ifeq ($(ARCH), lin)
  182. rsync dist/*.zip $(UPLOAD_URL) -zP
  183. endif
  184. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  185. # Plugin helpers
  186. allplugins:
  187. for f in plugins/*; do $(MAKE) -C "$$f"; done
  188. cleanplugins:
  189. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  190. distplugins:
  191. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  192. plugins:
  193. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  194. # Includes
  195. include compile.mk
  196. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  197. .DEFAULT_GOAL := all