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.

217 lines
6.5KB

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