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.

212 lines
5.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 -framework CoreAudio -framework CoreMIDI \
  19. -Ldep/lib dep/lib/libglfw3.a dep/lib/libGLEW.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libzip.a dep/lib/libz.a dep/lib/librtaudio.a dep/lib/librtmidi.a dep/lib/libcrypto.a dep/lib/libssl.a dep/lib/libcurl.a
  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. ./$<
  50. debug: $(TARGET)
  51. ifeq ($(ARCH), mac)
  52. lldb -ex run ./$<
  53. endif
  54. ifeq ($(ARCH), win)
  55. gdb -ex run ./$<
  56. endif
  57. ifeq ($(ARCH), lin)
  58. gdb -ex run ./$<
  59. endif
  60. perf: $(TARGET)
  61. ifeq ($(ARCH), lin)
  62. perf record --call-graph dwarf ./Rack
  63. endif
  64. clean:
  65. rm -rfv $(TARGET) libRack.a Rack.res build dist
  66. ifeq ($(ARCH), win)
  67. # For Windows resources
  68. %.res: %.rc
  69. windres $^ -O coff -o $@
  70. endif
  71. # This target is not intended for public use
  72. dist: all
  73. ifndef RELEASE
  74. exit 1 # Must enable RELEASE for dist target
  75. endif
  76. rm -rf dist
  77. # Rack distribution
  78. $(MAKE) -C plugins/Fundamental dist
  79. ifeq ($(ARCH), mac)
  80. mkdir -p $(BUNDLE)
  81. mkdir -p $(BUNDLE)/Contents
  82. mkdir -p $(BUNDLE)/Contents/Resources
  83. cp Info.plist $(BUNDLE)/Contents/
  84. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  85. mkdir -p $(BUNDLE)/Contents/MacOS
  86. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  87. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  88. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  89. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  90. cp -R Bridge/au/dist/VCV-Bridge.component dist/
  91. cp -R Bridge/vst/dist/VCV-Bridge.vst dist/
  92. # Make DMG image
  93. cd dist && ln -s /Applications Applications
  94. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  95. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  96. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  97. endif
  98. ifeq ($(ARCH), win)
  99. mkdir -p dist/Rack
  100. mkdir -p dist/Rack/Bridge
  101. cp Bridge/vst/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
  102. cp Bridge/vst/dist/VCV-Bridge-32.dll dist/Rack/Bridge/
  103. cp -R LICENSE* res dist/Rack/
  104. cp $(TARGET) dist/Rack/
  105. $(STRIP) -s dist/Rack/$(TARGET)
  106. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  107. cp /mingw64/bin/zlib1.dll dist/Rack/
  108. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  109. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  110. cp dep/bin/glew32.dll dist/Rack/
  111. cp dep/bin/glfw3.dll dist/Rack/
  112. cp dep/bin/libcurl-4.dll dist/Rack/
  113. cp dep/bin/libjansson-4.dll dist/Rack/
  114. cp dep/bin/librtmidi-4.dll dist/Rack/
  115. cp dep/bin/libspeexdsp-1.dll dist/Rack/
  116. cp dep/bin/libzip-5.dll dist/Rack/
  117. cp dep/bin/librtaudio.dll dist/Rack/
  118. cp dep/bin/libcrypto-1_1-x64.dll dist/Rack/
  119. cp dep/bin/libssl-1_1-x64.dll dist/Rack/
  120. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  121. # Make ZIP
  122. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  123. # Make NSIS installer
  124. makensis installer.nsi
  125. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  126. endif
  127. ifeq ($(ARCH), lin)
  128. mkdir -p dist/Rack
  129. cp -R LICENSE* res dist/Rack/
  130. cp $(TARGET) dist/Rack/
  131. $(STRIP) -s dist/Rack/$(TARGET)
  132. ldd dist/Rack/$(TARGET)
  133. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  134. # Make ZIP
  135. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  136. endif
  137. # Rack SDK distribution
  138. mkdir -p dist/Rack-SDK
  139. cp LICENSE* dist/Rack-SDK/
  140. cp *.mk dist/Rack-SDK/
  141. cp -R include dist/Rack-SDK/
  142. mkdir -p dist/Rack-SDK/dep/
  143. cp -R dep/include dist/Rack-SDK/dep/
  144. ifeq ($(ARCH), win)
  145. cp libRack.a dist/Rack-SDK/
  146. endif
  147. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  148. # Obviously this will only work if you have the private keys to my server
  149. UPLOAD_URL := vortico@vcvrack.com:files/
  150. upload:
  151. ifeq ($(ARCH), mac)
  152. rsync dist/*.dmg $(UPLOAD_URL) -zP
  153. endif
  154. ifeq ($(ARCH), win)
  155. rsync dist/*.exe $(UPLOAD_URL) -P
  156. rsync dist/*.zip $(UPLOAD_URL) -P
  157. endif
  158. ifeq ($(ARCH), lin)
  159. rsync dist/*.zip $(UPLOAD_URL) -zP
  160. endif
  161. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  162. # Plugin helpers
  163. allplugins:
  164. for f in plugins/*; do $(MAKE) -C "$$f"; done
  165. cleanplugins:
  166. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  167. distplugins:
  168. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  169. plugins:
  170. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  171. # Includes
  172. include compile.mk
  173. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  174. .DEFAULT_GOAL := all