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
6.4KB

  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 -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi
  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 -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi
  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 \
  31. -Wl,-Bstatic -ljansson -lsamplerate
  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. clean:
  61. rm -rfv $(TARGET) build dist
  62. # For Windows resources
  63. %.res: %.rc
  64. windres $^ -O coff -o $@
  65. include compile.mk
  66. dist: all
  67. ifndef VERSION
  68. $(error VERSION must be defined when making distributables)
  69. endif
  70. rm -rf dist
  71. $(MAKE) -C plugins/Fundamental dist
  72. ifeq ($(ARCH), mac)
  73. mkdir -p $(BUNDLE)
  74. mkdir -p $(BUNDLE)/Contents
  75. mkdir -p $(BUNDLE)/Contents/Resources
  76. cp Info.plist $(BUNDLE)/Contents/
  77. cp -R LICENSE* res $(BUNDLE)/Contents/Resources
  78. mkdir -p $(BUNDLE)/Contents/MacOS
  79. cp Rack $(BUNDLE)/Contents/MacOS/
  80. cp icon.icns $(BUNDLE)/Contents/Resources/
  81. otool -L $(BUNDLE)/Contents/MacOS/Rack
  82. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  83. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  84. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  85. cp dep/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/
  86. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  87. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  88. cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/
  89. cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/
  90. cp dep/lib/librtaudio.6.dylib $(BUNDLE)/Contents/MacOS/
  91. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  92. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack
  93. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  94. install_name_tool -change $(PWD)/dep/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  95. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  96. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack
  97. install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack
  98. install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  99. install_name_tool -change $(PWD)/dep/lib/librtaudio.6.dylib @executable_path/librtaudio.6.dylib $(BUNDLE)/Contents/MacOS/Rack
  100. otool -L $(BUNDLE)/Contents/MacOS/Rack
  101. mkdir -p $(BUNDLE)/Contents/Resources/plugins
  102. cp -R plugins/Fundamental/dist/Fundamental $(BUNDLE)/Contents/Resources/plugins
  103. # Make DMG image
  104. cd dist && ln -s /Applications Applications
  105. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  106. endif
  107. ifeq ($(ARCH), win)
  108. mkdir -p dist/Rack
  109. cp -R LICENSE* res dist/Rack/
  110. cp Rack.exe dist/Rack/
  111. strip dist/Rack/Rack.exe
  112. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  113. cp /mingw64/bin/zlib1.dll dist/Rack/
  114. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  115. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  116. cp dep/bin/glew32.dll dist/Rack/
  117. cp dep/bin/glfw3.dll dist/Rack/
  118. cp dep/bin/libcurl-4.dll dist/Rack/
  119. cp dep/bin/libjansson-4.dll dist/Rack/
  120. cp dep/bin/librtmidi-4.dll dist/Rack/
  121. cp dep/bin/libsamplerate-0.dll dist/Rack/
  122. cp dep/bin/libzip-5.dll dist/Rack/
  123. cp dep/bin/librtaudio.dll dist/Rack/
  124. mkdir -p dist/Rack/plugins
  125. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  126. # Make ZIP
  127. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  128. # Make NSIS installer
  129. makensis installer.nsi
  130. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  131. endif
  132. ifeq ($(ARCH), lin)
  133. mkdir -p dist/Rack
  134. cp -R LICENSE* res dist/Rack/
  135. cp Rack Rack.sh dist/Rack/
  136. cp dep/lib/libsamplerate.so.0 dist/Rack/
  137. cp dep/lib/libjansson.so.4 dist/Rack/
  138. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  139. cp dep/lib/libglfw.so.3 dist/Rack/
  140. cp dep/lib/libcurl.so.4 dist/Rack/
  141. cp dep/lib/libzip.so.5 dist/Rack/
  142. cp dep/lib/librtaudio.so dist/Rack/
  143. cp dep/lib/librtmidi.so.4 dist/Rack/
  144. mkdir -p dist/Rack/plugins
  145. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  146. # Make ZIP
  147. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  148. endif
  149. # Obviously this will only work if you have the private keys to my server
  150. UPLOAD_URL = vortico@vcvrack.com:files/
  151. upload: dist distplugins
  152. ifeq ($(ARCH), mac)
  153. rsync dist/*.dmg $(UPLOAD_URL) -zP
  154. endif
  155. ifeq ($(ARCH), win)
  156. rsync dist/*.exe $(UPLOAD_URL) -P
  157. rsync dist/*.zip $(UPLOAD_URL) -P
  158. endif
  159. ifeq ($(ARCH), lin)
  160. rsync dist/*.zip $(UPLOAD_URL) -zP
  161. endif
  162. rsync plugins/*/dist/*.zip $(UPLOAD_URL) -zP
  163. # Plugin helpers
  164. allplugins:
  165. for f in plugins/*; do $(MAKE) -C "$$f"; done
  166. cleanplugins:
  167. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  168. distplugins:
  169. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  170. plugins:
  171. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  172. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins