DISTRHO Plugin Framework
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.

668 lines
18KB

  1. #!/usr/bin/make -f
  2. # Makefile for DPF #
  3. # ---------------- #
  4. # Created by falkTX
  5. #
  6. AR ?= ar
  7. CC ?= gcc
  8. CXX ?= g++
  9. # ---------------------------------------------------------------------------------------------------------------------
  10. # Protect against multiple inclusion
  11. ifneq ($(DPF_MAKEFILE_BASE_INCLUDED),true)
  12. DPF_MAKEFILE_BASE_INCLUDED = true
  13. # ---------------------------------------------------------------------------------------------------------------------
  14. # Auto-detect OS if not defined
  15. TARGET_MACHINE := $(shell $(CC) -dumpmachine)
  16. ifneq ($(BSD),true)
  17. ifneq ($(HAIKU),true)
  18. ifneq ($(HURD),true)
  19. ifneq ($(LINUX),true)
  20. ifneq ($(MACOS),true)
  21. ifneq ($(WASM),true)
  22. ifneq ($(WINDOWS),true)
  23. ifneq (,$(findstring bsd,$(TARGET_MACHINE)))
  24. BSD = true
  25. else ifneq (,$(findstring haiku,$(TARGET_MACHINE)))
  26. HAIKU = true
  27. else ifneq (,$(findstring linux,$(TARGET_MACHINE)))
  28. LINUX = true
  29. else ifneq (,$(findstring gnu,$(TARGET_MACHINE)))
  30. HURD = true
  31. else ifneq (,$(findstring apple,$(TARGET_MACHINE)))
  32. MACOS = true
  33. else ifneq (,$(findstring mingw,$(TARGET_MACHINE)))
  34. WINDOWS = true
  35. else ifneq (,$(findstring msys,$(TARGET_MACHINE)))
  36. WINDOWS = true
  37. else ifneq (,$(findstring wasm,$(TARGET_MACHINE)))
  38. WASM = true
  39. else ifneq (,$(findstring windows,$(TARGET_MACHINE)))
  40. WINDOWS = true
  41. endif
  42. endif # WINDOWS
  43. endif # WASM
  44. endif # MACOS
  45. endif # LINUX
  46. endif # HURD
  47. endif # HAIKU
  48. endif # BSD
  49. # ---------------------------------------------------------------------------------------------------------------------
  50. # Auto-detect the processor
  51. TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE)))
  52. ifneq (,$(filter i%86,$(TARGET_PROCESSOR)))
  53. CPU_I386 = true
  54. CPU_I386_OR_X86_64 = true
  55. endif
  56. ifneq (,$(filter wasm32,$(TARGET_PROCESSOR)))
  57. CPU_I386 = true
  58. CPU_I386_OR_X86_64 = true
  59. endif
  60. ifneq (,$(filter x86_64,$(TARGET_PROCESSOR)))
  61. CPU_X86_64 = true
  62. CPU_I386_OR_X86_64 = true
  63. endif
  64. ifneq (,$(filter arm%,$(TARGET_PROCESSOR)))
  65. CPU_ARM = true
  66. CPU_ARM_OR_AARCH64 = true
  67. endif
  68. ifneq (,$(filter arm64%,$(TARGET_PROCESSOR)))
  69. CPU_ARM64 = true
  70. CPU_ARM_OR_AARCH64 = true
  71. endif
  72. ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR)))
  73. CPU_AARCH64 = true
  74. CPU_ARM_OR_AARCH64 = true
  75. endif
  76. # ---------------------------------------------------------------------------------------------------------------------
  77. # Set PKG_CONFIG (can be overridden by environment variable)
  78. ifeq ($(WASM),true)
  79. # Skip on wasm by default
  80. PKG_CONFIG ?= false
  81. else ifeq ($(WINDOWS),true)
  82. # Build statically on Windows by default
  83. PKG_CONFIG ?= pkg-config --static
  84. else
  85. PKG_CONFIG ?= pkg-config
  86. endif
  87. # ---------------------------------------------------------------------------------------------------------------------
  88. # Set cross compiling flag
  89. ifeq ($(WASM),true)
  90. CROSS_COMPILING = true
  91. endif
  92. # ---------------------------------------------------------------------------------------------------------------------
  93. # Set LINUX_OR_MACOS
  94. ifeq ($(LINUX),true)
  95. LINUX_OR_MACOS = true
  96. endif
  97. ifeq ($(MACOS),true)
  98. LINUX_OR_MACOS = true
  99. endif
  100. # ---------------------------------------------------------------------------------------------------------------------
  101. # Set MACOS_OR_WINDOWS, MACOS_OR_WASM_OR_WINDOWS, HAIKU_OR_MACOS_OR_WINDOWS and HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS
  102. ifeq ($(HAIKU),true)
  103. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  104. HAIKU_OR_MACOS_OR_WINDOWS = true
  105. endif
  106. ifeq ($(MACOS),true)
  107. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  108. HAIKU_OR_MACOS_OR_WINDOWS = true
  109. MACOS_OR_WASM_OR_WINDOWS = true
  110. MACOS_OR_WINDOWS = true
  111. endif
  112. ifeq ($(WASM),true)
  113. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  114. MACOS_OR_WASM_OR_WINDOWS = true
  115. endif
  116. ifeq ($(WINDOWS),true)
  117. HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS = true
  118. HAIKU_OR_MACOS_OR_WINDOWS = true
  119. MACOS_OR_WASM_OR_WINDOWS = true
  120. MACOS_OR_WINDOWS = true
  121. endif
  122. # ---------------------------------------------------------------------------------------------------------------------
  123. # Set UNIX
  124. ifeq ($(BSD),true)
  125. UNIX = true
  126. endif
  127. ifeq ($(HURD),true)
  128. UNIX = true
  129. endif
  130. ifeq ($(LINUX),true)
  131. UNIX = true
  132. endif
  133. ifeq ($(MACOS),true)
  134. UNIX = true
  135. endif
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. # Set build and link flags
  138. BASE_FLAGS = -Wall -Wextra -pipe -MD -MP
  139. BASE_OPTS = -O3 -ffast-math -fdata-sections -ffunction-sections
  140. ifeq ($(CPU_I386_OR_X86_64),true)
  141. BASE_OPTS += -mtune=generic
  142. ifeq ($(WASM),true)
  143. BASE_OPTS += -msse -msse2 -msse3 -msimd128
  144. else
  145. BASE_OPTS += -msse -msse2 -mfpmath=sse
  146. endif
  147. endif
  148. ifeq ($(CPU_ARM),true)
  149. ifneq ($(CPU_ARM64),true)
  150. BASE_OPTS += -mfpu=neon-vfpv4 -mfloat-abi=hard
  151. endif
  152. endif
  153. ifeq ($(MACOS),true)
  154. # MacOS linker flags
  155. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip,-dead_strip_dylibs
  156. ifneq ($(SKIP_STRIPPING),true)
  157. LINK_OPTS += -Wl,-x
  158. endif
  159. else
  160. # Common linker flags
  161. LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1,--gc-sections
  162. ifeq ($(WASM),true)
  163. LINK_OPTS += -O3
  164. LINK_OPTS += -sAGGRESSIVE_VARIABLE_ELIMINATION=1
  165. else
  166. LINK_OPTS += -Wl,--as-needed
  167. ifneq ($(SKIP_STRIPPING),true)
  168. LINK_OPTS += -Wl,--strip-all
  169. endif
  170. endif
  171. endif
  172. ifeq ($(SKIP_STRIPPING),true)
  173. BASE_FLAGS += -g
  174. endif
  175. ifeq ($(NOOPT),true)
  176. # Non-CPU-specific optimization flags
  177. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  178. endif
  179. ifneq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  180. ifneq ($(BSD),true)
  181. BASE_FLAGS += -fno-gnu-unique
  182. endif
  183. endif
  184. ifeq ($(WINDOWS),true)
  185. # Assume we want posix
  186. BASE_FLAGS += -posix -D__STDC_FORMAT_MACROS=1 -D__USE_MINGW_ANSI_STDIO=1
  187. # Needed for windows, see https://github.com/falkTX/Carla/issues/855
  188. BASE_FLAGS += -mstackrealign
  189. else
  190. # Not needed for Windows
  191. BASE_FLAGS += -fPIC -DPIC
  192. endif
  193. ifeq ($(DEBUG),true)
  194. BASE_FLAGS += -DDEBUG -O0 -g
  195. LINK_OPTS =
  196. ifeq ($(WASM),true)
  197. LINK_OPTS += -sASSERTIONS=1
  198. endif
  199. else
  200. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  201. CXXFLAGS += -fvisibility-inlines-hidden
  202. endif
  203. ifeq ($(STATIC_BUILD),true)
  204. BASE_FLAGS += -DSTATIC_BUILD
  205. # LINK_OPTS += -static
  206. endif
  207. ifeq ($(WITH_LTO),true)
  208. BASE_FLAGS += -fno-strict-aliasing -flto
  209. LINK_OPTS += -fno-strict-aliasing -flto -Werror=odr -Werror=lto-type-mismatch
  210. endif
  211. BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS)
  212. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++11 $(CXXFLAGS)
  213. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  214. ifeq ($(WASM),true)
  215. # Special flag for emscripten
  216. LINK_FLAGS += -sENVIRONMENT=web -sLLD_REPORT_UNDEFINED
  217. else ifneq ($(MACOS),true)
  218. # Not available on MacOS
  219. LINK_FLAGS += -Wl,--no-undefined
  220. endif
  221. ifeq ($(MACOS_OLD),true)
  222. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) -DHAVE_CPP11_SUPPORT=0
  223. endif
  224. ifeq ($(WASM_CLIPBOARD),true)
  225. BUILD_CXX_FLAGS += -DPUGL_WASM_ASYNC_CLIPBOARD
  226. LINK_FLAGS += -sASYNCIFY -sASYNCIFY_IMPORTS=puglGetAsyncClipboardData
  227. endif
  228. ifeq ($(WASM_EXCEPTIONS),true)
  229. BUILD_CXX_FLAGS += -fexceptions
  230. LINK_FLAGS += -fexceptions
  231. endif
  232. ifeq ($(WINDOWS),true)
  233. # Always build statically on windows
  234. LINK_FLAGS += -static -static-libgcc -static-libstdc++
  235. endif
  236. # ---------------------------------------------------------------------------------------------------------------------
  237. # Strict test build
  238. ifeq ($(TESTBUILD),true)
  239. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
  240. BASE_FLAGS += -Wpointer-arith -Wabi=98 -Winit-self -Wuninitialized -Wstrict-overflow=5
  241. # BASE_FLAGS += -Wfloat-equal
  242. ifeq ($(CC),clang)
  243. BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
  244. BASE_FLAGS += -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-exit-time-destructors -Wno-float-equal
  245. else
  246. BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
  247. endif
  248. ifneq ($(MACOS),true)
  249. BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
  250. ifneq ($(CC),clang)
  251. BASE_FLAGS += -Wlogical-op
  252. endif
  253. endif
  254. CFLAGS += -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
  255. CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
  256. endif
  257. # ---------------------------------------------------------------------------------------------------------------------
  258. # Check for required libraries
  259. HAVE_CAIRO = $(shell $(PKG_CONFIG) --exists cairo && echo true)
  260. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  261. HAVE_OPENGL = true
  262. else
  263. HAVE_OPENGL = $(shell $(PKG_CONFIG) --exists gl && echo true)
  264. HAVE_DBUS = $(shell $(PKG_CONFIG) --exists dbus-1 && echo true)
  265. HAVE_X11 = $(shell $(PKG_CONFIG) --exists x11 && echo true)
  266. HAVE_XCURSOR = $(shell $(PKG_CONFIG) --exists xcursor && echo true)
  267. HAVE_XEXT = $(shell $(PKG_CONFIG) --exists xext && echo true)
  268. HAVE_XRANDR = $(shell $(PKG_CONFIG) --exists xrandr && echo true)
  269. endif
  270. # Vulkan is not supported yet
  271. # HAVE_VULKAN = $(shell $(PKG_CONFIG) --exists vulkan && echo true)
  272. # ---------------------------------------------------------------------------------------------------------------------
  273. # Check for optional libraries
  274. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  275. ifneq ($(SKIP_NATIVE_AUDIO_FALLBACK),true)
  276. ifneq ($(SKIP_RTAUDIO_FALLBACK),true)
  277. ifeq ($(MACOS),true)
  278. HAVE_RTAUDIO = true
  279. else ifeq ($(WINDOWS),true)
  280. HAVE_RTAUDIO = true
  281. else
  282. HAVE_ALSA = $(shell $(PKG_CONFIG) --exists alsa && echo true)
  283. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  284. HAVE_SDL2 = $(shell $(PKG_CONFIG) --exists sdl2 && echo true)
  285. ifeq ($(HAVE_ALSA),true)
  286. HAVE_RTAUDIO = true
  287. else ifeq ($(HAVE_PULSEAUDIO),true)
  288. HAVE_RTAUDIO = true
  289. endif
  290. endif
  291. endif
  292. endif
  293. # backwards compat, always available/enabled
  294. ifneq ($(FORCE_NATIVE_AUDIO_FALLBACK),true)
  295. ifeq ($(STATIC_BUILD),true)
  296. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  297. else
  298. HAVE_JACK = true
  299. endif
  300. endif
  301. # ---------------------------------------------------------------------------------------------------------------------
  302. # Set Generic DGL stuff
  303. ifeq ($(HAIKU),true)
  304. DGL_SYSTEM_LIBS += -lbe
  305. else ifeq ($(MACOS),true)
  306. DGL_SYSTEM_LIBS += -framework Cocoa -framework CoreVideo
  307. else ifeq ($(WASM),true)
  308. else ifeq ($(WINDOWS),true)
  309. DGL_SYSTEM_LIBS += -lgdi32 -lcomdlg32
  310. # -lole32
  311. else
  312. ifeq ($(HAVE_DBUS),true)
  313. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags dbus-1) -DHAVE_DBUS
  314. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs dbus-1)
  315. endif
  316. ifeq ($(HAVE_X11),true)
  317. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11) -DHAVE_X11
  318. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11)
  319. ifeq ($(HAVE_XCURSOR),true)
  320. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xcursor) -DHAVE_XCURSOR
  321. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xcursor)
  322. endif
  323. ifeq ($(HAVE_XEXT),true)
  324. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xext) -DHAVE_XEXT -DHAVE_XSYNC
  325. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xext)
  326. endif
  327. ifeq ($(HAVE_XRANDR),true)
  328. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xrandr) -DHAVE_XRANDR
  329. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xrandr)
  330. endif
  331. endif
  332. endif
  333. # ---------------------------------------------------------------------------------------------------------------------
  334. # Set Cairo specific stuff
  335. ifeq ($(HAVE_CAIRO),true)
  336. DGL_FLAGS += -DHAVE_CAIRO
  337. CAIRO_FLAGS = $(shell $(PKG_CONFIG) --cflags cairo)
  338. CAIRO_LIBS = $(shell $(PKG_CONFIG) --libs cairo)
  339. HAVE_CAIRO_OR_OPENGL = true
  340. endif
  341. # ---------------------------------------------------------------------------------------------------------------------
  342. # Set OpenGL specific stuff
  343. ifeq ($(HAVE_OPENGL),true)
  344. DGL_FLAGS += -DHAVE_OPENGL
  345. ifeq ($(HAIKU),true)
  346. OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl)
  347. OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl)
  348. else ifeq ($(MACOS),true)
  349. OPENGL_FLAGS = -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations
  350. OPENGL_LIBS = -framework OpenGL
  351. else ifeq ($(WASM),true)
  352. ifeq ($(USE_GLES2),true)
  353. OPENGL_LIBS = -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2
  354. else
  355. ifneq ($(USE_GLES3),true)
  356. OPENGL_LIBS = -sLEGACY_GL_EMULATION -sGL_UNSAFE_OPTS=0
  357. endif
  358. endif
  359. else ifeq ($(WINDOWS),true)
  360. OPENGL_LIBS = -lopengl32
  361. else
  362. OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl x11)
  363. OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl x11)
  364. endif
  365. HAVE_CAIRO_OR_OPENGL = true
  366. endif
  367. # ---------------------------------------------------------------------------------------------------------------------
  368. # Set Stub specific stuff
  369. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  370. HAVE_STUB = true
  371. else
  372. HAVE_STUB = $(HAVE_X11)
  373. endif
  374. # ---------------------------------------------------------------------------------------------------------------------
  375. # Set Vulkan specific stuff
  376. ifeq ($(HAVE_VULKAN),true)
  377. DGL_FLAGS += -DHAVE_VULKAN
  378. VULKAN_FLAGS = $(shell $(PKG_CONFIG) --cflags vulkan)
  379. VULKAN_LIBS = $(shell $(PKG_CONFIG) --libs vulkan)
  380. ifneq ($(WINDOWS),true)
  381. VULKAN_LIBS += -ldl
  382. endif
  383. endif
  384. # ---------------------------------------------------------------------------------------------------------------------
  385. # Set optional libraries specific stuff
  386. ifeq ($(HAVE_ALSA),true)
  387. ALSA_FLAGS = $(shell $(PKG_CONFIG) --cflags alsa)
  388. ALSA_LIBS = $(shell $(PKG_CONFIG) --libs alsa)
  389. endif
  390. ifeq ($(HAVE_LIBLO),true)
  391. LIBLO_FLAGS = $(shell $(PKG_CONFIG) --cflags liblo)
  392. LIBLO_LIBS = $(shell $(PKG_CONFIG) --libs liblo)
  393. endif
  394. ifeq ($(HAVE_PULSEAUDIO),true)
  395. PULSEAUDIO_FLAGS = $(shell $(PKG_CONFIG) --cflags libpulse-simple)
  396. PULSEAUDIO_LIBS = $(shell $(PKG_CONFIG) --libs libpulse-simple)
  397. endif
  398. ifeq ($(HAVE_SDL2),true)
  399. SDL2_FLAGS = $(shell $(PKG_CONFIG) --cflags sdl2)
  400. SDL2_LIBS = $(shell $(PKG_CONFIG) --libs sdl2)
  401. endif
  402. ifeq ($(HAVE_JACK),true)
  403. ifeq ($(STATIC_BUILD),true)
  404. JACK_FLAGS = $(shell $(PKG_CONFIG) --cflags jack)
  405. JACK_LIBS = $(shell $(PKG_CONFIG) --libs jack)
  406. endif
  407. endif
  408. ifneq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS),true)
  409. SHARED_MEMORY_LIBS = -lrt
  410. endif
  411. # ---------------------------------------------------------------------------------------------------------------------
  412. # Backwards-compatible HAVE_DGL
  413. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  414. HAVE_DGL = true
  415. else ifeq ($(HAVE_OPENGL),true)
  416. HAVE_DGL = $(HAVE_X11)
  417. endif
  418. # ---------------------------------------------------------------------------------------------------------------------
  419. # Namespace flags
  420. ifneq ($(DISTRHO_NAMESPACE),)
  421. BUILD_CXX_FLAGS += -DDISTRHO_NAMESPACE=$(DISTRHO_NAMESPACE)
  422. endif
  423. ifneq ($(DGL_NAMESPACE),)
  424. BUILD_CXX_FLAGS += -DDGL_NAMESPACE=$(DGL_NAMESPACE)
  425. endif
  426. # ---------------------------------------------------------------------------------------------------------------------
  427. # Optional flags
  428. ifeq ($(NVG_DISABLE_SKIPPING_WHITESPACE),true)
  429. BUILD_CXX_FLAGS += -DNVG_DISABLE_SKIPPING_WHITESPACE
  430. endif
  431. ifneq ($(NVG_FONT_TEXTURE_FLAGS),)
  432. BUILD_CXX_FLAGS += -DNVG_FONT_TEXTURE_FLAGS=$(NVG_FONT_TEXTURE_FLAGS)
  433. endif
  434. ifeq ($(FILE_BROWSER_DISABLED),true)
  435. BUILD_CXX_FLAGS += -DDGL_FILE_BROWSER_DISABLED
  436. endif
  437. ifneq ($(WINDOWS_ICON_ID),)
  438. BUILD_CXX_FLAGS += -DDGL_WINDOWS_ICON_ID=$(WINDOWS_ICON_ID)
  439. endif
  440. ifeq ($(USE_GLES2),true)
  441. BUILD_CXX_FLAGS += -DDGL_USE_GLES -DDGL_USE_GLES2
  442. endif
  443. ifeq ($(USE_GLES3),true)
  444. BUILD_CXX_FLAGS += -DDGL_USE_GLES -DDGL_USE_GLES3
  445. endif
  446. ifeq ($(USE_OPENGL3),true)
  447. BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3
  448. endif
  449. ifeq ($(USE_NANOVG_FBO),true)
  450. BUILD_CXX_FLAGS += -DDGL_USE_NANOVG_FBO
  451. endif
  452. ifeq ($(USE_NANOVG_FREETYPE),true)
  453. BUILD_CXX_FLAGS += -DFONS_USE_FREETYPE $(shell $(PKG_CONFIG) --cflags freetype2)
  454. endif
  455. ifeq ($(USE_RGBA),true)
  456. BUILD_CXX_FLAGS += -DDGL_USE_RGBA
  457. endif
  458. # ---------------------------------------------------------------------------------------------------------------------
  459. # Set app extension
  460. ifeq ($(WASM),true)
  461. APP_EXT = .html
  462. else ifeq ($(WINDOWS),true)
  463. APP_EXT = .exe
  464. endif
  465. # ---------------------------------------------------------------------------------------------------------------------
  466. # Set shared lib extension
  467. ifeq ($(MACOS),true)
  468. LIB_EXT = .dylib
  469. else ifeq ($(WASM),true)
  470. LIB_EXT = .wasm
  471. else ifeq ($(WINDOWS),true)
  472. LIB_EXT = .dll
  473. else
  474. LIB_EXT = .so
  475. endif
  476. # ---------------------------------------------------------------------------------------------------------------------
  477. # Set shared library CLI arg
  478. ifeq ($(MACOS),true)
  479. SHARED = -dynamiclib
  480. else ifeq ($(WASM),true)
  481. SHARED = -sSIDE_MODULE=2
  482. else
  483. SHARED = -shared
  484. endif
  485. # ---------------------------------------------------------------------------------------------------------------------
  486. # Handle the verbosity switch
  487. SILENT =
  488. ifeq ($(VERBOSE),1)
  489. else ifeq ($(VERBOSE),y)
  490. else ifeq ($(VERBOSE),yes)
  491. else ifeq ($(VERBOSE),true)
  492. else
  493. SILENT = @
  494. endif
  495. # ---------------------------------------------------------------------------------------------------------------------
  496. # all needs to be first
  497. all:
  498. # ---------------------------------------------------------------------------------------------------------------------
  499. # helper to print what is available/possible to build
  500. print_available = @echo $(1): $(shell echo $($(1)) | grep -q true && echo Yes || echo No)
  501. features:
  502. @echo === Detected CPU
  503. $(call print_available,CPU_AARCH64)
  504. $(call print_available,CPU_ARM)
  505. $(call print_available,CPU_ARM64)
  506. $(call print_available,CPU_ARM_OR_AARCH64)
  507. $(call print_available,CPU_I386)
  508. $(call print_available,CPU_I386_OR_X86_64)
  509. @echo === Detected OS
  510. $(call print_available,BSD)
  511. $(call print_available,HAIKU)
  512. $(call print_available,HURD)
  513. $(call print_available,LINUX)
  514. $(call print_available,MACOS)
  515. $(call print_available,WASM)
  516. $(call print_available,WINDOWS)
  517. $(call print_available,HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS)
  518. $(call print_available,HAIKU_OR_MACOS_OR_WINDOWS)
  519. $(call print_available,LINUX_OR_MACOS)
  520. $(call print_available,MACOS_OR_WASM_OR_WINDOWS)
  521. $(call print_available,MACOS_OR_WINDOWS)
  522. $(call print_available,UNIX)
  523. @echo === Detected features
  524. $(call print_available,HAVE_ALSA)
  525. $(call print_available,HAVE_DBUS)
  526. $(call print_available,HAVE_CAIRO)
  527. $(call print_available,HAVE_DGL)
  528. $(call print_available,HAVE_LIBLO)
  529. $(call print_available,HAVE_OPENGL)
  530. $(call print_available,HAVE_PULSEAUDIO)
  531. $(call print_available,HAVE_RTAUDIO)
  532. $(call print_available,HAVE_SDL2)
  533. $(call print_available,HAVE_STUB)
  534. $(call print_available,HAVE_VULKAN)
  535. $(call print_available,HAVE_X11)
  536. $(call print_available,HAVE_XCURSOR)
  537. $(call print_available,HAVE_XEXT)
  538. $(call print_available,HAVE_XRANDR)
  539. # ---------------------------------------------------------------------------------------------------------------------
  540. # Protect against multiple inclusion
  541. endif # DPF_MAKEFILE_BASE_INCLUDED
  542. # ---------------------------------------------------------------------------------------------------------------------