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

  1. RACK_DIR ?= .
  2. VERSION = 1.dev
  3. FLAGS += -DAPP_VERSION=$(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. LDFLAGS += -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 dep/lib/libomp.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 -lmfplat -lmfuuid -lwmcodecdspuuid
  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: $(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 --args ./$< -d
  50. endif
  51. ifdef ARCH_WIN
  52. gdb --args ./$< -d
  53. endif
  54. ifdef ARCH_LIN
  55. gdb --args ./$< -d
  56. endif
  57. perf: $(TARGET)
  58. # Requires gperftools
  59. ifdef ARCH_LIN
  60. perf record --call-graph dwarf -o perf.data ./$< -d
  61. endif
  62. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  63. # hotspot perf.data
  64. clean:
  65. rm -rfv $(TARGET) libRack.a Rack.res build dist
  66. ifdef ARCH_WIN
  67. # For Windows resources
  68. %.res: %.rc
  69. windres $^ -O coff -o $@
  70. endif
  71. # This target is not intended for public use
  72. dist: all
  73. rm -rf dist
  74. mkdir -p 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. $(SED) 's/{VERSION}/$(VERSION)/g' $(BUNDLE)/Contents/Info.plist
  81. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  82. mkdir -p $(BUNDLE)/Contents/MacOS
  83. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  84. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  85. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  86. cp Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  87. cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  88. cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  89. cp -R Bridge/VST/dist/VCV-Bridge-fx.vst dist/
  90. @# Make DMG image
  91. cd dist && ln -s /Applications Applications
  92. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  93. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  94. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  95. endif
  96. ifdef ARCH_WIN
  97. mkdir -p dist/Rack
  98. mkdir -p dist/Rack/Bridge
  99. cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
  100. cp -R LICENSE* res dist/Rack/
  101. cp $(TARGET) dist/Rack/
  102. $(STRIP) -s dist/Rack/$(TARGET)
  103. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  104. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  105. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  106. cp Fundamental-*.zip dist/Rack/Fundamental.zip
  107. @# Make ZIP
  108. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  109. @# Make NSIS installer
  110. makensis installer.nsi
  111. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  112. endif
  113. ifdef ARCH_LIN
  114. mkdir -p dist/Rack
  115. mkdir -p dist/Rack/Bridge
  116. cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
  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 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
  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. ifdef ARCH_WIN
  133. cp libRack.a dist/Rack-SDK/
  134. endif
  135. cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).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. ifdef ARCH_MAC
  140. rsync dist/*.{dmg,zip} $(UPLOAD_URL) -zP
  141. endif
  142. ifdef ARCH_WIN
  143. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  144. endif
  145. ifdef ARCH_LIN
  146. rsync dist/*.zip $(UPLOAD_URL) -zP
  147. endif
  148. # Plugin helpers
  149. plugins:
  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. cmdplugins:
  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