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.

194 lines
5.4KB

  1. RACK_DIR ?= .
  2. VERSION := 1.dev.$(shell git rev-parse --short HEAD)
  3. FLAGS += -DVERSION=$(VERSION)
  4. FLAGS += -Iinclude -Idep/include
  5. include arch.mk
  6. SED := perl -pi -e
  7. # Sources and build flags
  8. SOURCES += dep/nanovg/src/nanovg.c
  9. SOURCES += dep/osdialog/osdialog.c
  10. SOURCES += $(wildcard dep/jpommier-pffft-*/pffft.c) $(wildcard dep/jpommier-pffft-*/fftpack.c)
  11. SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
  12. ifdef ARCH_LIN
  13. SOURCES += dep/osdialog/osdialog_gtk2.c
  14. build/dep/osdialog/osdialog_gtk2.c.o: FLAGS += $(shell pkg-config --cflags gtk+-2.0)
  15. LDFLAGS += -rdynamic \
  16. 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 \
  17. -lpthread -lGL -ldl -lX11 -lasound -ljack \
  18. $(shell pkg-config --libs gtk+-2.0)
  19. TARGET := Rack
  20. endif
  21. ifdef ARCH_MAC
  22. SOURCES += dep/osdialog/osdialog_mac.m
  23. LDFLAGS += -lpthread -ldl \
  24. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  25. 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
  26. TARGET := Rack
  27. endif
  28. ifdef ARCH_WIN
  29. SOURCES += dep/osdialog/osdialog_win.c
  30. LDFLAGS += -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  31. 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 \
  32. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
  33. TARGET := Rack.exe
  34. OBJECTS += Rack.res
  35. endif
  36. # Convenience targets
  37. all: $(TARGET)
  38. dep:
  39. $(MAKE) -C dep
  40. run: $(TARGET)
  41. ./$< -d
  42. runr: $(TARGET)
  43. ./$<
  44. debug: $(TARGET)
  45. ifdef ARCH_MAC
  46. lldb -- ./$< -d
  47. endif
  48. ifdef ARCH_WIN
  49. gdb --args ./$< -d
  50. endif
  51. ifdef ARCH_LIN
  52. gdb --args ./$< -d
  53. endif
  54. perf: $(TARGET)
  55. # Requires gperftools
  56. perf record --call-graph dwarf -o perf.data ./$< -d
  57. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  58. hotspot perf.data
  59. rm perf.data
  60. valgrind: $(TARGET)
  61. # --gen-suppressions=yes
  62. # --leak-check=full
  63. valgrind --suppressions=valgrind.supp ./$< -d
  64. clean:
  65. rm -rfv $(TARGET) libRack.a Rack.res build dist
  66. ifdef ARCH_WIN
  67. # For Windows resources
  68. %.res: %.rc
  69. windres $^ -O coff -o $@
  70. endif
  71. # This target is not intended for public use
  72. dist: $(TARGET)
  73. rm -rf dist
  74. mkdir -p dist
  75. $(MAKE) -C plugins/Fundamental dist
  76. ifdef ARCH_LIN
  77. mkdir -p dist/Rack
  78. cp $(TARGET) dist/Rack/
  79. $(STRIP) -s dist/Rack/$(TARGET)
  80. cp -R LICENSE* res Core.json template.vcv dist/Rack/
  81. # Manually check that no nonstandard shared libraries are linked
  82. ldd dist/Rack/$(TARGET)
  83. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  84. # Make ZIP
  85. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip Rack
  86. endif
  87. ifdef ARCH_MAC
  88. mkdir -p dist/$(TARGET).app
  89. mkdir -p dist/$(TARGET).app/Contents
  90. cp Info.plist dist/$(TARGET).app/Contents/
  91. $(SED) 's/{VERSION}/$(VERSION)/g' dist/$(TARGET).app/Contents/Info.plist
  92. mkdir -p dist/$(TARGET).app/Contents/MacOS
  93. cp $(TARGET) dist/$(TARGET).app/Contents/MacOS/
  94. $(STRIP) -S dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  95. mkdir -p dist/$(TARGET).app/Contents/Resources
  96. cp -R LICENSE* res Core.json template.vcv icon.icns dist/$(TARGET).app/Contents/Resources
  97. # Manually check that no nonstandard shared libraries are linked
  98. otool -L dist/$(TARGET).app/Contents/MacOS/$(TARGET)
  99. cp plugins/Fundamental/dist/*.zip dist/$(TARGET).app/Contents/Resources/Fundamental.zip
  100. # Clean up and sign bundle
  101. xattr -cr dist/$(TARGET).app
  102. codesign --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --verbose dist/$(TARGET).app
  103. codesign --verify --verbose dist/$(TARGET).app
  104. spctl --assess --verbose dist/$(TARGET).app
  105. # Make ZIP
  106. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip $(TARGET).app
  107. endif
  108. ifdef ARCH_WIN
  109. mkdir -p dist/Rack
  110. cp $(TARGET) dist/Rack/
  111. $(STRIP) -s dist/Rack/$(TARGET)
  112. cp -R LICENSE* res Core.json template.vcv dist/Rack/
  113. cp /mingw64/bin/libwinpthread-1.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 plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  117. # Make ZIP
  118. cd dist && zip -q -9 -r Rack-$(VERSION)-$(ARCH).zip Rack
  119. # Make NSIS installer
  120. # pacman -S mingw-w64-x86_64-nsis
  121. makensis -DVERSION=$(VERSION) installer.nsi
  122. mv installer.exe dist/Rack-$(VERSION)-$(ARCH).exe
  123. endif
  124. # Rack SDK
  125. mkdir -p dist/Rack-SDK
  126. cp LICENSE* dist/Rack-SDK/
  127. cp *.mk dist/Rack-SDK/
  128. cp -R include dist/Rack-SDK/
  129. mkdir -p dist/Rack-SDK/dep/
  130. cp -R dep/include dist/Rack-SDK/dep/
  131. cp helper.py dist/Rack-SDK/
  132. ifdef ARCH_WIN
  133. cp libRack.a dist/Rack-SDK/
  134. endif
  135. cd dist && zip -q -9 -r Rack-SDK-$(VERSION).zip Rack-SDK
  136. # Obviously this will only work if you have the private keys to my server
  137. UPLOAD_URL := vortico@vcvrack.com:files/
  138. upload:
  139. ifdef ARCH_MAC
  140. rsync dist/*.zip $(UPLOAD_URL) -zP
  141. endif
  142. ifdef ARCH_WIN
  143. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  144. endif
  145. ifdef ARCH_LIN
  146. rsync dist/*.zip $(UPLOAD_URL) -zP
  147. endif
  148. # Plugin helpers
  149. plugins:
  150. ifdef CMD
  151. for f in plugins/*; do (cd "$$f" && $(CMD)); done
  152. else
  153. for f in plugins/*; do $(MAKE) -C "$$f"; done
  154. endif
  155. # Includes
  156. include compile.mk
  157. .PHONY: all dep run debug clean dist plugins cleanplugins distplugins cmdplugins
  158. .DEFAULT_GOAL := all