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.

219 lines
6.6KB

  1. VERSION = 0.6.0dev
  2. FLAGS += \
  3. -Iinclude \
  4. -Idep/include -Idep/lib/libzip/include
  5. ifdef RELEASE
  6. FLAGS += -DRELEASE=$(RELEASE)
  7. endif
  8. SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \
  9. ext/nanovg/src/nanovg.c
  10. include arch.mk
  11. ifeq ($(ARCH), lin)
  12. SOURCES += ext/osdialog/osdialog_gtk2.c
  13. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  14. LDFLAGS += -rdynamic \
  15. -lpthread -lGL -ldl \
  16. $(shell pkg-config --libs gtk+-2.0) \
  17. -Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl
  18. TARGET = Rack
  19. endif
  20. ifeq ($(ARCH), mac)
  21. SOURCES += ext/osdialog/osdialog_mac.m
  22. CXXFLAGS += -DAPPLE -stdlib=libc++
  23. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  24. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \
  25. -Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl
  26. TARGET = Rack
  27. BUNDLE = dist/$(TARGET).app
  28. endif
  29. ifeq ($(ARCH), win)
  30. SOURCES += ext/osdialog/osdialog_win.c
  31. LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \
  32. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  33. -lgdi32 -lopengl32 -lcomdlg32 -lole32 \
  34. -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl \
  35. -Wl,-Bstatic -ljansson -lspeexdsp
  36. TARGET = Rack.exe
  37. OBJECTS = Rack.res
  38. endif
  39. all: $(TARGET)
  40. dep:
  41. $(MAKE) -C dep
  42. run: $(TARGET)
  43. ifeq ($(ARCH), lin)
  44. LD_LIBRARY_PATH=dep/lib ./$<
  45. endif
  46. ifeq ($(ARCH), mac)
  47. DYLD_FALLBACK_LIBRARY_PATH=dep/lib ./$<
  48. endif
  49. ifeq ($(ARCH), win)
  50. # TODO get rid of the mingw64 path
  51. env PATH=dep/bin:/mingw64/bin ./$<
  52. endif
  53. debug: $(TARGET)
  54. ifeq ($(ARCH), lin)
  55. LD_LIBRARY_PATH=dep/lib gdb -ex run ./Rack
  56. endif
  57. ifeq ($(ARCH), mac)
  58. DYLD_FALLBACK_LIBRARY_PATH=dep/lib gdb -ex run ./Rack
  59. endif
  60. ifeq ($(ARCH), win)
  61. # TODO get rid of the mingw64 path
  62. env PATH=dep/bin:/mingw64/bin gdb -ex run ./Rack
  63. endif
  64. perf: $(TARGET)
  65. ifeq ($(ARCH), lin)
  66. LD_LIBRARY_PATH=dep/lib perf record --call-graph dwarf ./Rack
  67. endif
  68. clean:
  69. rm -fv libRack.a
  70. rm -rfv $(TARGET) build dist
  71. # For Windows resources
  72. %.res: %.rc
  73. windres $^ -O coff -o $@
  74. include compile.mk
  75. dist: all
  76. rm -rf dist
  77. $(MAKE) -C plugins/Fundamental dist
  78. ifeq ($(ARCH), mac)
  79. mkdir -p $(BUNDLE)
  80. mkdir -p $(BUNDLE)/Contents
  81. mkdir -p $(BUNDLE)/Contents/Resources
  82. cp Info.plist $(BUNDLE)/Contents/
  83. cp -R LICENSE* res $(BUNDLE)/Contents/Resources
  84. mkdir -p $(BUNDLE)/Contents/MacOS
  85. cp Rack $(BUNDLE)/Contents/MacOS/
  86. cp icon.icns $(BUNDLE)/Contents/Resources/
  87. otool -L $(BUNDLE)/Contents/MacOS/Rack
  88. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  89. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  90. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  91. cp dep/lib/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/
  92. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  93. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  94. cp dep/lib/librtaudio.dylib $(BUNDLE)/Contents/MacOS/
  95. cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/
  96. cp dep/lib/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/
  97. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  98. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack
  99. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  100. install_name_tool -change $(PWD)/dep/lib/libspeexdsp.1.dylib @executable_path/libspeexdsp.1.dylib $(BUNDLE)/Contents/MacOS/Rack
  101. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  102. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack
  103. install_name_tool -change librtaudio.dylib @executable_path/librtaudio.dylib $(BUNDLE)/Contents/MacOS/Rack
  104. install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  105. install_name_tool -change $(PWD)/dep/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/Rack
  106. otool -L $(BUNDLE)/Contents/MacOS/Rack
  107. mkdir -p $(BUNDLE)/Contents/Resources/plugins
  108. cp -R plugins/Fundamental/dist/Fundamental $(BUNDLE)/Contents/Resources/plugins
  109. # Make DMG image
  110. cd dist && ln -s /Applications Applications
  111. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  112. endif
  113. ifeq ($(ARCH), win)
  114. mkdir -p dist/Rack
  115. cp -R LICENSE* res dist/Rack/
  116. cp Rack.exe dist/Rack/
  117. strip dist/Rack/Rack.exe
  118. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  119. cp /mingw64/bin/zlib1.dll dist/Rack/
  120. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  121. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  122. cp dep/bin/glew32.dll dist/Rack/
  123. cp dep/bin/glfw3.dll dist/Rack/
  124. cp dep/bin/libcurl-4.dll dist/Rack/
  125. cp dep/bin/libjansson-4.dll dist/Rack/
  126. cp dep/bin/librtmidi-4.dll dist/Rack/
  127. cp dep/bin/libspeexdsp-1.dll dist/Rack/
  128. cp dep/bin/libzip-5.dll dist/Rack/
  129. cp dep/bin/librtaudio.dll dist/Rack/
  130. cp dep/bin/libcrypto-1_1-x64.dll dist/Rack/
  131. cp dep/bin/libssl-1_1-x64.dll dist/Rack/
  132. mkdir -p dist/Rack/plugins
  133. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  134. # Make ZIP
  135. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  136. # Make NSIS installer
  137. makensis installer.nsi
  138. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  139. endif
  140. ifeq ($(ARCH), lin)
  141. mkdir -p dist/Rack
  142. cp -R LICENSE* res dist/Rack/
  143. cp Rack Rack.sh dist/Rack/
  144. cp dep/lib/libspeexdsp.so dist/Rack/
  145. cp dep/lib/libjansson.so.4 dist/Rack/
  146. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  147. cp dep/lib/libglfw.so.3 dist/Rack/
  148. cp dep/lib/libcurl.so.4 dist/Rack/
  149. cp dep/lib/libzip.so.5 dist/Rack/
  150. cp dep/lib/librtaudio.so dist/Rack/
  151. cp dep/lib/librtmidi.so.4 dist/Rack/
  152. cp dep/lib/libssl.so.1.1 dist/Rack/
  153. cp dep/lib/libcrypto.so.1.1 dist/Rack/
  154. mkdir -p dist/Rack/plugins
  155. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  156. # Make ZIP
  157. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  158. endif
  159. # Obviously this will only work if you have the private keys to my server
  160. UPLOAD_URL = vortico@vcvrack.com:files/
  161. upload: dist distplugins
  162. ifeq ($(ARCH), mac)
  163. rsync dist/*.dmg $(UPLOAD_URL) -zP
  164. endif
  165. ifeq ($(ARCH), win)
  166. rsync dist/*.exe $(UPLOAD_URL) -P
  167. rsync dist/*.zip $(UPLOAD_URL) -P
  168. endif
  169. ifeq ($(ARCH), lin)
  170. rsync dist/*.zip $(UPLOAD_URL) -zP
  171. endif
  172. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  173. # Plugin helpers
  174. allplugins:
  175. for f in plugins/*; do $(MAKE) -C "$$f"; done
  176. cleanplugins:
  177. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  178. distplugins:
  179. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  180. plugins:
  181. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  182. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins