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.

204 lines
5.6KB

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