diff --git a/make/configure.mk b/make/configure.mk index 78ca2f7..d1437fd 100644 --- a/make/configure.mk +++ b/make/configure.mk @@ -1,6 +1,6 @@ # -# Copyright (C) 2020 Linux Studio Plugins Project -# (C) 2020 Vladimir Sadovnikov +# Copyright (C) 2024 Linux Studio Plugins Project +# (C) 2024 Vladimir Sadovnikov # # This file is part of lsp-dsp-lib # @@ -268,8 +268,9 @@ $(CONFIG_VARS): prepare echo "$(@)=$($(@))" >> "$(CONFIG)" config: $(CONFIG_VARS) - echo "Architecture: $(ARCHITECTURE_FAMILY)/$(ARCHITECTURE) ($(ARCHITECTURE_CFLAGS))" - echo "Features: $(FEATURES)" + echo "Host architecture: $(HOST_ARCHITECTURE_FAMILY)/$(HOST_ARCHITECTURE) ($(HOST_ARCHITECTURE_CFLAGS))" + echo "Architecture: $(ARCHITECTURE_FAMILY)/$(ARCHITECTURE) ($(ARCHITECTURE_CFLAGS))" + echo "Features: $(FEATURES)" echo "Configured OK" help: | pathvars toolvars sysvars diff --git a/make/functions.mk b/make/functions.mk index b8b4b1f..c0449bd 100644 --- a/make/functions.mk +++ b/make/functions.mk @@ -1,6 +1,6 @@ # -# Copyright (C) 2020 Linux Studio Plugins Project -# (C) 2020 Vladimir Sadovnikov +# Copyright (C) 2024 Linux Studio Plugins Project +# (C) 2024 Vladimir Sadovnikov # # This file is part of lsp-dsp-lib # diff --git a/make/modules.mk b/make/modules.mk index 437b97d..bc25268 100644 --- a/make/modules.mk +++ b/make/modules.mk @@ -1,6 +1,6 @@ # -# Copyright (C) 2020 Linux Studio Plugins Project -# (C) 2020 Vladimir Sadovnikov +# Copyright (C) 2024 Linux Studio Plugins Project +# (C) 2024 Vladimir Sadovnikov # # This file is part of lsp-dsp-lib # @@ -45,9 +45,15 @@ UNIQ_ALL_DEPENDENCIES := $(filter-out $(ARTIFACT_ID),$(call uniq, $(ALL_DEP MODULES ?= $(BASEDIR)/modules GIT ?= git +ifeq ($(DEVEL),1) + X_URL_SUFFIX = _RW +else + X_URL_SUFFIX = _RO +endif + ifeq ($(TREE),1) $(foreach dep,$(UNIQ_ALL_DEPENDENCIES), \ - $(eval $(dep)_URL=$($(dep)_URL_RO)) \ + $(eval $(dep)_URL=$($(dep)_URL$(X_URL_SUFFIX))) \ ) ifeq ($(findstring -devel,$(ARTIFACT_VERSION)),-devel) diff --git a/make/tools.mk b/make/tools.mk index 91d0170..3accfd3 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -86,14 +86,13 @@ GIT ?= $(X_GIT_TOOL) INSTALL ?= $(X_INSTALL_TOOL) # Patch flags and tools for (cross) build -FLAG_RELRO = -Wl,-z,relro,-z,now -FLAG_GC_SECTIONS = -Wl,--gc-sections -FLAG_STDLIB = -CFLAGS_EXT = $(ARCHITECTURE_CFLAGS) -CXXFLAGS_EXT = $(ARCHITECTURE_CFLAGS) -EXE_FLAGS_EXT = $(ARCHITECTURE_CFLAGS) -SO_FLAGS_EXT = $(ARCHITECTURE_CFLAGS) -LDFLAGS_EXT = $(ARCHITECTURE_LDFLAGS) +FLAG_RELRO := -Wl,-z,relro,-z,now +FLAG_STDLIB := +NOARCH_CFLAGS := +NOARCH_CXXFLAGS := +NOARCH_EXE_FLAGS := +NOARCH_SO_FLAGS := +NOARCH_LDFLAGS := ifeq ($(PLATFORM),Solaris) FLAG_RELRO = @@ -101,59 +100,49 @@ ifeq ($(PLATFORM),Solaris) else ifeq ($(PLATFORM),Windows) FLAG_RELRO = FLAG_STDLIB = - CFLAGS_EXT += -DWINVER=0x600 -D_WIN32_WINNT=0x600 - CXXFLAGS_EXT += -DWINVER=0x600 -D_WIN32_WINNT=0x600 - EXE_FLAGS_EXT += -static-libgcc -static-libstdc++ - SO_FLAGS_EXT += -static-libgcc -static-libstdc++ - LDFLAGS_EXT += -T $(CURDIR)/make/ld-windows.script -else ifeq ($(PLATFORM),MacOS) - FLAG_RELRO = - FLAG_GC_SECTIONS = - CXXFLAGS_EXT += --std=c++11 -else ifeq ($(PLATFORM),Haiku) - EXE_FLAGS_EXT += -L/system/lib -L/system/develop/lib - SO_FLAGS_EXT += -L/system/lib -L/system/develop/lib - CXXFLAGS_EXT += -D_GNU_SOURCE -D_BSD_SOURCE - CFLAGS_EXT += -D_GNU_SOURCE -D_BSD_SOURCE - LDFLAGS_EXT += -L/system/develop/lib/ + NOARCH_CFLAGS += -DWINVER=0x600 -D_WIN32_WINNT=0x600 + NOARCH_CXXFLAGS += -DWINVER=0x600 -D_WIN32_WINNT=0x600 + NOARCH_EXE_FLAGS += -static-libgcc -static-libstdc++ + NOARCH_SO_FLAGS += -static-libgcc -static-libstdc++ + NOARCH_LDFLAGS += -T $(CURDIR)/make/ld-windows.script else ifeq ($(PLATFORM),BSD) - EXE_FLAGS_EXT += -L/usr/local/lib - SO_FLAGS_EXT += -L/usr/local/lib + NOARCH_EXE_FLAGS += -L/usr/local/lib + NOARCH_SO_FLAGS += -L/usr/local/lib endif ifeq ($(DEBUG),1) - CFLAGS_EXT += -Og -g3 -DLSP_DEBUG -falign-functions=16 - CXXFLAGS_EXT += -Og -g3 -DLSP_DEBUG -falign-functions=16 + NOARCH_CFLAGS += -Og -g3 -DLSP_DEBUG -falign-functions=16 + NOARCH_CXXFLAGS += -Og -g3 -DLSP_DEBUG -falign-functions=16 else - CFLAGS_EXT += -O2 - CXXFLAGS_EXT += -O2 + NOARCH_CFLAGS += -O2 + NOARCH_CXXFLAGS += -O2 endif ifeq ($(ASAN),1) - CFLAGS_EXT += -fsanitize=address - CXXFLAGS_EXT += -fsanitize=address - EXE_FLAGS_EXT += -fsanitize=address - SO_FLAGS_EXT += -fsanitize=address + NOARCH_CFLAGS += -fsanitize=address + NOARCH_CXXFLAGS += -fsanitize=address + NOARCH_EXE_FLAGS += -fsanitize=address + NOARCH_SO_FLAGS += -fsanitize=address endif ifeq ($(PROFILE),1) - CFLAGS_EXT += -pg -DLSP_PROFILE - CXXFLAGS_EXT += -pg -DLSP_PROFILE + NOARCH_CFLAGS += -pg -DLSP_PROFILE + NOARCH_CXXFLAGS += -pg -DLSP_PROFILE endif ifeq ($(TRACE),1) - CFLAGS_EXT += -DLSP_TRACE - CXXFLAGS_EXT += -DLSP_TRACE + NOARCH_CFLAGS += -DLSP_TRACE + NOARCH_CXXFLAGS += -DLSP_TRACE endif ifeq ($(STRICT),1) - CFLAGS_EXT += -Werror - CXXFLAGS_EXT += -Werror + NOARCH_CFLAGS += -Werror + NOARCH_CXXFLAGS += -Werror endif ifeq ($(TEST),1) - CFLAGS_EXT += -DLSP_TESTING - CXXFLAGS_EXT += -DLSP_TESTING + NOARCH_CFLAGS += -DLSP_TESTING + NOARCH_CXXFLAGS += -DLSP_TESTING EXPORT_SYMBOLS ?= 1 else ifeq ($(ARTIFACT_EXPORT_SYMBOLS),1) @@ -164,8 +153,8 @@ else endif ifneq ($(EXPORT_SYMBOLS),1) - CFLAGS_EXT += -fvisibility=hidden - CXXFLAGS_EXT += -fvisibility=hidden + NOARCH_CFLAGS += -fvisibility=hidden + NOARCH_CXXFLAGS += -fvisibility=hidden endif ifneq ($(ARTIFACT_EXPORT_HEADERS),0) @@ -175,18 +164,18 @@ else endif # Define flags for (cross) build -CFLAGS += \ - $(CFLAGS_EXT) \ +NOARCH_CFLAGS += \ -fdata-sections \ -ffunction-sections \ -fno-asynchronous-unwind-tables \ -pipe \ -Wall +CFLAGS += $(ARCHITECTURE_CFLAGS) $(NOARCH_CFLAGS) +HOST_CFLAGS += $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_CFLAGS) CDEFS += -DLSP_INSTALL_PREFIX=\\\"$(PREFIX)\\\" -CXXFLAGS += \ - $(CXXFLAGS_EXT) \ +NOARCH_CXXFLAGS += \ -fno-exceptions \ -fno-rtti \ -fdata-sections \ @@ -194,22 +183,24 @@ CXXFLAGS += \ -fno-asynchronous-unwind-tables \ -pipe \ -Wall +CXXFLAGS += $(ARCHITECTURE_CFLAGS) $(NOARCH_CXXFLAGS) +HOST_CXXFLAGS += $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_CXXFLAGS) CXXDEFS += -DLSP_INSTALL_PREFIX=\\\"$(PREFIX)\\\" INCLUDE := -LDFLAGS := $(LDFLAGS_EXT) -r -EXE_FLAGS := $(EXE_FLAGS_EXT) $(FLAG_RELRO) $(FLAG_GC_SECTIONS) -SO_FLAGS := $(SO_FLAGS_EXT) $(FLAG_RELRO) $(FLAG_GC_SECTIONS) -shared $(FLAG_STDLIB) -fPIC -# Define flags for host build -HOST_CFLAGS := $(CFLAGS) -HOST_CDEFS := $(CDEFS) -HOST_CXXFLAGS := $(CXXFLAGS) -HOST_CXXDEFS := $(CXXDEFS) -HOST_LDFLAGS := $(LDFLAGS) -HOST_EXE_FLAGS := $(EXE_FLAGS) -HOST_SO_FLAGS := $(SO_FLAGS) +NOARCH_LDFLAGS += -r +LDFLAGS := $(ARCHITECTURE_LDFLAGS) $(NOARCH_LDFLAGS) +HOST_LDFLAGS := $(HOST_ARCHITECTURE_LDFLAGS) $(NOARCH_LDFLAGS) + +NOARCH_EXE_FLAGS += $(FLAG_RELRO) -Wl,--gc-sections +EXE_FLAGS := $(ARCHITECTURE_CFLAGS) $(NOARCH_EXE_FLAGS) +HOST_EXE_FLAGS := $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_EXE_FLAGS) + +NOARCH_SO_FLAGS += $(FLAG_RELRO) -Wl,--gc-sections -shared $(FLAG_STDLIB) -fPIC +SO_FLAGS := $(ARCHITECTURE_CFLAGS) $(NOARCH_SO_FLAGS) +HOST_SO_FLAGS := $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_SO_FLAGS) # The overall list of exported variables TOOL_VARS := \