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.

199 lines
5.1KB

  1. RACK_DIR ?= .
  2. VERSION = 0.6.1dev
  3. FLAGS += \
  4. -Iinclude \
  5. -Idep/include -Idep/lib/libzip/include
  6. include arch.mk
  7. STRIP ?= strip
  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. CXXFLAGS += -stdlib=libc++
  16. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  17. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  18. -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
  19. TARGET := Rack
  20. BUNDLE := dist/$(TARGET).app
  21. endif
  22. ifdef ARCH_WIN
  23. SOURCES += dep/osdialog/osdialog_win.c
  24. LDFLAGS += -static \
  25. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  26. -Ldep/lib -lglew32 -lglfw3 -ljansson -lspeexdsp -lzip -lz -lcurl -lssl -lcrypto -lrtaudio -lrtmidi \
  27. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi
  28. TARGET := Rack.exe
  29. OBJECTS += Rack.res
  30. endif
  31. ifdef ARCH_LIN
  32. SOURCES += dep/osdialog/osdialog_gtk2.c
  33. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  34. LDFLAGS += -rdynamic \
  35. -Ldep/lib \
  36. -Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
  37. -Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
  38. $(shell pkg-config --libs gtk+-2.0)
  39. TARGET := Rack
  40. endif
  41. # Convenience targets
  42. all: dep $(TARGET)
  43. dep:
  44. $(MAKE) -C dep
  45. run: $(TARGET)
  46. ./$< -d
  47. runr: $(TARGET)
  48. ./$<
  49. debug: $(TARGET)
  50. ifdef ARCH_MAC
  51. lldb -ex run ./$< -d
  52. endif
  53. ifdef ARCH_WIN
  54. gdb -ex run ./$< -d
  55. endif
  56. ifdef ARCH_LIN
  57. gdb -ex run ./$< -d
  58. endif
  59. perf: $(TARGET)
  60. ifdef ARCH_LIN
  61. perf record --call-graph dwarf ./$< -d
  62. endif
  63. clean:
  64. rm -rfv $(TARGET) libRack.a Rack.res build dist
  65. ifdef 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. rm -rf dist
  73. # Rack distribution
  74. $(MAKE) -C plugins/Fundamental dist
  75. ifdef ARCH_MAC
  76. mkdir -p $(BUNDLE)
  77. mkdir -p $(BUNDLE)/Contents
  78. mkdir -p $(BUNDLE)/Contents/Resources
  79. cp Info.plist $(BUNDLE)/Contents/
  80. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  81. mkdir -p $(BUNDLE)/Contents/MacOS
  82. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  83. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  84. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  85. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  86. cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  87. cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  88. # Make DMG image
  89. cd dist && ln -s /Applications Applications
  90. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  91. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  92. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  93. endif
  94. ifdef ARCH_WIN
  95. mkdir -p dist/Rack
  96. mkdir -p dist/Rack/Bridge
  97. cp Bridge/VST/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
  98. cp Bridge/VST/dist/VCV-Bridge-32.dll dist/Rack/Bridge/
  99. cp -R LICENSE* res dist/Rack/
  100. cp $(TARGET) dist/Rack/
  101. $(STRIP) -s dist/Rack/$(TARGET)
  102. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  103. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  104. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  105. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  106. # Make ZIP
  107. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  108. # Make NSIS installer
  109. makensis installer.nsi
  110. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  111. endif
  112. ifdef ARCH_LIN
  113. mkdir -p dist/Rack
  114. mkdir -p dist/Rack/Bridge
  115. cp Bridge/VST/dist/VCV-Bridge.so dist/Rack/Bridge/
  116. cp -R LICENSE* res dist/Rack/
  117. cp $(TARGET) dist/Rack/
  118. $(STRIP) -s dist/Rack/$(TARGET)
  119. ldd dist/Rack/$(TARGET)
  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. endif
  124. # Rack SDK distribution
  125. mkdir -p dist/Rack-SDK
  126. cp LICENSE* dist/Rack-SDK/
  127. cp *.mk dist/Rack-SDK/
  128. cp -R include dist/Rack-SDK/
  129. mkdir -p dist/Rack-SDK/dep/
  130. cp -R dep/include dist/Rack-SDK/dep/
  131. ifdef ARCH_WIN
  132. cp libRack.a dist/Rack-SDK/
  133. endif
  134. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  135. # Obviously this will only work if you have the private keys to my server
  136. UPLOAD_URL := vortico@vcvrack.com:files/
  137. upload:
  138. ifdef ARCH_MAC
  139. rsync dist/*.dmg $(UPLOAD_URL) -zP
  140. endif
  141. ifdef ARCH_WIN
  142. rsync dist/*.exe $(UPLOAD_URL) -P
  143. rsync dist/*.zip $(UPLOAD_URL) -P
  144. endif
  145. ifdef ARCH_LIN
  146. rsync dist/*.zip $(UPLOAD_URL) -zP
  147. endif
  148. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  149. # Plugin helpers
  150. allplugins:
  151. for f in plugins/*; do $(MAKE) -C "$$f"; done
  152. cleanplugins:
  153. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  154. distplugins:
  155. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  156. plugins:
  157. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  158. # Includes
  159. include compile.mk
  160. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  161. .DEFAULT_GOAL := all