@@ -35,7 +35,9 @@ DPF_MAKEFILE_BASE_INCLUDED = true
3535# ---------------------------------------------------------------------------------------------------------------------
3636# Auto-detect target compiler if not defined
3737
38- ifeq ($(shell echo '\#test' | grep -- '\#test') ,\# test)
38+ ifneq ($(shell echo -e escaped-by-default | grep -- '-e escaped-by-default') ,-e escaped-by-default)
39+ TARGET_COMPILER = $(shell echo -e '#ifdef __clang__\nclang\n#else\ngcc\n#endif' | $(CC ) -E -P -x c - 2>/dev/null)
40+ else ifeq ($(shell echo '\#escaped-by-default' | grep -- '\#escaped-by-default'),\#escaped-by-default)
3941TARGET_COMPILER = $(shell echo '\#ifdef __clang__\nclang\n\#else\ngcc\n\#endif' | $(CC ) -E -P -x c - 2>/dev/null)
4042else
4143TARGET_COMPILER = $(shell echo '#ifdef __clang__\nclang\n#else\ngcc\n#endif' | $(CC ) -E -P -x c - 2>/dev/null)
@@ -272,7 +274,10 @@ BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections
272274endif
273275
274276ifeq ($(DEBUG ) ,true)
275- BASE_FLAGS += -DDEBUG -O0 -g -fsanitize=address
277+ BASE_FLAGS += -DDEBUG -O0 -g
278+ ifneq ($(HAIKU ) ,true)
279+ BASE_FLAGS += -fsanitize=address
280+ endif
276281LINK_OPTS =
277282ifeq ($(WASM ) ,true)
278283LINK_OPTS += -sASSERTIONS=1
@@ -347,9 +352,11 @@ endif
347352# ---------------------------------------------------------------------------------------------------------------------
348353# Check for required libraries
349354
350- HAVE_CAIRO = $(shell $(PKG_CONFIG ) --exists cairo && echo true)
355+ ifneq ($(HAIKU ) ,true)
356+ HAVE_CAIRO = $(shell $(PKG_CONFIG ) --exists cairo && echo true)
357+ endif
351358
352- ifeq ($(MACOS_OR_WASM_OR_WINDOWS ) ,true)
359+ ifeq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS ) ,true)
353360HAVE_OPENGL = true
354361else
355362HAVE_OPENGL = $(shell $(PKG_CONFIG ) --exists gl && echo true)
@@ -402,18 +409,34 @@ endif
402409# Set Generic DGL stuff
403410
404411ifeq ($(HAIKU ) ,true)
412+
405413DGL_SYSTEM_LIBS += -lbe
414+
406415else ifeq ($(MACOS),true)
407- DGL_SYSTEM_LIBS += -framework Cocoa -framework CoreVideo
416+
417+ DGL_SYSTEM_LIBS += -framework Cocoa
418+ DGL_SYSTEM_LIBS += -framework CoreVideo
419+
408420else ifeq ($(WASM),true)
421+
422+ # wasm builds cannot work using regular desktop OpenGL
423+ ifeq (,$(USE_GLES2 )$(USE_GLES3 ) )
424+ USE_GLES2 = true
425+ endif
426+
409427else ifeq ($(WINDOWS),true)
410- DGL_SYSTEM_LIBS += -lgdi32 -lcomdlg32
411- # -lole32
428+
429+ DGL_SYSTEM_LIBS += -lcomdlg32
430+ DGL_SYSTEM_LIBS += -lgdi32
431+ # DGL_SYSTEM_LIBS += -lole32
432+
412433else
434+
413435ifeq ($(HAVE_DBUS ) ,true)
414436DGL_FLAGS += $(shell $(PKG_CONFIG ) --cflags dbus-1) -DHAVE_DBUS
415437DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG ) --libs dbus-1)
416438endif
439+
417440ifeq ($(HAVE_X11 ) ,true)
418441DGL_FLAGS += $(shell $(PKG_CONFIG ) --cflags x11) -DHAVE_X11
419442DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG ) --libs x11)
@@ -429,7 +452,8 @@ ifeq ($(HAVE_XRANDR),true)
429452DGL_FLAGS += $(shell $(PKG_CONFIG ) --cflags xrandr) -DHAVE_XRANDR
430453DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG ) --libs xrandr)
431454endif
432- endif
455+ endif # HAVE_X11
456+
433457endif
434458
435459# ---------------------------------------------------------------------------------------------------------------------
@@ -444,7 +468,7 @@ CAIRO_LIBS = $(shell $(PKG_CONFIG) --libs cairo)
444468
445469HAVE_CAIRO_OR_OPENGL = true
446470
447- endif
471+ endif # HAVE_CAIRO
448472
449473# ---------------------------------------------------------------------------------------------------------------------
450474# Set OpenGL specific stuff
@@ -454,8 +478,8 @@ ifeq ($(HAVE_OPENGL),true)
454478DGL_FLAGS += -DHAVE_OPENGL
455479
456480ifeq ($(HAIKU ) ,true)
457- OPENGL_FLAGS = $( shell $( PKG_CONFIG ) --cflags gl)
458- OPENGL_LIBS = $( shell $( PKG_CONFIG ) --libs gl)
481+ OPENGL_FLAGS =
482+ OPENGL_LIBS = -lGL
459483else ifeq ($(MACOS),true)
460484OPENGL_FLAGS = -DGL_SILENCE_DEPRECATION=1 -Wno-deprecated-declarations
461485OPENGL_LIBS = -framework OpenGL
@@ -476,12 +500,12 @@ endif
476500
477501HAVE_CAIRO_OR_OPENGL = true
478502
479- endif
503+ endif # HAVE_OPENGL
480504
481505# ---------------------------------------------------------------------------------------------------------------------
482506# Set Stub specific stuff
483507
484- ifeq ($(MACOS_OR_WASM_OR_WINDOWS ) ,true)
508+ ifeq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS ) ,true)
485509HAVE_STUB = true
486510else
487511HAVE_STUB = $(HAVE_X11 )
@@ -540,7 +564,7 @@ endif
540564# ---------------------------------------------------------------------------------------------------------------------
541565# Backwards-compatible HAVE_DGL
542566
543- ifeq ($(MACOS_OR_WASM_OR_WINDOWS ) ,true)
567+ ifeq ($(HAIKU_OR_MACOS_OR_WASM_OR_WINDOWS ) ,true)
544568HAVE_DGL = true
545569else ifeq ($(HAVE_OPENGL),true)
546570HAVE_DGL = $(HAVE_X11 )
@@ -633,6 +657,41 @@ else
633657SHARED = -shared
634658endif
635659
660+ # ---------------------------------------------------------------------------------------------------------------------
661+ # Set CLAP binary directory
662+
663+ ifeq ($(MACOS ) ,true)
664+ CLAP_BINARY_DIR = Contents/MacOS
665+ else
666+ CLAP_BINARY_DIR =
667+ endif
668+
669+ # ---------------------------------------------------------------------------------------------------------------------
670+ # Set VST2 binary directory
671+
672+ ifeq ($(MACOS ) ,true)
673+ VST2_BINARY_DIR = Contents/MacOS
674+ else
675+ VST2_BINARY_DIR =
676+ endif
677+
678+ # ---------------------------------------------------------------------------------------------------------------------
679+ # Set VST3 binary directory, see https://vst3sdk-doc.diatonic.jp/doc/vstinterfaces/vst3loc.html
680+
681+ ifeq ($(LINUX ) ,true)
682+ VST3_BINARY_DIR = Contents/$(TARGET_PROCESSOR ) -linux
683+ else ifeq ($(MACOS),true)
684+ VST3_BINARY_DIR = Contents/MacOS
685+ else ifeq ($(WASM),true)
686+ VST3_BINARY_DIR = Contents/wasm
687+ else ifeq ($(WINDOWS)$(CPU_I386),truetrue)
688+ VST3_BINARY_DIR = Contents/x86-win
689+ else ifeq ($(WINDOWS)$(CPU_X86_64),truetrue)
690+ VST3_BINARY_DIR = Contents/x86_64-win
691+ else
692+ VST3_BINARY_DIR =
693+ endif
694+
636695# ---------------------------------------------------------------------------------------------------------------------
637696# Handle the verbosity switch
638697
@@ -713,6 +772,7 @@ MOD_ENVIRONMENT = \
713772 CXX=${1}/host/usr/bin/${2}-g++ \
714773 LD=${1}/host/usr/bin/${2}-ld \
715774 PKG_CONFIG=${1}/host/usr/bin/pkg-config \
775+ PKG_CONFIG_PATH="${1}/staging/usr/lib/pkgconfig" \
716776 STRIP=${1}/host/usr/bin/${2}-strip \
717777 CFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS ) " \
718778 CPPFLAGS= \
@@ -738,12 +798,12 @@ modpush:
738798
739799ifneq (,$(findstring modduo-,$(MAKECMDGOALS ) ) )
740800$(MAKECMDGOALS ) :
741- $(MAKE ) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR ) /modduo,arm-mod-linux-gnueabihf,arm) $(subst modduo-,,$(MAKECMDGOALS ) )
801+ $(MAKE ) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR ) /modduo-static ,arm-mod-linux-gnueabihf.static ,arm) $(subst modduo-,,$(MAKECMDGOALS ) )
742802endif
743803
744804ifneq (,$(findstring modduox-,$(MAKECMDGOALS ) ) )
745805$(MAKECMDGOALS ) :
746- $(MAKE ) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR ) /modduox,aarch64-mod-linux-gnueabi,aarch64) $(subst modduox-,,$(MAKECMDGOALS ) )
806+ $(MAKE ) $(call MOD_ENVIRONMENT,$(MOD_WORKDIR ) /modduox-static ,aarch64-mod-linux-gnueabi.static ,aarch64) $(subst modduox-,,$(MAKECMDGOALS ) )
747807endif
748808
749809ifneq (,$(findstring moddwarf-,$(MAKECMDGOALS ) ) )
0 commit comments