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

  1. RACK_DIR ?= .
  2. VERSION = 0.6.1dev
  3. FLAGS += \
  4. -Iinclude \
  5. -Idep/include -Idep/lib/libzip/include
  6. ifdef RELEASE
  7. FLAGS += -DRELEASE
  8. endif
  9. include arch.mk
  10. STRIP ?= strip
  11. # Sources and build flags
  12. SOURCES += dep/nanovg/src/nanovg.c
  13. SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
  14. ifeq ($(ARCH), mac)
  15. SOURCES += dep/osdialog/osdialog_mac.m
  16. CXXFLAGS += -stdlib=libc++
  17. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  18. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  19. -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
  20. TARGET := Rack
  21. BUNDLE := dist/$(TARGET).app
  22. endif
  23. ifeq ($(ARCH), win)
  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. ifeq ($(ARCH), lin)
  33. SOURCES += dep/osdialog/osdialog_gtk2.c
  34. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  35. LDFLAGS += -rdynamic \
  36. -Ldep/lib \
  37. -Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
  38. -Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
  39. $(shell pkg-config --libs gtk+-2.0)
  40. TARGET := Rack
  41. endif
  42. # Convenience targets
  43. all: dep $(TARGET)
  44. dep:
  45. $(MAKE) -C dep
  46. run: $(TARGET)
  47. ./$<
  48. debug: $(TARGET)
  49. ifeq ($(ARCH), mac)
  50. lldb -ex run ./$<
  51. endif
  52. ifeq ($(ARCH), win)
  53. gdb -ex run ./$<
  54. endif
  55. ifeq ($(ARCH), lin)
  56. gdb -ex run ./$<
  57. endif
  58. perf: $(TARGET)
  59. ifeq ($(ARCH), lin)
  60. perf record --call-graph dwarf ./Rack
  61. endif
  62. clean:
  63. rm -rfv $(TARGET) libRack.a Rack.res build dist
  64. ifeq ($(ARCH), win)
  65. # For Windows resources
  66. %.res: %.rc
  67. windres $^ -O coff -o $@
  68. endif
  69. # This target is not intended for public use
  70. dist: all
  71. ifndef RELEASE
  72. exit 1 # Must enable RELEASE for dist target
  73. endif
  74. rm -rf dist
  75. # Rack distribution
  76. $(MAKE) -C plugins/Fundamental dist
  77. ifeq ($(ARCH), mac)
  78. mkdir -p $(BUNDLE)
  79. mkdir -p $(BUNDLE)/Contents
  80. mkdir -p $(BUNDLE)/Contents/Resources
  81. cp Info.plist $(BUNDLE)/Contents/
  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 plugins/Fundamental/dist/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. # 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. ifeq ($(ARCH), win)
  97. mkdir -p dist/Rack
  98. mkdir -p dist/Rack/Bridge
  99. cp Bridge/vst/dist/VCV-Bridge-64.dll dist/Rack/Bridge/
  100. cp Bridge/vst/dist/VCV-Bridge-32.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 plugins/Fundamental/dist/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. ifeq ($(ARCH), lin)
  115. mkdir -p dist/Rack
  116. cp -R LICENSE* res dist/Rack/
  117. cp $(TARGET) dist/Rack/
  118. $(STRIP) -s dist/Rack/$(TARGET)
  119. ldd dist/Rack/$(TARGET)
  120. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  121. # Make ZIP
  122. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  123. endif
  124. # Rack SDK distribution
  125. mkdir -p dist/Rack-SDK
  126. cp LICENSE* dist/Rack-SDK/
  127. cp *.mk dist/Rack-SDK/
  128. cp -R include dist/Rack-SDK/
  129. mkdir -p dist/Rack-SDK/dep/
  130. cp -R dep/include dist/Rack-SDK/dep/
  131. ifeq ($(ARCH), win)
  132. cp libRack.a dist/Rack-SDK/
  133. endif
  134. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  135. # Obviously this will only work if you have the private keys to my server
  136. UPLOAD_URL := vortico@vcvrack.com:files/
  137. upload:
  138. ifeq ($(ARCH), mac)
  139. rsync dist/*.dmg $(UPLOAD_URL) -zP
  140. endif
  141. ifeq ($(ARCH), win)
  142. rsync dist/*.exe $(UPLOAD_URL) -P
  143. rsync dist/*.zip $(UPLOAD_URL) -P
  144. endif
  145. ifeq ($(ARCH), lin)
  146. rsync dist/*.zip $(UPLOAD_URL) -zP
  147. endif
  148. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  149. # Plugin helpers
  150. allplugins:
  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. plugins:
  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