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.

218 lines
6.6KB

  1. RACK_DIR ?= .
  2. VERSION := 2.dev.$(shell git rev-parse --short HEAD)
  3. # VERSION := 2.0.0
  4. FLAGS += -DVERSION=$(VERSION)
  5. FLAGS += -Iinclude -Idep/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_LIN
  14. SOURCES += dep/osdialog/osdialog_gtk2.c
  15. build/dep/osdialog/osdialog_gtk2.c.o: FLAGS += $(shell pkg-config --cflags gtk+-2.0)
  16. LDFLAGS += -rdynamic -Wl,--whole-archive \
  17. dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a \
  18. -Wl,--no-whole-archive -lpthread -lGL -ldl -lX11 -lasound -ljack \
  19. $(shell pkg-config --libs gtk+-2.0)
  20. TARGET := Rack
  21. endif
  22. ifdef ARCH_MAC
  23. SOURCES += dep/osdialog/osdialog_mac.m
  24. LDFLAGS += -lpthread -ldl \
  25. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  26. -Wl,-all_load \
  27. dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a
  28. # For LuaJIT
  29. LDFLAGS += -Wl,-pagezero_size,10000 -Wl,-image_base,100000000
  30. TARGET := Rack
  31. endif
  32. ifdef ARCH_WIN
  33. SOURCES += dep/osdialog/osdialog_win.c
  34. LDFLAGS += -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  35. dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libzip.a dep/lib/libz.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a \
  36. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
  37. TARGET := Rack.exe
  38. OBJECTS += Rack.res
  39. endif
  40. # Convenience targets
  41. all: $(TARGET)
  42. dep:
  43. $(MAKE) -C dep
  44. run: $(TARGET)
  45. ./$< -d
  46. runr: $(TARGET)
  47. ./$<
  48. debug: $(TARGET)
  49. ifdef ARCH_MAC
  50. lldb -- ./$< -d
  51. endif
  52. ifdef ARCH_WIN
  53. gdb --args ./$< -d
  54. endif
  55. ifdef ARCH_LIN
  56. gdb --args ./$< -d
  57. endif
  58. perf: $(TARGET)
  59. # Requires gperftools
  60. perf record --call-graph dwarf -o perf.data ./$< -d
  61. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  62. hotspot perf.data
  63. rm perf.data
  64. valgrind: $(TARGET)
  65. # --gen-suppressions=yes
  66. # --leak-check=full
  67. valgrind --suppressions=valgrind.supp ./$< -d
  68. clean:
  69. rm -rfv $(TARGET) libRack.a Rack.res build dist
  70. # For Windows resources
  71. %.res: %.rc
  72. ifdef ARCH_WIN
  73. windres $^ -O coff -o $@
  74. endif
  75. DIST_RES := LICENSE* CHANGELOG.md res cacert.pem Core.json template.vcv
  76. DIST_NAME := Rack-$(VERSION)-$(ARCH)
  77. DIST_SDK := Rack-SDK-$(VERSION).zip
  78. # This target is not intended for public use
  79. dist: $(TARGET)
  80. rm -rf dist
  81. mkdir -p dist
  82. ifdef ARCH_LIN
  83. mkdir -p dist/Rack
  84. cp $(TARGET) dist/Rack/
  85. $(STRIP) -s dist/Rack/$(TARGET)
  86. cp -R $(DIST_RES) dist/Rack/
  87. # Manually check that no nonstandard shared libraries are linked
  88. ldd dist/Rack/$(TARGET)
  89. cp Fundamental.zip dist/Rack/
  90. # Make ZIP
  91. cd dist && zip -q -9 -r $(DIST_NAME).zip Rack
  92. endif
  93. ifdef ARCH_MAC
  94. mkdir -p dist/Rack.app
  95. mkdir -p dist/Rack.app/Contents
  96. cp Info.plist dist/Rack.app/Contents/
  97. $(SED) 's/{VERSION}/$(VERSION)/g' dist/Rack.app/Contents/Info.plist
  98. mkdir -p dist/Rack.app/Contents/MacOS
  99. cp $(TARGET) dist/Rack.app/Contents/MacOS/
  100. $(STRIP) -S dist/Rack.app/Contents/MacOS/$(TARGET)
  101. mkdir -p dist/Rack.app/Contents/Resources
  102. cp -R $(DIST_RES) icon.icns dist/Rack.app/Contents/Resources/
  103. # Manually check that no nonstandard shared libraries are linked
  104. otool -L dist/Rack.app/Contents/MacOS/$(TARGET)
  105. cp Fundamental.zip dist/Rack.app/Contents/Resources/Fundamental.txt
  106. # Clean up and sign bundle
  107. xattr -cr dist/Rack.app
  108. # This will only work if you have the private key to my certificate
  109. codesign --verbose --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --options runtime --entitlements Entitlements.plist --deep dist/Rack.app
  110. codesign --verify --deep --strict --verbose=2 dist/Rack.app
  111. # Make ZIP
  112. cd dist && zip -q -9 -r $(DIST_NAME).zip Rack.app
  113. endif
  114. ifdef ARCH_WIN
  115. mkdir -p dist/Rack
  116. cp $(TARGET) dist/Rack/
  117. $(STRIP) -s dist/Rack/$(TARGET)
  118. cp -R $(DIST_RES) dist/Rack/
  119. cp /mingw64/bin/libwinpthread-1.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 Fundamental.zip dist/Rack/
  123. # Make ZIP
  124. cd dist && zip -q -9 -r $(DIST_NAME).zip Rack
  125. # Make NSIS installer
  126. # pacman -S mingw-w64-x86_64-nsis
  127. makensis -DVERSION=$(VERSION) installer.nsi
  128. mv installer.exe dist/$(DIST_NAME).exe
  129. endif
  130. # Rack SDK
  131. mkdir -p dist/Rack-SDK
  132. cp -R LICENSE* *.mk include helper.py dist/Rack-SDK/
  133. mkdir -p dist/Rack-SDK/dep/
  134. cp -R dep/include dist/Rack-SDK/dep/
  135. ifdef ARCH_WIN
  136. cp libRack.a dist/Rack-SDK/
  137. endif
  138. cd dist && zip -q -9 -r $(DIST_SDK) Rack-SDK
  139. notarize:
  140. ifdef ARCH_MAC
  141. # This will only work if you have my Apple ID password in your keychain
  142. xcrun altool --notarize-app -f dist/Rack-$(VERSION)-$(ARCH).zip --primary-bundle-id=com.vcvrack.rack -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/UploadInfo.plist
  143. # Wait for Apple's servers to approve the app
  144. while true; do \
  145. echo "Waiting on Apple servers..." ; \
  146. xcrun altool --notarization-info `/usr/libexec/PlistBuddy -c "Print :notarization-upload:RequestUUID" dist/UploadInfo.plist` -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/RequestInfo.plist ; \
  147. if [ "`/usr/libexec/PlistBuddy -c "Print :notarization-info:Status" dist/RequestInfo.plist`" != "in progress" ]; then \
  148. break ; \
  149. fi ; \
  150. sleep 10 ; \
  151. done
  152. # Mark app as notarized, check, and re-zip
  153. xcrun stapler staple dist/Rack.app
  154. spctl --assess --type execute --ignore-cache --no-cache -vv dist/Rack.app
  155. cd dist && zip -q -9 -r $(DIST_NAME).zip Rack.app
  156. endif
  157. UPLOAD_URL := vortico@vcvrack.com:files/
  158. upload:
  159. # This will only work if you have a private key to my server
  160. ifdef ARCH_MAC
  161. rsync dist/$(DIST_NAME).zip $(UPLOAD_URL) -zP
  162. endif
  163. ifdef ARCH_WIN
  164. rsync dist/$(DIST_NAME).zip dist/$(DIST_NAME).exe dist/$(DIST_SDK) $(UPLOAD_URL) -P
  165. endif
  166. ifdef ARCH_LIN
  167. rsync dist/$(DIST_NAME).zip $(UPLOAD_URL) -zP
  168. endif
  169. # Plugin helpers
  170. plugins:
  171. ifdef CMD
  172. for f in plugins/*; do (cd "$$f" && $(CMD)); done
  173. else
  174. for f in plugins/*; do $(MAKE) -C "$$f"; done
  175. endif
  176. # Includes
  177. include compile.mk
  178. .DEFAULT_GOAL := all
  179. .PHONY: all dep run debug clean dist upload src plugins