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.

206 lines
5.3KB

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