-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MT#61993 build: Rework to use a config.mk generated during the build
These are potentially computed from inside each subdir, and in addition due to what appears to be a regression in GNU make 4.4, where it is reevaluating variables that contain $(shell) functions, many times (in the order of thousands, this was slowing down the build, were on the Debian amd64 build daemons it went from 5m with GNU make 4.3 to 2h40m with GNU make 4.4. Although the bulk of the slow down has been fixed with previous commits, the remaining optimizations are only to avoid this potentially happening again in the future, and to reduce useless duplicate work. Instead of trying to cache the values from within make itself, where programming this there is extremely painful, and does not seem to be able to greatly reduce the number of calls, because the build system is going to be called multiple times for different targets. Simply externalize the generation into several shell scripts, that we call to generate a make fragment that then we include from the various Makefiles. For a Debian build with GNU make 4.3, this reduces the amount of total pkg-config calls from around ~1600 to 128, for dpkg-buildflags from ~1100 down to 6, and for dpkg-parsechangelog from ~56 to 17, but the slow down is not as significant there anyway. For a Debian build with GNU make 4.4, this reduces the amount of total pkg-config calls from around ~2600 to 128, for dpkg-buildflags from ~2800 down to 6, and for dpkg-parsechangelog from ~350 to 21. For a Debian build with GNU make 4.4, this reduces the build time on this system from 2m10s to ~ 1m30s. Change-Id: I427d0ea5106dc6ed1ff9e664ccdba2fa0725b7d0
- Loading branch information
Showing
18 changed files
with
416 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.strhash.c | ||
docs/_* | ||
bencode.c | ||
config.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
*.mod.c | ||
modules.order | ||
Module.symvers | ||
rtpengine.mk | ||
.*.cmd | ||
xt_RTPENGINE.mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,30 @@ | ||
PWD := $(shell pwd) | ||
KSRC ?= /lib/modules/$(shell uname -r)/build | ||
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) | ||
ifneq ($(DPKG_PRSCHNGLG),) | ||
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) | ||
|
||
ifneq ($(DPKG_PRSCHNGLG),) | ||
RTPENGINE_VERSION+=$(DPKG_PRSCHNGLG) | ||
endif | ||
ifneq ($(GIT_BR_COMMIT),git--) | ||
RTPENGINE_VERSION+=$(GIT_BR_COMMIT) | ||
endif | ||
|
||
ifeq ($(RTPENGINE_VERSION),) | ||
RTPENGINE_VERSION+=undefined | ||
endif | ||
endif | ||
M ?= $(CURDIR) | ||
|
||
export M | ||
|
||
include rtpengine-kmod.mk | ||
|
||
EXTRA_CFLAGS+= -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\"" | ||
|
||
obj-m += xt_RTPENGINE.o | ||
|
||
.PHONY: modules clean patch install | ||
|
||
modules: | ||
$(MAKE) -C $(KBUILD) M=$(PWD) O=$(KBUILD) modules | ||
$(MAKE) -C $(KBUILD) M=$(CURDIR) O=$(KBUILD) modules | ||
|
||
clean: | ||
$(MAKE) -C $(KBUILD) M=$(PWD) clean || true | ||
$(MAKE) -C $(KBUILD) M=$(CURDIR) clean || true | ||
rm -f rtpengine-kmod.mk | ||
|
||
patch: | ||
../utils/patch-kernel magic "$(PWD)" "$(KERNEL)" "$(RTPENGINE_VERSION)" | ||
../utils/patch-kernel magic "$(CURDIR)" "$(KERNEL)" "$(RTPENGINE_VERSION)" | ||
|
||
install: | ||
install -D xt_RTPENGINE.ko $(DESTDIR)/lib/modules/$(shell uname -r)/updates/xt_RTPENGINE.ko | ||
depmod -a | ||
|
||
rtpengine-kmod.mk: | ||
./gen-rtpengine-kmod-flags >$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "${M}" ]; then | ||
M=$(pwd) | ||
fi | ||
|
||
if [ -z "${RTPENGINE_VERSION}" ]; then | ||
have_dpkg_parsechangelog=no | ||
if command -v dpkg-parsechangelog >/dev/null; then | ||
have_dpkg_parsechangelog=yes | ||
fi | ||
if [ -f "${M}/../debian/changelog" ]; then | ||
deb_changelog="${M}/../debian/changelog" | ||
else | ||
deb_changelog="${M}/debian/changelog" | ||
fi | ||
if [ "${have_dpkg_parsechangelog}" = yes ]; then | ||
deb_version="$(dpkg-parsechangelog -l${deb_changelog} | awk '/^Version: / {print $$2}')" | ||
fi | ||
git_br_commit="git-$(cd ${M} && git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(cd ${M} && git rev-parse --short HEAD 2> /dev/null)" | ||
|
||
if [ "${have_dpkg_parsechangelog}" = yes ]; then | ||
RTPENGINE_VERSION+=" ${deb_version}" | ||
fi | ||
if [ "${git_br_commit}" != "git--" ]; then | ||
RTPENGINE_VERSION+=" ${git_br_commit}" | ||
fi | ||
|
||
if [ -z "${RTPENGINE_VERSION}" ]; then | ||
RTPENGINE_VERSION="undefined" | ||
fi | ||
echo "RTPENGINE_VERSION := ${RTPENGINE_VERSION}" | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Define build flags for used dependencies. | ||
|
||
$(top_srcdir)/config.mk: | ||
$(top_srcdir)/utils/gen-common-flags >$@ | ||
ifeq (,$(filter pkg.ngcp-rtpengine.nobcg729,${DEB_BUILD_PROFILES})) | ||
$(top_srcdir)/utils/gen-bcg729-flags >>$@ | ||
endif | ||
ifneq (,$(filter pkg.ngcp-rtpengine.codec-chain,${DEB_BUILD_PROFILES})) | ||
$(top_srcdir)/utils/gen-codec-chain-flags >>$@ | ||
endif | ||
|
||
include $(top_srcdir)/config.mk |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.