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.

195 lines
4.9KB

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