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.

203 lines
5.2KB

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