MT#61993 build: Force recursive variables into simple ones

Starting with GNU make 4.4, build time have massively regressed
where before they would take 5m on amd64 now can take 2h40m. While this
seems clearly broken, the release notes are filled with notices for
breaking changes, and in particular the one for passing all make
variables down to the invoked programs executed via the «shell» GNU make
function, so it is not clear what is expected breakage and what is not.

This has been reported in Debian, but not yet upstream, and while it
seems like a clear regression, it's not clear what will be the upstream
take on it. For now apply workarounds that do not change semantics, and
which do not regress with older GNU make versions.

Use the GNU make «origin» function instead of «?=» which defaults to
defining a variable as a recursive one. Coerce already defined variables
into simple ones to avoid GNU make re-evaluating these variables for
each «shell» function invocation.

Ref: https://bugs.debian.org/1092051
Change-Id: I076fc05dd616918473a22e7e942fecfdc9851d47
pull/1931/head
Guillem Jover 1 year ago
parent bebc6f8f31
commit 887fb40f3f

@ -3,7 +3,11 @@ with_transcoding ?= yes
ifeq ($(DO_ASAN_FLAGS),1) ifeq ($(DO_ASAN_FLAGS),1)
ASAN_FLAGS = -ggdb -O0 -fsanitize=address -fsanitize=leak -fsanitize=undefined ASAN_FLAGS = -ggdb -O0 -fsanitize=address -fsanitize=leak -fsanitize=undefined
CFLAGS ?= -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes ifeq ($(origin CFLAGS),undefined)
CFLAGS := -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes
else
CFLAGS := $(CFLAGS)
endif
CFLAGS += $(ASAN_FLAGS) CFLAGS += $(ASAN_FLAGS)
CFLAGS += -DASAN_BUILD CFLAGS += -DASAN_BUILD
LDFLAGS += $(ASAN_FLAGS) LDFLAGS += $(ASAN_FLAGS)

@ -3,9 +3,12 @@ TARGET= rtpengine
with_iptables_option ?= yes with_iptables_option ?= yes
with_transcoding ?= yes with_transcoding ?= yes
ifeq ($(origin CFLAGS),undefined)
CFLAGS?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \ CFLAGS:= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \
-Wshadow -Wshadow
else
CFLAGS:= $(CFLAGS)
endif
CFLAGS+= -pthread CFLAGS+= -pthread
CFLAGS+= -std=c11 CFLAGS+= -std=c11
CFLAGS+= $(shell pkg-config --cflags glib-2.0) CFLAGS+= $(shell pkg-config --cflags glib-2.0)
@ -49,7 +52,7 @@ endif
#CFLAGS+= -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE #CFLAGS+= -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE
#CFLAGS+= -DSTRICT_SDES_KEY_LIFETIME #CFLAGS+= -DSTRICT_SDES_KEY_LIFETIME
LDLIBS= -lm -ldl LDLIBS:= -lm -ldl
LDLIBS+= $(shell pkg-config --libs glib-2.0) LDLIBS+= $(shell pkg-config --libs glib-2.0)
LDLIBS+= $(shell pkg-config --libs gthread-2.0) LDLIBS+= $(shell pkg-config --libs gthread-2.0)
LDLIBS+= $(shell pkg-config --libs zlib) LDLIBS+= $(shell pkg-config --libs zlib)

2
debian/rules vendored

@ -21,7 +21,7 @@ endif
export FIXTURES_PATH = /usr/share/rtpengine-perftest export FIXTURES_PATH = /usr/share/rtpengine-perftest
export deb_systemdsystemunitdir = $(shell pkg-config --variable=systemdsystemunitdir systemd) export deb_systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd)
%: %:
dh $@ dh $@

