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.

Makefile 7.0KB

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