Skip to content

Commit

Permalink
Updated build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Sep 26, 2024
1 parent 89d987e commit 0790e7f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 67 deletions.
9 changes: 5 additions & 4 deletions make/configure.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2020 Vladimir Sadovnikov <[email protected]>
# Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2024 Vladimir Sadovnikov <[email protected]>
#
# This file is part of lsp-dsp-lib
#
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions make/functions.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2020 Vladimir Sadovnikov <[email protected]>
# Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2024 Vladimir Sadovnikov <[email protected]>
#
# This file is part of lsp-dsp-lib
#
Expand Down
12 changes: 9 additions & 3 deletions make/modules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2020 Vladimir Sadovnikov <[email protected]>
# Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
# (C) 2024 Vladimir Sadovnikov <[email protected]>
#
# This file is part of lsp-dsp-lib
#
Expand Down Expand Up @@ -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)
Expand Down
107 changes: 49 additions & 58 deletions make/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,74 +86,63 @@ 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 =
LD = gld
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)
Expand All @@ -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)
Expand All @@ -175,41 +164,43 @@ 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 \
-ffunction-sections \
-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 := \
Expand Down

0 comments on commit 0790e7f

Please sign in to comment.