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

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