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.

200 lines
5.0KB

  1. RACK_DIR ?= .
  2. VERSION = 0.6.1
  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 \
  26. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  27. -Ldep/lib -lglew32 -lglfw3 -ljansson -lspeexdsp -lzip -lz -lcurl -lssl -lcrypto -lrtaudio -lrtmidi \
  28. -lpthread -lopengl32 -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/libstdc++-6.dll dist/Rack/
  107. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  108. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  109. # Make ZIP
  110. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  111. # Make NSIS installer
  112. makensis installer.nsi
  113. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  114. endif
  115. ifeq ($(ARCH), lin)
  116. mkdir -p dist/Rack
  117. cp -R LICENSE* res dist/Rack/
  118. cp $(TARGET) dist/Rack/
  119. $(STRIP) -s dist/Rack/$(TARGET)
  120. ldd dist/Rack/$(TARGET)
  121. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  122. # Make ZIP
  123. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  124. endif
  125. # Rack SDK distribution
  126. mkdir -p dist/Rack-SDK
  127. cp LICENSE* dist/Rack-SDK/
  128. cp *.mk dist/Rack-SDK/
  129. cp -R include dist/Rack-SDK/
  130. mkdir -p dist/Rack-SDK/dep/
  131. cp -R dep/include dist/Rack-SDK/dep/
  132. ifeq ($(ARCH), win)
  133. cp libRack.a dist/Rack-SDK/
  134. endif
  135. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  136. # Obviously this will only work if you have the private keys to my server
  137. UPLOAD_URL := vortico@vcvrack.com:files/
  138. upload:
  139. ifeq ($(ARCH), mac)
  140. rsync dist/*.dmg $(UPLOAD_URL) -zP
  141. endif
  142. ifeq ($(ARCH), win)
  143. rsync dist/*.exe $(UPLOAD_URL) -P
  144. rsync dist/*.zip $(UPLOAD_URL) -P
  145. endif
  146. ifeq ($(ARCH), lin)
  147. rsync dist/*.zip $(UPLOAD_URL) -zP
  148. endif
  149. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  150. # Plugin helpers
  151. allplugins:
  152. for f in plugins/*; do $(MAKE) -C "$$f"; done
  153. cleanplugins:
  154. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  155. distplugins:
  156. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  157. plugins:
  158. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  159. # Includes
  160. include compile.mk
  161. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  162. .DEFAULT_GOAL := all