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.

255 lines
6.9KB

  1. #!/usr/bin/make -f
  2. # Makefile for DISTRHO Plugins #
  3. # ---------------------------- #
  4. # Created by falkTX
  5. #
  6. # --------------------------------------------------------------
  7. # Import base definitions
  8. USE_NANOVG_FBO = true
  9. include dpf/Makefile.base.mk
  10. # --------------------------------------------------------------
  11. # Build targets
  12. all: cardinal carla deps dgl plugins gen resources
  13. # --------------------------------------------------------------
  14. # Build config
  15. PREFIX ?= /usr/local
  16. DESTDIR ?=
  17. ifeq ($(BSD),true)
  18. SYSDEPS ?= true
  19. else
  20. SYSDEPS ?= false
  21. endif
  22. # --------------------------------------------------------------
  23. # Carla config
  24. CARLA_EXTRA_ARGS = \
  25. HAVE_FFMPEG=false \
  26. HAVE_FLUIDSYNTH=false \
  27. HAVE_PROJECTM=false \
  28. HAVE_ZYN_DEPS=false \
  29. HAVE_ZYN_UI_DEPS=false
  30. ifneq ($(DEBUG),true)
  31. CARLA_EXTRA_ARGS += EXTERNAL_PLUGINS=true
  32. endif
  33. CARLA_EXTRA_ARGS += USING_JUCE=false
  34. CARLA_EXTRA_ARGS += USING_JUCE_GUI_EXTRA=false
  35. # --------------------------------------------------------------
  36. # Check for system-wide dependencies
  37. ifeq ($(SYSDEPS),true)
  38. ifneq ($(shell pkg-config --exists jansson && echo true),true)
  39. $(error jansson dependency not installed/available)
  40. endif
  41. ifneq ($(shell pkg-config --exists libarchive && echo true),true)
  42. $(error libarchive dependency not installed/available)
  43. endif
  44. ifneq ($(shell pkg-config --exists samplerate && echo true),true)
  45. $(error samplerate dependency not installed/available)
  46. endif
  47. ifneq ($(shell pkg-config --exists speexdsp && echo true),true)
  48. $(error speexdsp dependency not installed/available)
  49. endif
  50. endif
  51. ifeq ($(HEADLESS),true)
  52. ifneq ($(shell pkg-config --exists liblo && echo true),true)
  53. $(error liblo dependency not installed/available)
  54. endif
  55. endif
  56. # --------------------------------------------------------------
  57. # Check for X11+OpenGL dependencies (unless headless build)
  58. ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
  59. ifneq ($(WASM),true)
  60. ifneq ($(HEADLESS),true)
  61. ifneq ($(HAVE_OPENGL),true)
  62. $(error OpenGL dependency not installed/available)
  63. endif
  64. ifneq ($(HAVE_X11),true)
  65. $(error X11 dependency not installed/available)
  66. endif
  67. ifneq ($(HAVE_XEXT),true)
  68. $(warning Xext dependency not installed/available)
  69. endif
  70. ifneq ($(HAVE_XRANDR),true)
  71. $(warning Xrandr dependency not installed/available)
  72. endif
  73. else
  74. CARLA_EXTRA_ARGS += HAVE_OPENGL=false
  75. CARLA_EXTRA_ARGS += HAVE_X11=false
  76. CARLA_EXTRA_ARGS += HAVE_XEXT=false
  77. CARLA_EXTRA_ARGS += HAVE_XRANDR=false
  78. endif
  79. endif
  80. endif
  81. # --------------------------------------------------------------
  82. # MOD builds
  83. MOD_WORKDIR ?= $(HOME)/mod-workdir
  84. MOD_ENVIRONMENT = \
  85. AR=${1}/host/usr/bin/${2}-gcc-ar \
  86. CC=${1}/host/usr/bin/${2}-gcc \
  87. CPP=${1}/host/usr/bin/${2}-cpp \
  88. CXX=${1}/host/usr/bin/${2}-g++ \
  89. LD=${1}/host/usr/bin/${2}-ld \
  90. PKG_CONFIG=${1}/host/usr/bin/pkg-config \
  91. STRIP=${1}/host/usr/bin/${2}-strip \
  92. CFLAGS="-I${1}/staging/usr/include -fsingle-precision-constant" \
  93. CPPFLAGS= \
  94. CXXFLAGS="-I${1}/staging/usr/include -I../include/single-precision -fsingle-precision-constant -Wno-attributes" \
  95. LDFLAGS="-L${1}/staging/usr/lib" \
  96. EXE_WRAPPER="qemu-${3}-static -L ${1}/target" \
  97. HEADLESS=true \
  98. MOD_BUILD=true \
  99. NOOPT=true \
  100. STATIC_BUILD=true
  101. modduo:
  102. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm)
  103. modduox:
  104. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64)
  105. moddwarf:
  106. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64)
  107. publish:
  108. tar -C bin -cz $(subst bin/,,$(wildcard bin/*.lv2)) | base64 | curl -F 'package=@-' http://192.168.51.1/sdk/install && echo
  109. ifneq (,$(findstring modduo-,$(MAKECMDGOALS)))
  110. $(MAKECMDGOALS):
  111. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduo-static,arm-mod-linux-gnueabihf.static,arm) $(subst modduo-,,$(MAKECMDGOALS))
  112. endif
  113. ifneq (,$(findstring modduox-,$(MAKECMDGOALS)))
  114. $(MAKECMDGOALS):
  115. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/modduox-static,aarch64-mod-linux-gnueabi.static,aarch64) $(subst modduox-,,$(MAKECMDGOALS))
  116. endif
  117. ifneq (,$(findstring moddwarf-,$(MAKECMDGOALS)))
  118. $(MAKECMDGOALS):
  119. $(MAKE) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR)/moddwarf,aarch64-mod-linux-gnu,aarch64) $(subst moddwarf-,,$(MAKECMDGOALS))
  120. endif
  121. # --------------------------------------------------------------
  122. # Individual targets
  123. cardinal: carla deps dgl plugins
  124. $(MAKE) all -C src $(CARLA_EXTRA_ARGS)
  125. carla:
  126. ifneq ($(STATIC_BUILD),true)
  127. $(MAKE) static-plugin -C carla $(CARLA_EXTRA_ARGS) \
  128. CAN_GENERATE_LV2_TTL=false \
  129. STATIC_PLUGIN_TARGET=true
  130. endif
  131. deps:
  132. ifeq ($(SYSDEPS),true)
  133. $(MAKE) quickjs -C deps
  134. else
  135. $(MAKE) all -C deps
  136. endif
  137. dgl:
  138. ifneq ($(HEADLESS),true)
  139. $(MAKE) -C dpf/dgl opengl NVG_DISABLE_SKIPPING_WHITESPACE=true NVG_FONT_TEXTURE_FLAGS=NVG_IMAGE_NEAREST USE_NANOVG_FBO=true
  140. endif
  141. plugins: deps
  142. $(MAKE) all -C plugins
  143. resources: cardinal
  144. $(MAKE) resources -C plugins
  145. ifneq ($(CROSS_COMPILING),true)
  146. gen: cardinal resources dpf/utils/lv2_ttl_generator
  147. @$(CURDIR)/dpf/utils/generate-ttl.sh
  148. dpf/utils/lv2_ttl_generator:
  149. $(MAKE) -C dpf/utils/lv2-ttl-generator
  150. else
  151. gen:
  152. endif
  153. # --------------------------------------------------------------
  154. # Packaging standalone for CI
  155. unzipfx: deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip
  156. cat deps/unzipfx/unzipfx2cat$(APP_EXT) Cardinal.zip > Cardinal
  157. chmod +x Cardinal
  158. Cardinal.zip: bin/Cardinal bin/CardinalFX.lv2/resources
  159. mkdir -p build/unzipfx
  160. ln -sf ../../bin/Cardinal build/unzipfx/Cardinal
  161. ln -s ../../bin/CardinalFX.lv2/resources build/unzipfx/resources
  162. cd build/unzipfx && \
  163. zip -r -9 ../../Cardinal.zip Cardinal resources
  164. deps/unzipfx/unzipfx2cat:
  165. make -C deps/unzipfx -f Makefile.linux
  166. deps/unzipfx/unzipfx2cat.exe:
  167. make -C deps/unzipfx -f Makefile.win32
  168. # --------------------------------------------------------------
  169. # Clean step
  170. clean:
  171. $(MAKE) distclean -C carla
  172. $(MAKE) clean -C deps
  173. $(MAKE) clean -C dpf/dgl
  174. $(MAKE) clean -C dpf/utils/lv2-ttl-generator
  175. $(MAKE) clean -C plugins
  176. $(MAKE) clean -C src
  177. rm -rf bin build
  178. # --------------------------------------------------------------
  179. # Install step
  180. install:
  181. install -d $(DESTDIR)$(PREFIX)/bin
  182. install -d $(DESTDIR)$(PREFIX)/lib/lv2
  183. install -d $(DESTDIR)$(PREFIX)/lib/vst
  184. install -d $(DESTDIR)$(PREFIX)/lib/vst3
  185. install -d $(DESTDIR)$(PREFIX)/share/Cardinal
  186. cp -rL bin/Cardinal.lv2 $(DESTDIR)$(PREFIX)/lib/lv2/
  187. cp -rL bin/Cardinal.vst3 $(DESTDIR)$(PREFIX)/lib/vst3/
  188. cp -rL bin/CardinalFX.lv2 $(DESTDIR)$(PREFIX)/lib/lv2/
  189. cp -rL bin/CardinalFX.vst $(DESTDIR)$(PREFIX)/lib/vst/
  190. cp -rL bin/CardinalFX.vst3 $(DESTDIR)$(PREFIX)/lib/vst3/
  191. cp -rL bin/CardinalSynth.lv2 $(DESTDIR)$(PREFIX)/lib/lv2/
  192. cp -rL bin/CardinalSynth.vst $(DESTDIR)$(PREFIX)/lib/vst/
  193. cp -rL bin/CardinalSynth.vst3 $(DESTDIR)$(PREFIX)/lib/vst3/
  194. install -m 755 bin/Cardinal$(APP_EXT) $(DESTDIR)$(PREFIX)/bin/
  195. cp -rL bin/Cardinal.lv2/resources/* $(DESTDIR)$(PREFIX)/share/Cardinal/
  196. # --------------------------------------------------------------
  197. .PHONY: carla deps plugins