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

  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_LIN
  14. SOURCES += dep/osdialog/osdialog_gtk2.c
  15. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  16. LDFLAGS += -rdynamic \
  17. -Ldep/lib \
  18. -Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
  19. -Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
  20. $(shell pkg-config --libs gtk+-2.0)
  21. TARGET := Rack
  22. endif
  23. ifdef ARCH_MAC
  24. SOURCES += dep/osdialog/osdialog_mac.m
  25. LDFLAGS += -lpthread -ldl \
  26. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  27. -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
  28. TARGET := Rack
  29. endif
  30. ifdef ARCH_WIN
  31. SOURCES += dep/osdialog/osdialog_win.c
  32. LDFLAGS += -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  33. dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a \
  34. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
  35. TARGET := Rack.exe
  36. OBJECTS += Rack.res
  37. endif
  38. # Convenience targets
  39. all: $(TARGET)
  40. dep:
  41. $(MAKE) -C dep
  42. run: $(TARGET)
  43. ./$< -d
  44. runr: $(TARGET)
  45. ./$<
  46. debug: $(TARGET)
  47. ifdef ARCH_MAC
  48. lldb --args ./$< -d
  49. endif
  50. ifdef ARCH_WIN
  51. gdb --args ./$< -d
  52. endif
  53. ifdef ARCH_LIN
  54. gdb --args ./$< -d
  55. endif
  56. perf: $(TARGET)
  57. # Requires gperftools
  58. perf record --call-graph dwarf -o perf.data ./$< -d
  59. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  60. # hotspot perf.data
  61. valgrind: $(TARGET)
  62. # --gen-suppressions=yes
  63. # --leak-check=full
  64. valgrind --suppressions=valgrind.supp ./$< -d
  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: $(TARGET)
  74. rm -rf dist
  75. mkdir -p dist
  76. $(MAKE) -C plugins/Fundamental dist
  77. ifdef ARCH_LIN
  78. mkdir -p dist/Rack
  79. cp $(TARGET) dist/Rack/
  80. $(STRIP) -s dist/Rack/$(TARGET)
  81. cp -R LICENSE* res template.vcv dist/Rack/
  82. # Manually check that no nonstandard shared libraries are linked
  83. ldd dist/Rack/$(TARGET)
  84. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  85. mkdir -p dist/Rack/Bridge
  86. # cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
  87. # Make ZIP
  88. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  89. endif
  90. ifdef ARCH_MAC
  91. mkdir -p dist/$(TARGET).app
  92. mkdir -p dist/$(TARGET).app/Contents
  93. cp Info.plist dist/$(TARGET).app/Contents/
  94. $(SED) 's/{VERSION}/$(VERSION)/g' dist/$(TARGET).app/Contents/Info.plist
  95. mkdir -p dist/$(TARGET).app/Contents/MacOS
  96. cp $(TARGET) dist/$(TARGET).app/Contents/MacOS/
  97. $(STRIP) -S dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  98. mkdir -p dist/$(TARGET).app/Contents/Resources
  99. cp -R LICENSE* res template.vcv icon.icns dist/$(TARGET).app/Contents/Resources
  100. # Manually check that no nonstandard shared libraries are linked
  101. otool -L dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  102. cp plugins/Fundamental/dist/*.zip dist/$(TARGET).app/Contents/Resources/Fundamental.zip
  103. # cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  104. # cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  105. # cp -R Bridge/VST/dist/VCV-Bridge-fx.vst dist/
  106. # Make ZIP
  107. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip $(TARGET).app
  108. endif
  109. ifdef ARCH_WIN
  110. mkdir -p dist/Rack
  111. cp $(TARGET) dist/Rack/
  112. $(STRIP) -s dist/Rack/$(TARGET)
  113. cp -R LICENSE* res template.vcv dist/Rack/
  114. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  115. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  116. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  117. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  118. # mkdir -p dist/Rack/Bridge
  119. # cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
  120. # Make ZIP
  121. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  122. # Make NSIS installer
  123. # pacman -S mingw-w64-x86_64-nsis
  124. # makensis installer.nsi
  125. # mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  126. endif
  127. # Rack SDK
  128. mkdir -p dist/Rack-SDK
  129. cp LICENSE* dist/Rack-SDK/
  130. cp *.mk dist/Rack-SDK/
  131. cp -R include dist/Rack-SDK/
  132. mkdir -p dist/Rack-SDK/dep/
  133. cp -R dep/include dist/Rack-SDK/dep/
  134. ifdef ARCH_WIN
  135. cp libRack.a dist/Rack-SDK/
  136. endif
  137. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  138. # Obviously this will only work if you have the private keys to my server
  139. UPLOAD_URL := vortico@vcvrack.com:files/
  140. upload:
  141. ifdef ARCH_MAC
  142. rsync dist/*.zip $(UPLOAD_URL) -zP
  143. endif
  144. ifdef ARCH_WIN
  145. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  146. endif
  147. ifdef ARCH_LIN
  148. rsync dist/*.zip $(UPLOAD_URL) -zP
  149. endif
  150. # Plugin helpers
  151. plugins:
  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. cmdplugins:
  158. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  159. # Includes
  160. include compile.mk
  161. .PHONY: all dep run debug clean dist plugins cleanplugins distplugins cmdplugins
  162. .DEFAULT_GOAL := all