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.

206 lines
5.5KB

  1. RACK_DIR ?= .
  2. VERSION = 1.dev.$(shell git rev-parse --short HEAD)
  3. FLAGS += -DVERSION=$(VERSION)
  4. FLAGS += -Iinclude
  5. FLAGS += -Idep/include -Idep/lib/libzip/include
  6. include arch.mk
  7. SED := perl -pi -e
  8. # Sources and build flags
  9. SOURCES += dep/nanovg/src/nanovg.c
  10. SOURCES += dep/osdialog/osdialog.c
  11. SOURCES += $(wildcard dep/jpommier-pffft-*/pffft.c) $(wildcard dep/jpommier-pffft-*/fftpack.c)
  12. SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
  13. ifdef ARCH_MAC
  14. SOURCES += dep/osdialog/osdialog_mac.m
  15. LDFLAGS += -lpthread -ldl \
  16. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  17. -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
  18. TARGET := Rack
  19. BUNDLE := dist/$(TARGET).app
  20. endif
  21. ifdef ARCH_WIN
  22. SOURCES += dep/osdialog/osdialog_win.c
  23. LDFLAGS += -static \
  24. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  25. -Ldep/lib -lglew32 -lglfw3 -ljansson -lspeexdsp -lzip -lz -lcurl -lssl -lcrypto -lrtaudio -lrtmidi \
  26. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
  27. TARGET := Rack.exe
  28. OBJECTS += Rack.res
  29. endif
  30. ifdef ARCH_LIN
  31. SOURCES += dep/osdialog/osdialog_gtk2.c
  32. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  33. LDFLAGS += -rdynamic \
  34. -Ldep/lib \
  35. -Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
  36. -Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
  37. $(shell pkg-config --libs gtk+-2.0)
  38. TARGET := Rack
  39. endif
  40. # Convenience targets
  41. all: $(TARGET)
  42. dep:
  43. $(MAKE) -C dep
  44. run: $(TARGET)
  45. ./$< -d
  46. runr: $(TARGET)
  47. ./$<
  48. debug: $(TARGET)
  49. ifdef ARCH_MAC
  50. lldb --args ./$< -d
  51. endif
  52. ifdef ARCH_WIN
  53. gdb --args ./$< -d
  54. endif
  55. ifdef ARCH_LIN
  56. gdb --args ./$< -d
  57. endif
  58. perf: $(TARGET)
  59. # Requires gperftools
  60. perf record --call-graph dwarf -o perf.data ./$< -d
  61. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  62. # hotspot perf.data
  63. valgrind: $(TARGET)
  64. # --gen-suppressions=yes
  65. # --leak-check=full
  66. valgrind --suppressions=valgrind.supp ./$< -d
  67. clean:
  68. rm -rfv $(TARGET) libRack.a Rack.res build dist
  69. ifdef ARCH_WIN
  70. # For Windows resources
  71. %.res: %.rc
  72. windres $^ -O coff -o $@
  73. endif
  74. # This target is not intended for public use
  75. dist: $(TARGET)
  76. rm -rf dist
  77. mkdir -p dist
  78. $(MAKE) -C plugins/Fundamental dist
  79. ifdef ARCH_LIN
  80. mkdir -p dist/Rack
  81. cp $(TARGET) dist/Rack/
  82. $(STRIP) -s dist/Rack/$(TARGET)
  83. cp -R LICENSE* res template.vcv dist/Rack/
  84. # Manually check that no nonstandard shared libraries are linked
  85. ldd dist/Rack/$(TARGET)
  86. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  87. mkdir -p dist/Rack/Bridge
  88. # cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
  89. # Make ZIP
  90. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  91. endif
  92. ifdef ARCH_MAC
  93. mkdir -p $(BUNDLE)
  94. mkdir -p $(BUNDLE)/Contents
  95. cp Info.plist $(BUNDLE)/Contents/
  96. $(SED) 's/{VERSION}/$(VERSION)/g' $(BUNDLE)/Contents/Info.plist
  97. mkdir -p $(BUNDLE)/Contents/MacOS
  98. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  99. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  100. mkdir -p $(BUNDLE)/Contents/Resources
  101. cp -R LICENSE* res template.vcv icon.icns $(BUNDLE)/Contents/Resources
  102. # Manually check that no nonstandard shared libraries are linked
  103. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  104. cp plugins/Fundamental/dist/*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  105. # cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  106. # cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  107. # cp -R Bridge/VST/dist/VCV-Bridge-fx.vst dist/
  108. # Make DMG image
  109. cd dist && ln -s /Applications Applications
  110. # cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  111. # cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  112. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  113. endif
  114. ifdef ARCH_WIN
  115. mkdir -p dist/Rack
  116. cp $(TARGET) dist/Rack/
  117. $(STRIP) -s dist/Rack/$(TARGET)
  118. cp -R LICENSE* res template.vcv dist/Rack/
  119. # cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  120. # cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  121. # cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  122. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  123. # mkdir -p dist/Rack/Bridge
  124. # cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
  125. # Make ZIP
  126. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  127. # Make NSIS installer
  128. # pacman -S mingw-w64-x86_64-nsis
  129. # makensis installer.nsi
  130. # mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  131. endif
  132. # Rack SDK
  133. mkdir -p dist/Rack-SDK
  134. cp LICENSE* dist/Rack-SDK/
  135. cp *.mk dist/Rack-SDK/
  136. cp -R include dist/Rack-SDK/
  137. mkdir -p dist/Rack-SDK/dep/
  138. cp -R dep/include dist/Rack-SDK/dep/
  139. ifdef ARCH_WIN
  140. cp libRack.a dist/Rack-SDK/
  141. endif
  142. cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).zip Rack-SDK
  143. # Obviously this will only work if you have the private keys to my server
  144. UPLOAD_URL := vortico@vcvrack.com:files/
  145. upload:
  146. ifdef ARCH_MAC
  147. rsync dist/*.{dmg,zip} $(UPLOAD_URL) -zP
  148. endif
  149. ifdef ARCH_WIN
  150. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  151. endif
  152. ifdef ARCH_LIN
  153. rsync dist/*.zip $(UPLOAD_URL) -zP
  154. endif
  155. # Plugin helpers
  156. plugins:
  157. for f in plugins/*; do $(MAKE) -C "$$f"; done
  158. cleanplugins:
  159. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  160. distplugins:
  161. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  162. cmdplugins:
  163. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  164. # Includes
  165. include compile.mk
  166. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  167. .DEFAULT_GOAL := all