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.2KB

  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_MAC
  14. SOURCES += dep/osdialog/osdialog_mac.m
  15. LDFLAGS += -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 -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
  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: $(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 --args ./$< -d
  51. endif
  52. ifdef ARCH_WIN
  53. gdb --args ./$< -d
  54. endif
  55. ifdef ARCH_LIN
  56. gdb --args ./$< -d
  57. endif
  58. perf: $(TARGET)
  59. # Requires gperftools
  60. ifdef ARCH_LIN
  61. perf record --call-graph dwarf -o perf.data ./$< -d
  62. endif
  63. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  64. # hotspot perf.data
  65. clean:
  66. rm -rfv $(TARGET) libRack.a Rack.res build dist
  67. ifdef ARCH_WIN
  68. # For Windows resources
  69. %.res: %.rc
  70. windres $^ -O coff -o $@
  71. endif
  72. # This target is not intended for public use
  73. dist: all
  74. rm -rf dist
  75. mkdir -p dist
  76. ifdef ARCH_MAC
  77. mkdir -p $(BUNDLE)
  78. mkdir -p $(BUNDLE)/Contents
  79. mkdir -p $(BUNDLE)/Contents/Resources
  80. cp Info.plist $(BUNDLE)/Contents/
  81. $(SED) 's/{VERSION}/$(VERSION)/g' $(BUNDLE)/Contents/Info.plist
  82. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  83. mkdir -p $(BUNDLE)/Contents/MacOS
  84. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  85. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  86. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  87. cp Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  88. cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  89. cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  90. cp -R Bridge/VST/dist/VCV-Bridge-fx.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. ifdef ARCH_WIN
  98. mkdir -p dist/Rack
  99. mkdir -p dist/Rack/Bridge
  100. cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
  101. cp -R LICENSE* res dist/Rack/
  102. cp $(TARGET) dist/Rack/
  103. $(STRIP) -s dist/Rack/$(TARGET)
  104. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  105. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  106. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  107. cp Fundamental-*.zip dist/Rack/Fundamental.zip
  108. @# Make ZIP
  109. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  110. @# Make NSIS installer
  111. makensis installer.nsi
  112. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  113. endif
  114. ifdef ARCH_LIN
  115. mkdir -p dist/Rack
  116. mkdir -p dist/Rack/Bridge
  117. cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
  118. cp -R LICENSE* res dist/Rack/
  119. cp $(TARGET) dist/Rack/
  120. $(STRIP) -s dist/Rack/$(TARGET)
  121. ldd dist/Rack/$(TARGET)
  122. cp Fundamental-*.zip dist/Rack/Fundamental.zip
  123. @# Make ZIP
  124. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  125. endif
  126. @# Rack SDK
  127. mkdir -p dist/Rack-SDK
  128. cp LICENSE* dist/Rack-SDK/
  129. cp *.mk dist/Rack-SDK/
  130. cp -R include dist/Rack-SDK/
  131. mkdir -p dist/Rack-SDK/dep/
  132. cp -R dep/include dist/Rack-SDK/dep/
  133. ifdef ARCH_WIN
  134. cp libRack.a dist/Rack-SDK/
  135. endif
  136. cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).zip Rack-SDK
  137. # Obviously this will only work if you have the private keys to my server
  138. UPLOAD_URL := vortico@vcvrack.com:files/
  139. upload:
  140. ifdef ARCH_MAC
  141. rsync dist/*.{dmg,zip} $(UPLOAD_URL) -zP
  142. endif
  143. ifdef ARCH_WIN
  144. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  145. endif
  146. ifdef ARCH_LIN
  147. rsync dist/*.zip $(UPLOAD_URL) -zP
  148. endif
  149. # Plugin helpers
  150. plugins:
  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. cmdplugins:
  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