diff --git a/tools/Makefile.unix b/tools/Makefile.unix index 1d485d16f0..ede01f9691 100644 --- a/tools/Makefile.unix +++ b/tools/Makefile.unix @@ -179,6 +179,13 @@ else ifeq ($(CONFIG_BUILD_LOADABLE),y) MKEXPORT_ARGS += -u endif +ifneq ($(APPDIR),) +ifneq ($(shell [ -e $(APPDIR)/Makefile ] && echo yes),) +MKEXPORT_ARGS += -a "$(APPDIR)" +MKEXPORT_ARGS += -m "$(MAKE)" +endif +endif + ifeq ($(V),2) MKEXPORT_ARGS += -d endif diff --git a/tools/Makefile.win b/tools/Makefile.win index b353cea564..a0575bc2a8 100644 --- a/tools/Makefile.win +++ b/tools/Makefile.win @@ -167,6 +167,13 @@ else ifeq ($(CONFIG_BUILD_LOADABLE),y) MKEXPORT_ARGS += -u endif +ifneq ($(APPDIR),) +ifneq ($(shell [ -e $(APPDIR)/Makefile ] && echo yes),) +MKEXPORT_ARGS += -a "$(APPDIR)" +MKEXPORT_ARGS += -m "$(MAKE)" +endif +endif + ifeq ($(V),2) MKEXPORT_ARGS += -d endif diff --git a/tools/mkexport.sh b/tools/mkexport.sh index c61b62d073..6046a22e77 100755 --- a/tools/mkexport.sh +++ b/tools/mkexport.sh @@ -34,16 +34,22 @@ # Get the input parameter list -USAGE="USAGE: $0 [-d] [-z] [-u] [-w|wy|wn] -t [-x ] -l \"lib1 [lib2 [lib3 ...]]\"" +USAGE="USAGE: $0 [-d] [-z] [-u] [-w|wy|wn] -t [-x ] [-a ] [-m ] -l \"lib1 [lib2 [lib3 ...]]\"" unset TOPDIR unset LIBLIST unset TGZ +unset APPDIR + USRONLY=n WINTOOL=n LIBEXT=.a while [ ! -z "$1" ]; do case $1 in + -a ) + shift + APPDIR="$1" + ;; -d ) set -x ;; @@ -51,6 +57,10 @@ while [ ! -z "$1" ]; do shift LIBLIST=$1 ;; + -m ) + shift + MAKE="$1" + ;; -wy ) WINTOOL=y ;; @@ -240,7 +250,7 @@ echo "MKDEP = ${MKDEP}" >>"${EXPORTDIR}/build/Make.defs" # Additional compilation options when the kernel is built -if [ "X${USRONLY}" != "Xy" ] then +if [ "X${USRONLY}" != "Xy" ]; then echo "LDFLAGS = ${LDFLAGS}" >>"${EXPORTDIR}/build/Make.defs" echo "HEAD_OBJ = ${HEAD_OBJ}" >>"${EXPORTDIR}/build/Make.defs" echo "EXTRA_OBJS = ${EXTRA_OBJS}" >>"${EXPORTDIR}/build/Make.defs" @@ -399,6 +409,11 @@ done cd "${TOPDIR}" || \ { echo "MK: 'cd ${TOPDIR}' failed"; exit 1; } +if [ -e "${APPDIR}/Makefile" ]; then + "${MAKE}" -C "${TOPDIR}/${APPDIR}" EXPORTDIR="$(cd "${EXPORTSUBDIR}" ; pwd )" TOPDIR="${TOPDIR}" export || \ + { echo "MK: call make export for APPDIR not supported"; } +fi + if [ "X${TGZ}" = "Xy" ]; then tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1 gzip -f "${EXPORTSUBDIR}.tar"