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.

198 lines
5.0KB

  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 src/*.cpp src/*/*.cpp)
  12. ifdef ARCH_MAC
  13. SOURCES += dep/osdialog/osdialog_mac.m
  14. CXXFLAGS += -stdlib=libc++
  15. LDFLAGS += -stdlib=libc++ -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
  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: dep $(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 -ex run ./$< -d
  51. endif
  52. ifdef ARCH_WIN
  53. gdb -ex run ./$< -d
  54. endif
  55. ifdef ARCH_LIN
  56. gdb -ex run ./$< -d
  57. endif
  58. perf: $(TARGET)
  59. ifdef ARCH_LIN
  60. perf record --call-graph dwarf ./$< -d
  61. endif
  62. clean:
  63. rm -rfv $(TARGET) libRack.a Rack.res build dist
  64. ifdef ARCH_WIN
  65. # For Windows resources
  66. %.res: %.rc
  67. windres $^ -O coff -o $@
  68. endif
  69. # This target is not intended for public use
  70. dist: all
  71. rm -rf dist
  72. # Rack distribution
  73. $(MAKE) -C plugins/Fundamental dist
  74. ifdef ARCH_MAC
  75. mkdir -p $(BUNDLE)
  76. mkdir -p $(BUNDLE)/Contents
  77. mkdir -p $(BUNDLE)/Contents/Resources
  78. cp Info.plist $(BUNDLE)/Contents/
  79. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  80. mkdir -p $(BUNDLE)/Contents/MacOS
  81. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  82. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  83. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  84. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  85. cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  86. cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  87. # Make DMG image
  88. cd dist && ln -s /Applications Applications
  89. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  90. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  91. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  92. endif
  93. ifdef ARCH_WIN
  94. mkdir -p dist/Rack
  95. mkdir -p dist/Rack/Bridge
  96. cp Bridge/VST/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
  97. cp Bridge/VST/dist/VCV-Bridge-32.dll dist/Rack/Bridge/
  98. cp -R LICENSE* res dist/Rack/
  99. cp $(TARGET) dist/Rack/
  100. $(STRIP) -s dist/Rack/$(TARGET)
  101. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  102. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  103. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  104. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  105. # Make ZIP
  106. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  107. # Make NSIS installer
  108. makensis installer.nsi
  109. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  110. endif
  111. ifdef ARCH_LIN
  112. mkdir -p dist/Rack
  113. mkdir -p dist/Rack/Bridge
  114. cp Bridge/VST/dist/VCV-Bridge.so dist/Rack/Bridge/
  115. cp -R LICENSE* res dist/Rack/
  116. cp $(TARGET) dist/Rack/
  117. $(STRIP) -s dist/Rack/$(TARGET)
  118. ldd dist/Rack/$(TARGET)
  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. endif
  123. # Rack SDK distribution
  124. mkdir -p dist/Rack-SDK
  125. cp LICENSE* dist/Rack-SDK/
  126. cp *.mk dist/Rack-SDK/
  127. cp -R include dist/Rack-SDK/
  128. mkdir -p dist/Rack-SDK/dep/
  129. cp -R dep/include dist/Rack-SDK/dep/
  130. ifdef ARCH_WIN
  131. cp libRack.a dist/Rack-SDK/
  132. endif
  133. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  134. # Obviously this will only work if you have the private keys to my server
  135. UPLOAD_URL := vortico@vcvrack.com:files/
  136. upload:
  137. ifdef ARCH_MAC
  138. rsync dist/*.dmg $(UPLOAD_URL) -zP
  139. endif
  140. ifdef ARCH_WIN
  141. rsync dist/*.exe $(UPLOAD_URL) -P
  142. rsync dist/*.zip $(UPLOAD_URL) -P
  143. endif
  144. ifdef ARCH_LIN
  145. rsync dist/*.zip $(UPLOAD_URL) -zP
  146. endif
  147. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  148. # Plugin helpers
  149. allplugins:
  150. for f in plugins/*; do $(MAKE) -C "$$f"; done
  151. cleanplugins:
  152. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  153. distplugins:
  154. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  155. plugins:
  156. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  157. # Includes
  158. include compile.mk
  159. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  160. .DEFAULT_GOAL := all