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.

211 lines
5.5KB

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