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.3KB

8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. RACK_DIR ?= .
  2. VERSION = 1.dev
  3. FLAGS += -DVERSION=$(VERSION)
  4. FLAGS += -Iinclude
  5. FLAGS += -Idep/include -Idep/lib/libzip/include
  6. FLAGS += -fopenmp
  7. LDFLAGS += -fopenmp
  8. include arch.mk
  9. SED := perl -pi -e
  10. # Sources and build flags
  11. SOURCES += dep/nanovg/src/nanovg.c
  12. SOURCES += dep/osdialog/osdialog.c
  13. SOURCES += $(wildcard dep/jpommier-pffft-*/pffft.c) $(wildcard dep/jpommier-pffft-*/fftpack.c)
  14. SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
  15. ifdef ARCH_MAC
  16. SOURCES += dep/osdialog/osdialog_mac.m
  17. CXXFLAGS += -stdlib=libc++
  18. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  19. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI \
  20. -Ldep/lib 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
  21. TARGET := Rack
  22. BUNDLE := dist/$(TARGET).app
  23. endif
  24. ifdef ARCH_WIN
  25. SOURCES += dep/osdialog/osdialog_win.c
  26. LDFLAGS += -static \
  27. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  28. -Ldep/lib -lglew32 -lglfw3 -ljansson -lspeexdsp -lzip -lz -lcurl -lssl -lcrypto -lrtaudio -lrtmidi \
  29. -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi
  30. TARGET := Rack.exe
  31. OBJECTS += Rack.res
  32. endif
  33. ifdef ARCH_LIN
  34. SOURCES += dep/osdialog/osdialog_gtk2.c
  35. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  36. LDFLAGS += -rdynamic \
  37. -Ldep/lib \
  38. -Wl,-Bstatic -lglfw3 -lGLEW -ljansson -lspeexdsp -lzip -lz -lrtmidi -lrtaudio -lcurl -lssl -lcrypto \
  39. -Wl,-Bdynamic -lpthread -lGL -ldl -lX11 -lasound -ljack \
  40. $(shell pkg-config --libs gtk+-2.0)
  41. TARGET := Rack
  42. endif
  43. # Convenience targets
  44. all: $(TARGET)
  45. dep:
  46. $(MAKE) -C dep
  47. run: $(TARGET)
  48. ./$< -d
  49. runr: $(TARGET)
  50. ./$<
  51. debug: $(TARGET)
  52. ifdef ARCH_MAC
  53. lldb --args ./$< -d
  54. endif
  55. ifdef ARCH_WIN
  56. gdb --args ./$< -d
  57. endif
  58. ifdef ARCH_LIN
  59. gdb --args ./$< -d
  60. endif
  61. perf: $(TARGET)
  62. # Requires gperftools
  63. ifdef ARCH_LIN
  64. perf record --call-graph dwarf -o perf.data ./$< -d
  65. endif
  66. # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
  67. # hotspot perf.data
  68. clean:
  69. rm -rfv $(TARGET) libRack.a Rack.res build dist
  70. ifdef ARCH_WIN
  71. # For Windows resources
  72. %.res: %.rc
  73. windres $^ -O coff -o $@
  74. endif
  75. # This target is not intended for public use
  76. dist: all
  77. rm -rf dist
  78. mkdir -p dist
  79. @# Rack
  80. $(MAKE) -C plugins/Fundamental dist
  81. ifdef ARCH_MAC
  82. mkdir -p $(BUNDLE)
  83. mkdir -p $(BUNDLE)/Contents
  84. mkdir -p $(BUNDLE)/Contents/Resources
  85. cp Info.plist $(BUNDLE)/Contents/
  86. $(SED) 's/{VERSION}/$(VERSION)/g' $(BUNDLE)/Contents/Info.plist
  87. cp -R LICENSE* icon.icns res $(BUNDLE)/Contents/Resources
  88. mkdir -p $(BUNDLE)/Contents/MacOS
  89. cp $(TARGET) $(BUNDLE)/Contents/MacOS/
  90. $(STRIP) -S $(BUNDLE)/Contents/MacOS/$(TARGET)
  91. otool -L $(BUNDLE)/Contents/MacOS/$(TARGET)
  92. cp plugins/Fundamental/dist/Fundamental-*.zip $(BUNDLE)/Contents/Resources/Fundamental.zip
  93. cp -R Bridge/AU/dist/VCV-Bridge.component dist/
  94. cp -R Bridge/VST/dist/VCV-Bridge.vst dist/
  95. cp -R Bridge/VST/dist/VCV-Bridge-fx.vst dist/
  96. @# Make DMG image
  97. cd dist && ln -s /Applications Applications
  98. cd dist && ln -s /Library/Audio/Plug-Ins/Components Components
  99. cd dist && ln -s /Library/Audio/Plug-Ins/VST VST
  100. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  101. endif
  102. ifdef ARCH_WIN
  103. mkdir -p dist/Rack
  104. mkdir -p dist/Rack/Bridge
  105. cp Bridge/VST/dist/VCV-Bridge-{32,64,fx-32,fx-64}.dll dist/Rack/Bridge/
  106. cp -R LICENSE* res dist/Rack/
  107. cp $(TARGET) dist/Rack/
  108. $(STRIP) -s dist/Rack/$(TARGET)
  109. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  110. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  111. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  112. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  113. @# Make ZIP
  114. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  115. @# Make NSIS installer
  116. makensis installer.nsi
  117. mv Rack-setup.exe dist/Rack-$(VERSION)-$(ARCH).exe
  118. endif
  119. ifdef ARCH_LIN
  120. mkdir -p dist/Rack
  121. mkdir -p dist/Rack/Bridge
  122. cp Bridge/VST/dist/VCV-Bridge{,-fx}.so dist/Rack/Bridge/
  123. cp -R LICENSE* res dist/Rack/
  124. cp $(TARGET) dist/Rack/
  125. $(STRIP) -s dist/Rack/$(TARGET)
  126. ldd dist/Rack/$(TARGET)
  127. cp plugins/Fundamental/dist/Fundamental-*.zip dist/Rack/Fundamental.zip
  128. @# Make ZIP
  129. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  130. endif
  131. @# Rack SDK
  132. mkdir -p dist/Rack-SDK
  133. cp LICENSE* dist/Rack-SDK/
  134. cp *.mk dist/Rack-SDK/
  135. cp -R include dist/Rack-SDK/
  136. mkdir -p dist/Rack-SDK/dep/
  137. cp -R dep/include dist/Rack-SDK/dep/
  138. ifdef ARCH_WIN
  139. cp libRack.a dist/Rack-SDK/
  140. endif
  141. cd dist && zip -5 -r Rack-SDK-$(VERSION)-$(ARCH).zip Rack-SDK
  142. # Obviously this will only work if you have the private keys to my server
  143. UPLOAD_URL := vortico@vcvrack.com:files/
  144. upload:
  145. ifdef ARCH_MAC
  146. rsync dist/*.{dmg,zip} $(UPLOAD_URL) -zP
  147. endif
  148. ifdef ARCH_WIN
  149. rsync dist/*.{exe,zip} $(UPLOAD_URL) -P
  150. endif
  151. ifdef ARCH_LIN
  152. rsync dist/*.zip $(UPLOAD_URL) -zP
  153. endif
  154. # Plugin helpers
  155. plugins:
  156. for f in plugins/*; do $(MAKE) -C "$$f"; done
  157. cleanplugins:
  158. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  159. distplugins:
  160. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  161. cmdplugins:
  162. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  163. # Includes
  164. include compile.mk
  165. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins
  166. .DEFAULT_GOAL := all