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.

202 lines
5.8KB

  1. RACK_DIR ?= .
  2. # VERSION := 1.dev.$(shell git rev-parse --short HEAD)
  3. VERSION := 1.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 \
  17. 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/librtmidi.a dep/lib/librtaudio.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.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. ifdef ARCH_WIN
  68. # For Windows resources
  69. %.res: %.rc
  70. windres $^ -O coff -o $@
  71. endif
  72. # This target is not intended for public use
  73. dist: $(TARGET)
  74. rm -rf dist
  75. mkdir -p dist
  76. $(MAKE) -C plugins/Fundamental dist
  77. ifdef ARCH_LIN
  78. mkdir -p dist/Rack
  79. cp $(TARGET) dist/Rack/
  80. $(STRIP) -s dist/Rack/$(TARGET)
  81. cp -R LICENSE* res Core.json template.vcv dist/Rack/
  82. # Manually check that no nonstandard shared libraries are linked
  83. ldd dist/Rack/$(TARGET)
  84. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  85. # Make ZIP
  86. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip Rack
  87. endif
  88. ifdef ARCH_MAC
  89. mkdir -p dist/$(TARGET).app
  90. mkdir -p dist/$(TARGET).app/Contents
  91. cp Info.plist dist/$(TARGET).app/Contents/
  92. $(SED) 's/{VERSION}/$(VERSION)/g' dist/$(TARGET).app/Contents/Info.plist
  93. mkdir -p dist/$(TARGET).app/Contents/MacOS
  94. cp $(TARGET) dist/$(TARGET).app/Contents/MacOS/
  95. $(STRIP) -S dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  96. mkdir -p dist/$(TARGET).app/Contents/Resources
  97. cp -R LICENSE* res Core.json template.vcv icon.icns dist/$(TARGET).app/Contents/Resources
  98. # Manually check that no nonstandard shared libraries are linked
  99. otool -L dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  100. cp plugins/Fundamental/dist/*.zip dist/$(TARGET).app/Contents/Resources/Fundamental.zip
  101. # Clean up and sign bundle
  102. xattr -cr dist/$(TARGET).app
  103. # This will only work if you have the private key to my certificate
  104. codesign --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --verbose dist/$(TARGET).app
  105. codesign --verify --deep --strict --verbose=2 dist/$(TARGET).app
  106. spctl -a -t exec -vv dist/$(TARGET).app
  107. # Make ZIP
  108. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip $(TARGET).app
  109. endif
  110. ifdef ARCH_WIN
  111. mkdir -p dist/Rack
  112. cp $(TARGET) dist/Rack/
  113. $(STRIP) -s dist/Rack/$(TARGET)
  114. cp -R LICENSE* res Core.json template.vcv dist/Rack/
  115. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  116. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  117. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  118. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  119. # Make ZIP
  120. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip Rack
  121. # Make NSIS installer
  122. # pacman -S mingw-w64-x86_64-nsis
  123. makensis -DVERSION=$(VERSION) installer.nsi
  124. mv installer.exe dist/Rack-$(VERSION)-$(ARCH).exe
  125. endif
  126. # Rack SDK
  127. mkdir -p dist/Rack-SDK
  128. cp LICENSE* dist/Rack-SDK/
  129. cp *.mk dist/Rack-SDK/
  130. cp -R include dist/Rack-SDK/
  131. mkdir -p dist/Rack-SDK/dep/
  132. cp -R dep/include dist/Rack-SDK/dep/
  133. cp helper.py dist/Rack-SDK/
  134. ifdef ARCH_WIN
  135. cp libRack.a dist/Rack-SDK/
  136. endif
  137. cd dist && zip -q -9 -r Rack-SDK-$(VERSION).zip Rack-SDK
  138. notarize:
  139. # This will only work if you have my Apple ID password in your keychain
  140. ifdef ARCH_MAC
  141. xcrun altool --notarize-app -f dist/Rack-$(VERSION)-$(ARCH).zip --primary-bundle-id="RACK" -u "andrewpbelt@gmail.com" -p @keychain:notarize
  142. endif
  143. UPLOAD_URL := vortico@vcvrack.com:files/
  144. upload:
  145. # This will only work if you have a private key to my server
  146. ifdef ARCH_MAC
  147. rsync dist/*.zip $(UPLOAD_URL) -zP
  148. endif
  149. ifdef ARCH_WIN
  150. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  151. endif
  152. ifdef ARCH_LIN
  153. rsync dist/*.zip $(UPLOAD_URL) -zP
  154. endif
  155. # Plugin helpers
  156. plugins:
  157. ifdef CMD
  158. for f in plugins/*; do (cd "$$f" && $(CMD)); done
  159. else
  160. for f in plugins/*; do $(MAKE) -C "$$f"; done
  161. endif
  162. # Includes
  163. include compile.mk
  164. .PHONY: all dep run debug clean dist plugins cleanplugins distplugins cmdplugins
  165. .DEFAULT_GOAL := all