@ -4,12 +4,12 @@ KBUILD := $(KSRC)
M ?= $(PWD) M ?= $(PWD)
ifeq ($(RTPENGINE_VERSION),) ifeq ($(RTPENGINE_VERSION),)
DPKG_PRSCHNGLG= $(shell which dpkg-parsechangelog 2>/dev/null) DPKG_PRSCHNGLG := $(shell which dpkg-parsechangelog 2>/dev/null)
DEB_CHANGELOG=$(shell test -f $(M)/../debian/changelog && echo $(M)/../debian/changelog || echo $(M)/debian/changelog) DEB_CHANGELOG := $(shell test -f $(M)/../debian/changelog && echo $(M)/../debian/changelog || echo $(M)/debian/changelog)
ifneq ($(DPKG_PRSCHNGLG),) ifneq ($(DPKG_PRSCHNGLG),)
DPKG_PRSCHNGLG=$(shell dpkg-parsechangelog -l$(DEB_CHANGELOG) | awk '/^Version: / {print $$2}') DPKG_PRSCHNGLG := $(shell dpkg-parsechangelog -l$(DEB_CHANGELOG) | awk '/^Version: / {print $$2}')
endif endif
GIT_BR_COMMIT=git-$(shell cd $(M) && git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(shell cd $(M) && git rev-parse --short HEAD 2> /dev/null) GIT_BR_COMMIT := git-$(shell cd $(M) && git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(shell cd $(M) && git rev-parse --short HEAD 2> /dev/null)
ifneq ($(DPKG_PRSCHNGLG),) ifneq ($(DPKG_PRSCHNGLG),)
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG) RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG)

@ -1,8 +1,8 @@
ifeq (,$(filter pkg.ngcp-rtpengine.nobcg729,${DEB_BUILD_PROFILES})) ifeq (,$(filter pkg.ngcp-rtpengine.nobcg729,${DEB_BUILD_PROFILES}))
# look for bcg729 # look for bcg729
# system pkg-config # system pkg-config
ifeq ($(shell pkg-config --exists libbcg729 && echo yes),yes) have_bcg729 := $(shell pkg-config --exists libbcg729 && echo yes)
have_bcg729 := yes ifeq ($(have_bcg729),yes)
bcg729_inc := $(shell pkg-config --cflags libbcg729) bcg729_inc := $(shell pkg-config --cflags libbcg729)
bcg729_lib := $(shell pkg-config --libs libbcg729) bcg729_lib := $(shell pkg-config --libs libbcg729)
else else

