Browse Source

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 11 months ago
parent
commit
887fb40f3f
10 changed files with 43 additions and 31 deletions
  1. +5
    -1
      Makefile
  2. +6
    -3
      daemon/Makefile
  3. +1
    -1
      debian/rules
  4. +4
    -4
      kernel-module/Makefile
  5. +2
    -2
      lib/g729.Makefile
  6. +8
    -12
      lib/lib.Makefile
  7. +2
    -5
      lib/mqtt.Makefile
  8. +5
    -1
      perf-tester/Makefile
  9. +5
    -1
      recording-daemon/Makefile
  10. +5
    -1
      t/Makefile

+ 5
- 1
Makefile View File

@ -3,7 +3,11 @@ with_transcoding ?= yes
ifeq ($(DO_ASAN_FLAGS),1)
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 += -DASAN_BUILD
LDFLAGS += $(ASAN_FLAGS)


+ 6
- 3
daemon/Makefile View File

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


+ 1
- 1
debian/rules View File

@ -21,7 +21,7 @@ endif
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 $@


+ 4
- 4
kernel-module/Makefile View File

@ -4,12 +4,12 @@ KBUILD := $(KSRC)
M ?= $(PWD)
ifeq ($(RTPENGINE_VERSION),)
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)
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)
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
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),)
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG)


+ 2
- 2
lib/g729.Makefile View File

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


+ 8
- 12
lib/lib.Makefile View File

@ -5,22 +5,22 @@ ifeq ($(RTPENGINE_ROOT_DIR),)
RTPENGINE_ROOT_DIR=..
endif
HAVE_DPKG_PARSECHANGELOG?=$(shell which dpkg-parsechangelog 2>/dev/null)
HAVE_DPKG_PARSECHANGELOG := $(shell which dpkg-parsechangelog 2>/dev/null)
ifeq ($(RELEASE_DATE),)
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
ifeq ($(RELEASE_DATE),)
RELEASE_DATE=undefined
RELEASE_DATE := undefined
endif
endif
ifeq ($(RTPENGINE_VERSION),)
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
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),)
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG)
@ -36,9 +36,7 @@ endif
CFLAGS+= -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
# look for libsystemd
ifeq ($(shell pkg-config --exists libsystemd && echo yes),yes)
have_libsystemd := yes
endif
have_libsystemd := $(shell pkg-config --exists libsystemd && echo yes)
ifeq ($(have_libsystemd),yes)
CFLAGS+= $(shell pkg-config --cflags libsystemd)
CFLAGS+= -DHAVE_LIBSYSTEMD
@ -47,9 +45,7 @@ endif
# look for liburing
ifeq (,$(filter pkg.ngcp-rtpengine.nouring,${DEB_BUILD_PROFILES}))
ifeq ($(shell pkg-config --atleast-version=2.3 liburing && echo yes),yes)
have_liburing := yes
endif
have_liburing := $(shell pkg-config --atleast-version=2.3 liburing && echo yes)
ifeq ($(have_liburing),yes)
CFLAGS+= $(shell pkg-config --cflags liburing)
CFLAGS+= -DHAVE_LIBURING
@ -66,7 +62,7 @@ LDFLAGS += -rdynamic
ifneq ($(DBG),yes)
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),)
# support http://wiki.debian.org/Hardening for >=wheezy
CFLAGS+= $(shell dpkg-buildflags --get CFLAGS)


+ 2
- 5
lib/mqtt.Makefile View File

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


+ 5
- 1
perf-tester/Makefile View File

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


+ 5
- 1
recording-daemon/Makefile View File

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


+ 5
- 1
t/Makefile View File

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


Loading…
Cancel
Save