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.

665 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. LINK_OPTS += -sASYNCIFY
  166. LINK_OPTS += -sASYNCIFY_IMPORTS=puglGetAsyncClipboardData
  167. else
  168. LINK_OPTS += -Wl,--as-needed
  169. ifneq ($(SKIP_STRIPPING),true)
  170. LINK_OPTS += -Wl,--strip-all
  171. endif
  172. endif
  173. endif
  174. ifeq ($(SKIP_STRIPPING),true)
  175. BASE_FLAGS += -g
  176. endif
  177. ifeq ($(NOOPT),true)
  178. # Non-CPU-specific optimization flags
  179. BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
  180. endif
  181. ifneq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  182. ifneq ($(BSD),true)
  183. BASE_FLAGS += -fno-gnu-unique
  184. endif
  185. endif
  186. ifeq ($(WINDOWS),true)
  187. # Assume we want posix
  188. BASE_FLAGS += -posix -D__STDC_FORMAT_MACROS=1 -D__USE_MINGW_ANSI_STDIO=1
  189. # Needed for windows, see https://github.com/falkTX/Carla/issues/855
  190. BASE_FLAGS += -mstackrealign
  191. else
  192. # Not needed for Windows
  193. BASE_FLAGS += -fPIC -DPIC
  194. endif
  195. ifeq ($(DEBUG),true)
  196. BASE_FLAGS += -DDEBUG -O0 -g
  197. LINK_OPTS =
  198. ifeq ($(WASM),true)
  199. LINK_OPTS += -sASSERTIONS=1
  200. endif
  201. else
  202. BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
  203. CXXFLAGS += -fvisibility-inlines-hidden
  204. endif
  205. ifeq ($(STATIC_BUILD),true)
  206. BASE_FLAGS += -DSTATIC_BUILD
  207. # LINK_OPTS += -static
  208. endif
  209. ifeq ($(WITH_LTO),true)
  210. BASE_FLAGS += -fno-strict-aliasing -flto
  211. LINK_OPTS += -fno-strict-aliasing -flto -Werror=odr -Werror=lto-type-mismatch
  212. endif
  213. BUILD_C_FLAGS = $(BASE_FLAGS) -std=gnu99 $(CFLAGS)
  214. BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=gnu++11 $(CXXFLAGS)
  215. LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
  216. ifeq ($(WASM),true)
  217. # Special flag for emscripten
  218. LINK_FLAGS += -sENVIRONMENT=web -sLLD_REPORT_UNDEFINED
  219. else ifneq ($(MACOS),true)
  220. # Not available on MacOS
  221. LINK_FLAGS += -Wl,--no-undefined
  222. endif
  223. ifeq ($(MACOS_OLD),true)
  224. BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) -DHAVE_CPP11_SUPPORT=0
  225. endif
  226. ifeq ($(WASM_EXCEPTIONS),true)
  227. BUILD_CXX_FLAGS += -fexceptions
  228. LINK_FLAGS += -fexceptions
  229. endif
  230. ifeq ($(WINDOWS),true)
  231. # Always build statically on windows
  232. LINK_FLAGS += -static -static-libgcc -static-libstdc++
  233. endif
  234. # ---------------------------------------------------------------------------------------------------------------------
  235. # Strict test build
  236. ifeq ($(TESTBUILD),true)
  237. BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
  238. BASE_FLAGS += -Wpointer-arith -Wabi=98 -Winit-self -Wuninitialized -Wstrict-overflow=5
  239. # BASE_FLAGS += -Wfloat-equal
  240. ifeq ($(CC),clang)
  241. BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
  242. BASE_FLAGS += -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-exit-time-destructors -Wno-float-equal
  243. else
  244. BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
  245. endif
  246. ifneq ($(MACOS),true)
  247. BASE_FLAGS += -Wmissing-declarations -Wsign-conversion
  248. ifneq ($(CC),clang)
  249. BASE_FLAGS += -Wlogical-op
  250. endif
  251. endif
  252. CFLAGS += -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
  253. CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
  254. endif
  255. # ---------------------------------------------------------------------------------------------------------------------
  256. # Check for required libraries
  257. HAVE_CAIRO = $(shell $(PKG_CONFIG) --exists cairo && echo true)
  258. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  259. HAVE_OPENGL = true
  260. else
  261. HAVE_OPENGL = $(shell $(PKG_CONFIG) --exists gl && echo true)
  262. HAVE_DBUS = $(shell $(PKG_CONFIG) --exists dbus-1 && echo true)
  263. HAVE_X11 = $(shell $(PKG_CONFIG) --exists x11 && echo true)
  264. HAVE_XCURSOR = $(shell $(PKG_CONFIG) --exists xcursor && echo true)
  265. HAVE_XEXT = $(shell $(PKG_CONFIG) --exists xext && echo true)
  266. HAVE_XRANDR = $(shell $(PKG_CONFIG) --exists xrandr && echo true)
  267. endif
  268. # Vulkan is not supported yet
  269. # HAVE_VULKAN = $(shell $(PKG_CONFIG) --exists vulkan && echo true)
  270. # ---------------------------------------------------------------------------------------------------------------------
  271. # Check for optional libraries
  272. HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
  273. ifneq ($(SKIP_NATIVE_AUDIO_FALLBACK),true)
  274. ifneq ($(SKIP_RTAUDIO_FALLBACK),true)
  275. ifeq ($(MACOS),true)
  276. HAVE_RTAUDIO = true
  277. else ifeq ($(WINDOWS),true)
  278. HAVE_RTAUDIO = true
  279. else
  280. HAVE_ALSA = $(shell $(PKG_CONFIG) --exists alsa && echo true)
  281. HAVE_PULSEAUDIO = $(shell $(PKG_CONFIG) --exists libpulse-simple && echo true)
  282. HAVE_SDL2 = $(shell $(PKG_CONFIG) --exists sdl2 && echo true)
  283. ifeq ($(HAVE_ALSA),true)
  284. HAVE_RTAUDIO = true
  285. else ifeq ($(HAVE_PULSEAUDIO),true)
  286. HAVE_RTAUDIO = true
  287. endif
  288. endif
  289. endif
  290. endif
  291. # backwards compat, always available/enabled
  292. ifneq ($(FORCE_NATIVE_AUDIO_FALLBACK),true)
  293. ifeq ($(STATIC_BUILD),true)
  294. HAVE_JACK = $(shell $(PKG_CONFIG) --exists jack && echo true)
  295. else
  296. HAVE_JACK = true
  297. endif
  298. endif
  299. # ---------------------------------------------------------------------------------------------------------------------
  300. # Set Generic DGL stuff
  301. ifeq ($(HAIKU),true)
  302. DGL_SYSTEM_LIBS += -lbe
  303. else ifeq ($(MACOS),true)
  304. DGL_SYSTEM_LIBS += -framework Cocoa -framework CoreVideo
  305. else ifeq ($(WASM),true)
  306. else ifeq ($(WINDOWS),true)
  307. DGL_SYSTEM_LIBS += -lgdi32 -lcomdlg32
  308. # -lole32
  309. else
  310. ifeq ($(HAVE_DBUS),true)
  311. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags dbus-1) -DHAVE_DBUS
  312. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs dbus-1)
  313. endif
  314. ifeq ($(HAVE_X11),true)
  315. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11) -DHAVE_X11
  316. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11)
  317. ifeq ($(HAVE_XCURSOR),true)
  318. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xcursor) -DHAVE_XCURSOR
  319. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xcursor)
  320. endif
  321. ifeq ($(HAVE_XEXT),true)
  322. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xext) -DHAVE_XEXT -DHAVE_XSYNC
  323. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xext)
  324. endif
  325. ifeq ($(HAVE_XRANDR),true)
  326. DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags xrandr) -DHAVE_XRANDR
  327. DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs xrandr)
  328. endif
  329. endif
  330. endif
  331. # ---------------------------------------------------------------------------------------------------------------------
  332. # Set Cairo specific stuff
  333. ifeq ($(HAVE_CAIRO),true)
  334. DGL_FLAGS += -DHAVE_CAIRO
  335. CAIRO_FLAGS = $(shell $(PKG_CONFIG) --cflags cairo)
  336. CAIRO_LIBS = $(shell $(PKG_CONFIG) --libs cairo)
  337. HAVE_CAIRO_OR_OPENGL = true
  338. endif
  339. # ---------------------------------------------------------------------------------------------------------------------
  340. # Set OpenGL specific stuff
  341. ifeq ($(HAVE_OPENGL),true)
  342. DGL_FLAGS += -DHAVE_OPENGL
  343. ifeq ($(HAIKU),true)
  344. OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl)
  345. OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl)
  346. else ifeq ($(MACOS),true)
  347. OPENGL_FLAGS = -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations
  348. OPENGL_LIBS = -framework OpenGL
  349. else ifeq ($(WASM),true)
  350. ifeq ($(USE_GLES2),true)
  351. OPENGL_LIBS = -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2
  352. else
  353. ifneq ($(USE_GLES3),true)
  354. OPENGL_LIBS = -sLEGACY_GL_EMULATION -sGL_UNSAFE_OPTS=0
  355. endif
  356. endif
  357. else ifeq ($(WINDOWS),true)
  358. OPENGL_LIBS = -lopengl32
  359. else
  360. OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl x11)
  361. OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl x11)
  362. endif
  363. HAVE_CAIRO_OR_OPENGL = true
  364. endif
  365. # ---------------------------------------------------------------------------------------------------------------------
  366. # Set Stub specific stuff
  367. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  368. HAVE_STUB = true
  369. else
  370. HAVE_STUB = $(HAVE_X11)
  371. endif
  372. # ---------------------------------------------------------------------------------------------------------------------
  373. # Set Vulkan specific stuff
  374. ifeq ($(HAVE_VULKAN),true)
  375. DGL_FLAGS += -DHAVE_VULKAN
  376. VULKAN_FLAGS = $(shell $(PKG_CONFIG) --cflags vulkan)
  377. VULKAN_LIBS = $(shell $(PKG_CONFIG) --libs vulkan)
  378. ifneq ($(WINDOWS),true)
  379. VULKAN_LIBS += -ldl
  380. endif
  381. endif
  382. # ---------------------------------------------------------------------------------------------------------------------
  383. # Set optional libraries specific stuff
  384. ifeq ($(HAVE_ALSA),true)
  385. ALSA_FLAGS = $(shell $(PKG_CONFIG) --cflags alsa)
  386. ALSA_LIBS = $(shell $(PKG_CONFIG) --libs alsa)
  387. endif
  388. ifeq ($(HAVE_LIBLO),true)
  389. LIBLO_FLAGS = $(shell $(PKG_CONFIG) --cflags liblo)
  390. LIBLO_LIBS = $(shell $(PKG_CONFIG) --libs liblo)
  391. endif
  392. ifeq ($(HAVE_PULSEAUDIO),true)
  393. PULSEAUDIO_FLAGS = $(shell $(PKG_CONFIG) --cflags libpulse-simple)
  394. PULSEAUDIO_LIBS = $(shell $(PKG_CONFIG) --libs libpulse-simple)
  395. endif
  396. ifeq ($(HAVE_SDL2),true)
  397. SDL2_FLAGS = $(shell $(PKG_CONFIG) --cflags sdl2)
  398. SDL2_LIBS = $(shell $(PKG_CONFIG) --libs sdl2)
  399. endif
  400. ifeq ($(HAVE_JACK),true)
  401. ifeq ($(STATIC_BUILD),true)
  402. JACK_FLAGS = $(shell $(PKG_CONFIG) --cflags jack)
  403. JACK_LIBS = $(shell $(PKG_CONFIG) --libs jack)
  404. endif
  405. endif
  406. ifneq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS),true)
  407. SHARED_MEMORY_LIBS = -lrt
  408. endif
  409. # ---------------------------------------------------------------------------------------------------------------------
  410. # Backwards-compatible HAVE_DGL
  411. ifeq ($(MACOS_OR_WASM_OR_WINDOWS),true)
  412. HAVE_DGL = true
  413. else ifeq ($(HAVE_OPENGL),true)
  414. HAVE_DGL = $(HAVE_X11)
  415. endif
  416. # ---------------------------------------------------------------------------------------------------------------------
  417. # Namespace flags
  418. ifneq ($(DISTRHO_NAMESPACE),)
  419. BUILD_CXX_FLAGS += -DDISTRHO_NAMESPACE=$(DISTRHO_NAMESPACE)
  420. endif
  421. ifneq ($(DGL_NAMESPACE),)
  422. BUILD_CXX_FLAGS += -DDGL_NAMESPACE=$(DGL_NAMESPACE)
  423. endif
  424. # ---------------------------------------------------------------------------------------------------------------------
  425. # Optional flags
  426. ifeq ($(NVG_DISABLE_SKIPPING_WHITESPACE),true)
  427. BUILD_CXX_FLAGS += -DNVG_DISABLE_SKIPPING_WHITESPACE
  428. endif
  429. ifneq ($(NVG_FONT_TEXTURE_FLAGS),)
  430. BUILD_CXX_FLAGS += -DNVG_FONT_TEXTURE_FLAGS=$(NVG_FONT_TEXTURE_FLAGS)
  431. endif
  432. ifeq ($(FILE_BROWSER_DISABLED),true)
  433. BUILD_CXX_FLAGS += -DDGL_FILE_BROWSER_DISABLED
  434. endif
  435. ifneq ($(WINDOWS_ICON_ID),)
  436. BUILD_CXX_FLAGS += -DDGL_WINDOWS_ICON_ID=$(WINDOWS_ICON_ID)
  437. endif
  438. ifeq ($(USE_GLES2),true)
  439. BUILD_CXX_FLAGS += -DDGL_USE_GLES -DDGL_USE_GLES2
  440. endif
  441. ifeq ($(USE_GLES3),true)
  442. BUILD_CXX_FLAGS += -DDGL_USE_GLES -DDGL_USE_GLES3
  443. endif
  444. ifeq ($(USE_OPENGL3),true)
  445. BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3
  446. endif
  447. ifeq ($(USE_NANOVG_FBO),true)
  448. BUILD_CXX_FLAGS += -DDGL_USE_NANOVG_FBO
  449. endif
  450. ifeq ($(USE_NANOVG_FREETYPE),true)
  451. BUILD_CXX_FLAGS += -DFONS_USE_FREETYPE $(shell $(PKG_CONFIG) --cflags freetype2)
  452. endif
  453. ifeq ($(USE_RGBA),true)
  454. BUILD_CXX_FLAGS += -DDGL_USE_RGBA
  455. endif
  456. # ---------------------------------------------------------------------------------------------------------------------
  457. # Set app extension
  458. ifeq ($(WASM),true)
  459. APP_EXT = .html
  460. else ifeq ($(WINDOWS),true)
  461. APP_EXT = .exe
  462. endif
  463. # ---------------------------------------------------------------------------------------------------------------------
  464. # Set shared lib extension
  465. ifeq ($(MACOS),true)
  466. LIB_EXT = .dylib
  467. else ifeq ($(WASM),true)
  468. LIB_EXT = .wasm
  469. else ifeq ($(WINDOWS),true)
  470. LIB_EXT = .dll
  471. else
  472. LIB_EXT = .so
  473. endif
  474. # ---------------------------------------------------------------------------------------------------------------------
  475. # Set shared library CLI arg
  476. ifeq ($(MACOS),true)
  477. SHARED = -dynamiclib
  478. else ifeq ($(WASM),true)
  479. SHARED = -sSIDE_MODULE=2
  480. else
  481. SHARED = -shared
  482. endif
  483. # ---------------------------------------------------------------------------------------------------------------------
  484. # Handle the verbosity switch
  485. SILENT =
  486. ifeq ($(VERBOSE),1)
  487. else ifeq ($(VERBOSE),y)
  488. else ifeq ($(VERBOSE),yes)
  489. else ifeq ($(VERBOSE),true)
  490. else
  491. SILENT = @
  492. endif
  493. # ---------------------------------------------------------------------------------------------------------------------
  494. # all needs to be first
  495. all:
  496. # ---------------------------------------------------------------------------------------------------------------------
  497. # helper to print what is available/possible to build
  498. print_available = @echo $(1): $(shell echo $($(1)) | grep -q true && echo Yes || echo No)
  499. features:
  500. @echo === Detected CPU
  501. $(call print_available,CPU_AARCH64)
  502. $(call print_available,CPU_ARM)
  503. $(call print_available,CPU_ARM64)
  504. $(call print_available,CPU_ARM_OR_AARCH64)
  505. $(call print_available,CPU_I386)
  506. $(call print_available,CPU_I386_OR_X86_64)
  507. @echo === Detected OS
  508. $(call print_available,BSD)
  509. $(call print_available,HAIKU)
  510. $(call print_available,HURD)
  511. $(call print_available,LINUX)
  512. $(call print_available,MACOS)
  513. $(call print_available,WASM)
  514. $(call print_available,WINDOWS)
  515. $(call print_available,HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS)
  516. $(call print_available,HAIKU_OR_MACOS_OR_WINDOWS)
  517. $(call print_available,LINUX_OR_MACOS)
  518. $(call print_available,MACOS_OR_WASM_OR_WINDOWS)
  519. $(call print_available,MACOS_OR_WINDOWS)
  520. $(call print_available,UNIX)
  521. @echo === Detected features
  522. $(call print_available,HAVE_ALSA)
  523. $(call print_available,HAVE_DBUS)
  524. $(call print_available,HAVE_CAIRO)
  525. $(call print_available,HAVE_DGL)
  526. $(call print_available,HAVE_LIBLO)
  527. $(call print_available,HAVE_OPENGL)
  528. $(call print_available,HAVE_PULSEAUDIO)
  529. $(call print_available,HAVE_RTAUDIO)
  530. $(call print_available,HAVE_SDL2)
  531. $(call print_available,HAVE_STUB)
  532. $(call print_available,HAVE_VULKAN)
  533. $(call print_available,HAVE_X11)
  534. $(call print_available,HAVE_XCURSOR)
  535. $(call print_available,HAVE_XEXT)
  536. $(call print_available,HAVE_XRANDR)
  537. # ---------------------------------------------------------------------------------------------------------------------
  538. # Protect against multiple inclusion
  539. endif # DPF_MAKEFILE_BASE_INCLUDED
  540. # ---------------------------------------------------------------------------------------------------------------------