@ -5,22 +5,22 @@ ifeq ($(RTPENGINE_ROOT_DIR),)
RTPENGINE_ROOT_DIR=.. RTPENGINE_ROOT_DIR=..
endif endif
HAVE_DPKG_PARSECHANGELOG?=$(shell which dpkg-parsechangelog 2>/dev/null) HAVE_DPKG_PARSECHANGELOG := $(shell which dpkg-parsechangelog 2>/dev/null)
ifeq ($(RELEASE_DATE),) ifeq ($(RELEASE_DATE),)
ifneq ($(HAVE_DPKG_PARSECHANGELOG),) ifneq ($(HAVE_DPKG_PARSECHANGELOG),)
RELEASE_DATE=$(shell date -u -d "@$$(dpkg-parsechangelog -l$(RTPENGINE_ROOT_DIR)/debian/changelog -STimestamp)" '+%F') RELEASE_DATE := $(shell date -u -d "@$$(dpkg-parsechangelog -l$(RTPENGINE_ROOT_DIR)/debian/changelog -STimestamp)" '+%F')
endif endif
ifeq ($(RELEASE_DATE),) ifeq ($(RELEASE_DATE),)
RELEASE_DATE=undefined RELEASE_DATE := undefined
endif endif
endif endif
ifeq ($(RTPENGINE_VERSION),) ifeq ($(RTPENGINE_VERSION),)
ifneq ($(HAVE_DPKG_PARSECHANGELOG),) ifneq ($(HAVE_DPKG_PARSECHANGELOG),)
DPKG_PRSCHNGLG=$(shell dpkg-parsechangelog -l$(RTPENGINE_ROOT_DIR)/debian/changelog | awk '/^Version: / {print $$2}') DPKG_PRSCHNGLG := $(shell dpkg-parsechangelog -l$(RTPENGINE_ROOT_DIR)/debian/changelog | awk '/^Version: / {print $$2}')
endif endif
GIT_BR_COMMIT=git-$(shell git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(shell git rev-parse --short HEAD 2> /dev/null) GIT_BR_COMMIT := git-$(shell git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(shell git rev-parse --short HEAD 2> /dev/null)
ifneq ($(DPKG_PRSCHNGLG),) ifneq ($(DPKG_PRSCHNGLG),)
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG) RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG)
@ -36,9 +36,7 @@ endif
CFLAGS+= -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\"" CFLAGS+= -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
# look for libsystemd # look for libsystemd
ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes) have_libsystemd := $(shell pkg-config --exists libsystemd && echo yes)
have_libsystemd := yes
endif
ifeq ($(have_libsystemd),yes) ifeq ($(have_libsystemd),yes)
CFLAGS+= $(shell pkg-config --cflags libsystemd) CFLAGS+= $(shell pkg-config --cflags libsystemd)
CFLAGS+= -DHAVE_LIBSYSTEMD CFLAGS+= -DHAVE_LIBSYSTEMD
@ -47,9 +45,7 @@ endif
# look for liburing # look for liburing
ifeq (,$(filter pkg.ngcp-rtpengine.nouring,${DEB_BUILD_PROFILES})) ifeq (,$(filter pkg.ngcp-rtpengine.nouring,${DEB_BUILD_PROFILES}))
ifeq ($(shell pkg-config --atleast-version=2.3 liburing && echo yes),yes) have_liburing := $(shell pkg-config --atleast-version=2.3 liburing && echo yes)
have_liburing := yes
endif
ifeq ($(have_liburing),yes) ifeq ($(have_liburing),yes)
CFLAGS+= $(shell pkg-config --cflags liburing) CFLAGS+= $(shell pkg-config --cflags liburing)
CFLAGS+= -DHAVE_LIBURING CFLAGS+= -DHAVE_LIBURING
@ -66,7 +62,7 @@ LDFLAGS += -rdynamic
ifneq ($(DBG),yes) ifneq ($(DBG),yes)
ifeq (,$(filter $(CFLAGS),-O0)) ifeq (,$(filter $(CFLAGS),-O0))
DPKG_BLDFLGS= $(shell which dpkg-buildflags 2>/dev/null) DPKG_BLDFLGS := $(shell which dpkg-buildflags 2>/dev/null)
ifneq ($(DPKG_BLDFLGS),) ifneq ($(DPKG_BLDFLGS),)
# support http://wiki.debian.org/Hardening for >=wheezy # support http://wiki.debian.org/Hardening for >=wheezy
CFLAGS+= $(shell dpkg-buildflags --get CFLAGS) CFLAGS+= $(shell dpkg-buildflags --get CFLAGS)

@ -1,10 +1,7 @@
ifeq ($(shell pkg-config --exists libmosquitto && echo yes),yes) have_mqtt := $(shell pkg-config --exists libmosquitto && echo yes)
have_mqtt := yes ifeq ($(have_mqtt),yes)
mqtt_inc := $(shell pkg-config --cflags libmosquitto) mqtt_inc := $(shell pkg-config --cflags libmosquitto)
mqtt_lib := $(shell pkg-config --libs libmosquitto) mqtt_lib := $(shell pkg-config --libs libmosquitto)
endif
ifeq ($(have_mqtt),yes)
CFLAGS+= -DHAVE_MQTT CFLAGS+= -DHAVE_MQTT
CFLAGS+= $(mqtt_inc) CFLAGS+= $(mqtt_inc)
endif endif

