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

8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. RACK_DIR ?= .
  2. VERSION = 1.dev.$(shell git rev-parse --short HEAD)
  3. FLAGS += -DVERSION=$(VERSION)
  4. FLAGS += -Iinclude
  5. FLAGS += -Idep/include -Idep/lib/libzip/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. CFLAGS += $(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 --args ./$< -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. 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 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 -5 -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 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. # Make ZIP
  101. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip $(TARGET).app
  102. endif
  103. ifdef ARCH_WIN
  104. mkdir -p dist/Rack
  105. cp $(TARGET) dist/Rack/
  106. $(STRIP) -s dist/Rack/$(TARGET)
  107. cp -R LICENSE* res template.vcv dist/Rack/
  108. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  109. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  110. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  111. cp plugins/Fundamental/dist/*.zip dist/Rack/Fundamental.zip
  112. # Make ZIP
  113. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  114. # Make NSIS installer
  115. # pacman -S mingw-w64-x86_64-nsis
  116. makensis -DVERSION=$(VERSION) installer.nsi
  117. mv installer.exe dist/Rack-$(VERSION)-$(ARCH).exe
  118. endif
  119. # Rack SDK
  120. mkdir -p dist/Rack-SDK
  121. cp LICENSE* dist/Rack-SDK/
  122. cp *.mk dist/Rack-SDK/
  123. cp -R include dist/Rack-SDK/
  124. mkdir -p dist/Rack-SDK/dep/
  125. cp -R dep/include dist/Rack-SDK/dep/
  126. ifdef ARCH_WIN
  127. cp libRack.a dist/Rack-SDK/
  128. endif
  129. cd dist && zip -5 -r Rack-SDK-$(VERSION).zip Rack-SDK
  130. # Obviously this will only work if you have the private keys to my server
  131. UPLOAD_URL := vortico@vcvrack.com:files/
  132. upload:
  133. ifdef ARCH_MAC
  134. rsync dist/*.zip $(UPLOAD_URL) -zP
  135. endif
  136. ifdef ARCH_WIN
  137. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  138. endif
  139. ifdef ARCH_LIN
  140. rsync dist/*.zip $(UPLOAD_URL) -zP
  141. endif
  142. # Plugin helpers
  143. plugins:
  144. for f in plugins/*; do $(MAKE) -C "$$f"; done
  145. cleanplugins:
  146. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  147. distplugins:
  148. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  149. cmdplugins:
  150. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  151. # Includes
  152. include compile.mk
  153. .PHONY: all dep run debug clean dist plugins cleanplugins distplugins cmdplugins
  154. .DEFAULT_GOAL := all