|
|
01b005 |
#
|
|
|
01b005 |
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂa Andrea Illanes Albornoz <lucia@luciaillanes.de>
|
|
|
01b005 |
# set +o errexit -o noglob -o nounset is assumed.
|
|
|
01b005 |
#
|
|
|
01b005 |
# Package make command execution
|
|
|
01b005 |
#
|
|
|
01b005 |
|
|
|
01b005 |
#
|
|
|
01b005 |
# ex_rtl_make() - run make(1)
|
|
|
01b005 |
# @_ar: ar(1) command name or pathname
|
|
|
01b005 |
# @_cc: C compiler command name or pathname
|
|
|
01b005 |
# @_cxx: C++ compiler command name or pathname
|
|
|
01b005 |
# @_ld: ld(1) command name or pathname
|
|
|
01b005 |
# @_libtool: libtool(1) command name or pathname or "none"
|
|
|
01b005 |
# @_make: make(1) command name or pathname
|
|
|
01b005 |
# @_pkg_config: pkg-config(1) command name or pathname
|
|
|
01b005 |
# @_ranlib: ranlib(1) command name or pathname
|
|
|
01b005 |
# @--: (ignored)
|
|
|
01b005 |
# @_set_ccfl: 1 if CC=... is to be passed to make(1), 0 if CC=... is not to be passed to make(1)
|
|
|
01b005 |
# @_subdir: make(1) -C argument
|
|
|
01b005 |
# @--: (ignored)
|
|
|
01b005 |
# @_makeflags: make(1) flags as a whitespace-separated list
|
|
|
01b005 |
# @_makeflags_extra: extra make(1) flags as a whitespace-separated likst
|
|
|
01b005 |
# @_makeflags_list: make(1) flags as a :-separated list
|
|
|
01b005 |
# @_makeflags_extra_list: extra make(1) flags as a :-separated list
|
|
|
01b005 |
# @_makeflags_loadavg: make(1) -l load argument
|
|
|
01b005 |
# @_makeflags_parallelise: make(1) -j jobs argument
|
|
|
01b005 |
# @_makeflags_verbosity: make(1) Makefile verbosity arguments or "none"
|
|
|
01b005 |
# @--: (ignored)
|
|
|
01b005 |
# @_cflags: $CFLAGS
|
|
|
01b005 |
# @_cflags_extra: extra $CFLAGS
|
|
|
01b005 |
# @_cppflags: $CPPFLAGS
|
|
|
01b005 |
# @_cppflags_extra: extra $CPPFLAGS
|
|
|
01b005 |
# @_cxxflags: $CXXFLAGS
|
|
|
01b005 |
# @_cxxflags_extra: extra $CXXFLAGS
|
|
|
01b005 |
# @_ldflags: $LDFLAGS
|
|
|
01b005 |
# @_ldflags_extra: extra $LDFLAGS
|
|
|
01b005 |
# @_pkg_config_libdir: pkg-config(1) search directory
|
|
|
01b005 |
# @--: (ignored)
|
|
|
01b005 |
# @_destdir_spec: DESTDIR=... specification
|
|
|
01b005 |
# @_target: make(1) target
|
|
|
01b005 |
#
|
|
|
01b005 |
# Returns: zero (0) on success, non-zero (>0) on failure
|
|
|
01b005 |
#
|
|
|
01b005 |
ex_rtl_make() {
|
|
|
01b005 |
local _erm_ar="${1}" _erm_cc="${2}" _erm_cxx="${3}" _erm_ld="${4}" \
|
|
|
01b005 |
_erm_libtool="${5}" _erm_make="${6}" _erm_pkg_config="${7}" _erm_ranlib="${8}" \
|
|
|
01b005 |
_erm_ignored="${9}" \
|
|
|
01b005 |
_erm_set_ccfl="${10}" _erm_subdir="${11}" \
|
|
|
01b005 |
_erm_ignored="${12}" \
|
|
|
01b005 |
_erm_makeflags="${13}" _erm_makeflags_extra="${14}" _erm_makeflags_list="${15}" \
|
|
|
01b005 |
_erm_makeflags_extra_list="${16}" _erm_makeflags_loadavg="${17}" \
|
|
|
01b005 |
_erm_makeflags_parallelise="${18}" _erm_makeflags_verbosity="${19}" \
|
|
|
01b005 |
_erm_ignored="${20}" \
|
|
|
01b005 |
_erm_cflags="${21}" _erm_cflags_extra="${22}" _erm_cppflags="${23}" \
|
|
|
01b005 |
_erm_cppflags_extra="${24}" _erm_cxxflags="${25}" _erm_cxxflags_extra="${26}" \
|
|
|
01b005 |
_erm_ldflags="${27}" _erm_ldflags_extra="${28}" _erm_pkg_config_libdir="${29}" \
|
|
|
01b005 |
_erm_ignored="${30}" \
|
|
|
01b005 |
_erm_destdir_spec="${31}" _erm_target="${32}" \
|
|
|
01b005 |
_erm_rc=0;
|
|
|
01b005 |
|
|
|
01b005 |
case "${_erm_makeflags_loadavg:-}" in
|
|
|
01b005 |
none) _erm_makeflags_loadavg=""; ;;
|
|
|
01b005 |
esac;
|
|
|
01b005 |
|
|
|
01b005 |
case "${_erm_libtool:-}" in
|
|
|
01b005 |
none) _erm_libtool=""; ;;
|
|
|
01b005 |
esac;
|
|
|
01b005 |
|
|
|
01b005 |
case "${_erm_makeflags_verbosity}" in
|
|
|
01b005 |
none) _erm_makeflags_verbosity=""; ;;
|
|
|
01b005 |
esac;
|
|
|
01b005 |
|
|
|
01b005 |
case "${_erm_set_ccfl}" in
|
|
|
01b005 |
1) _erm_set_ccfl="1"; ;;
|
|
|
01b005 |
*) _erm_set_ccfl=""; ;;
|
|
|
01b005 |
esac;
|
|
|
01b005 |
|
|
|
01b005 |
(
|
|
|
01b005 |
if [ "${_erm_libtool:+1}" = 1 ]; then
|
|
|
01b005 |
export MAKE="make LIBTOOL=${_erm_libtool}";
|
|
|
01b005 |
fi;
|
|
|
01b005 |
|
|
|
01b005 |
if [ "${_erm_makeflags_list:+1}" = 1 ]; then
|
|
|
01b005 |
rtl_run_cmdlineV ":" "${_erm_make}" \
|
|
|
01b005 |
AR="${_erm_ar}" \
|
|
|
01b005 |
${_erm_set_ccfl:+CC="${_erm_cc}"} \
|
|
|
01b005 |
${_erm_set_ccfl:+CXX="${_erm_cxx}"} \
|
|
|
01b005 |
LD="${_erm_ld}" \
|
|
|
01b005 |
${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \
|
|
|
01b005 |
${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \
|
|
|
01b005 |
RANLIB="${_erm_ranlib}" \
|
|
|
01b005 |
\
|
|
|
01b005 |
"${_erm_makeflags_list}" \
|
|
|
01b005 |
"${_erm_makeflags_extra_list:-}" \
|
|
|
01b005 |
${_erm_makeflags_loadavg:-} \
|
|
|
01b005 |
${_erm_makeflags_parallelise:-} \
|
|
|
01b005 |
${_erm_makeflags_verbosity} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_cflags:+CFLAGS="${_erm_cflags}"} \
|
|
|
01b005 |
${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \
|
|
|
01b005 |
${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \
|
|
|
01b005 |
${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \
|
|
|
01b005 |
${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \
|
|
|
01b005 |
${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \
|
|
|
01b005 |
${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \
|
|
|
01b005 |
${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \
|
|
|
01b005 |
${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_subdir:+-C "${_erm_subdir}"} \
|
|
|
01b005 |
${_erm_destdir_spec:+"${_erm_destdir_spec}"} \
|
|
|
01b005 |
${_erm_target:+"${_erm_target}"} \
|
|
|
01b005 |
;
|
|
|
01b005 |
exit "${?}";
|
|
|
01b005 |
elif [ "${_erm_makeflags_extra_list:+1}" = 1 ]; then
|
|
|
01b005 |
rtl_run_cmdlineV ":" "${_erm_make}" \
|
|
|
01b005 |
AR="${_erm_ar}" \
|
|
|
01b005 |
${_erm_set_ccfl:+CC="${_erm_cc}"} \
|
|
|
01b005 |
${_erm_set_ccfl:+CXX="${_erm_cxx}"} \
|
|
|
01b005 |
LD="${_erm_ld}" \
|
|
|
01b005 |
${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \
|
|
|
01b005 |
${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \
|
|
|
01b005 |
RANLIB="${_erm_ranlib}" \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_makeflags:-} \
|
|
|
01b005 |
"${_erm_makeflags_extra_list}" \
|
|
|
01b005 |
${_erm_makeflags_loadavg:-} \
|
|
|
01b005 |
${_erm_makeflags_parallelise:-} \
|
|
|
01b005 |
${_erm_makeflags_verbosity} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_cflags:+CFLAGS="${_erm_cflags}"} \
|
|
|
01b005 |
${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \
|
|
|
01b005 |
${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \
|
|
|
01b005 |
${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \
|
|
|
01b005 |
${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \
|
|
|
01b005 |
${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \
|
|
|
01b005 |
${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \
|
|
|
01b005 |
${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \
|
|
|
01b005 |
${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_subdir:+-C "${_erm_subdir}"} \
|
|
|
01b005 |
${_erm_destdir_spec:+"${_erm_destdir_spec}"} \
|
|
|
01b005 |
${_erm_target:+"${_erm_target}"} \
|
|
|
01b005 |
;
|
|
|
01b005 |
exit "${?}";
|
|
|
01b005 |
else
|
|
|
01b005 |
rtl_run_cmdlineV ":" "${_erm_make}" \
|
|
|
01b005 |
AR="${_erm_ar}" \
|
|
|
01b005 |
${_erm_set_ccfl:+CC="${_erm_cc}"} \
|
|
|
01b005 |
${_erm_set_ccfl:+CXX="${_erm_cxx}"} \
|
|
|
01b005 |
LD="${_erm_ld}" \
|
|
|
01b005 |
${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \
|
|
|
01b005 |
${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \
|
|
|
01b005 |
RANLIB="${_erm_ranlib}" \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_makeflags:-} \
|
|
|
01b005 |
${_erm_makeflags_extra:-} \
|
|
|
01b005 |
${_erm_makeflags_loadavg:-} \
|
|
|
01b005 |
${_erm_makeflags_parallelise:-} \
|
|
|
01b005 |
${_erm_makeflags_verbosity} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_cflags:+CFLAGS="${_erm_cflags}"} \
|
|
|
01b005 |
${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \
|
|
|
01b005 |
${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \
|
|
|
01b005 |
${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \
|
|
|
01b005 |
${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \
|
|
|
01b005 |
${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \
|
|
|
01b005 |
${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \
|
|
|
01b005 |
${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \
|
|
|
01b005 |
${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \
|
|
|
01b005 |
\
|
|
|
01b005 |
${_erm_subdir:+-C "${_erm_subdir}"} \
|
|
|
01b005 |
${_erm_destdir_spec:+"${_erm_destdir_spec}"} \
|
|
|
01b005 |
${_erm_target:+"${_erm_target}"} \
|
|
|
01b005 |
;
|
|
|
01b005 |
exit "${?}";
|
|
|
01b005 |
fi;
|
|
|
01b005 |
);
|
|
|
01b005 |
_erm_rc="${?}";
|
|
|
01b005 |
|
|
|
01b005 |
return "${_erm_rc}";
|
|
|
01b005 |
};
|
|
|
01b005 |
|
|
|
01b005 |
# vim:filetype=sh textwidth=0
|