@ -2,8 +2,12 @@ TARGET = rtpengine-perftest
FIXTURES_PATH ?= ../fixtures FIXTURES_PATH ?= ../fixtures
ifeq ($(origin CFLAGS),undefined)
CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \ CFLAGS ?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \
-Wshadow -Wshadow
else
CFLAGS := $(CFLAGS)
endif
CFLAGS += -pthread CFLAGS += -pthread
CFLAGS += -std=c11 CFLAGS += -std=c11
@ -25,7 +29,7 @@ CFLAGS += $(shell pkg-config --cflags ncursesw)
CFLAGS += -DWITH_TRANSCODING CFLAGS += -DWITH_TRANSCODING
CFLAGS += $(shell pkg-config --cflags openssl) CFLAGS += $(shell pkg-config --cflags openssl)
LDLIBS = -lm -ldl LDLIBS := -lm -ldl
LDLIBS += $(shell pkg-config --libs glib-2.0) LDLIBS += $(shell pkg-config --libs glib-2.0)
LDLIBS += $(shell pkg-config --libs json-glib-1.0) LDLIBS += $(shell pkg-config --libs json-glib-1.0)
LDLIBS += $(shell pkg-config --libs gthread-2.0) LDLIBS += $(shell pkg-config --libs gthread-2.0)

@ -1,7 +1,11 @@
TARGET= rtpengine-recording TARGET= rtpengine-recording
ifeq ($(origin CFLAGS),undefined)
CFLAGS?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \ CFLAGS?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \
-Wshadow -Wshadow
else
CFLAGS:= $(CFLAGS)
endif
CFLAGS+= -pthread -I. -I../lib/ -I../kernel-module/ CFLAGS+= -pthread -I. -I../lib/ -I../kernel-module/
CFLAGS+= -std=c11 CFLAGS+= -std=c11
CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE CFLAGS+= -D_GNU_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE
@ -19,7 +23,7 @@ CFLAGS+= $(shell mysql_config --cflags)
CFLAGS+= $(shell pkg-config --cflags openssl) CFLAGS+= $(shell pkg-config --cflags openssl)
CFLAGS+= $(shell pkg-config --cflags libcurl) CFLAGS+= $(shell pkg-config --cflags libcurl)
LDLIBS= -lm -ldl LDLIBS:= -lm -ldl
LDLIBS+= $(shell pkg-config --libs glib-2.0) LDLIBS+= $(shell pkg-config --libs glib-2.0)
LDLIBS+= $(shell pkg-config --libs json-glib-1.0) LDLIBS+= $(shell pkg-config --libs json-glib-1.0)
LDLIBS+= $(shell pkg-config --libs gthread-2.0) LDLIBS+= $(shell pkg-config --libs gthread-2.0)

@ -2,8 +2,12 @@ TARGET= all-tests
with_transcoding ?= yes with_transcoding ?= yes
ifeq ($(origin CFLAGS),undefined)
CFLAGS?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \ CFLAGS?= -g -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes -Werror=return-type \
-Wshadow -Wshadow
else
CFLAGS:= $(CFLAGS)
endif
PRELOAD_CFLAGS := $(CFLAGS) PRELOAD_CFLAGS := $(CFLAGS)
CFLAGS+= -pthread CFLAGS+= -pthread
CFLAGS+= -std=c11 CFLAGS+= -std=c11
@ -38,7 +42,7 @@ else
CFLAGS+= -DWITHOUT_CODECLIB CFLAGS+= -DWITHOUT_CODECLIB
endif endif
LDLIBS= -lm -ldl LDLIBS:= -lm -ldl
LDLIBS+= $(shell pkg-config --libs glib-2.0) LDLIBS+= $(shell pkg-config --libs glib-2.0)
LDLIBS+= $(shell pkg-config --libs gthread-2.0) LDLIBS+= $(shell pkg-config --libs gthread-2.0)
LDLIBS+= $(shell pkg-config --libs libcrypto) LDLIBS+= $(shell pkg-config --libs libcrypto)

Loading…
Cancel
Save