In 'make export', do not copy internal header files if this is a kernel build

This commit is contained in:
Gregory Nutt 2014-09-04 12:19:47 -06:00
parent dc334dc676
commit 86aa8f3813
3 changed files with 88 additions and 49 deletions

View File

@ -148,6 +148,23 @@ endif
LINKLIBS = $(patsubst lib/%,%,$(NUTTXLIBS))
# Export tool definitions
MKEXPORT= tools/mkexport.sh
MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y)
MKEXPORT_ARGS += -u
else
ifeq ($(CONFIG_BUILD_KERNEL),y)
MKEXPORT_ARGS += -u
endif
endif
ifeq ($(V),1)
MKEXPORT_ARGS += -d
endif
# This is the name of the final target (relative to the top level directorty)
BIN = nuttx$(EXEEXT)
@ -625,7 +642,7 @@ gconfig:
# that the archiver is 'ar'
export: pass2deps
$(Q) tools/mkexport.sh -w$(WINTOOL) -t "$(TOPDIR)" -l "$(EXPORTLIBS)"
$(Q) $(MKEXPORT) $(MKEXPORT_ARGS) -l "$(EXPORTLIBS)"
# General housekeeping targets: dependencies, cleaning, etc.
#

View File

@ -141,6 +141,19 @@ endif
LINKLIBS = $(patsubst lib\\%,%,$(NUTTXLIBS))
# Export tool definitions
MKEXPORT = tools\mkexport.bat
MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y)
MKEXPORT_ARGS = -u
else
ifeq ($(CONFIG_BUILD_KERNEL),y)
MKEXPORT_ARGS = -u
endif
endif
# This is the name of the final target (relative to the top level directorty)
BIN = nuttx$(EXEEXT)
@ -622,7 +635,7 @@ menuconfig: configenv
# that the archiver is 'ar'
export: pass2deps
$(Q) tools\mkexport.sh -w$(WINTOOL) -t "$(TOPDIR)" -l "$(EXPORTLIBS)"
$(Q) $(MKEXPORT) $(MKEXPORT_ARGS) -w$(WINTOOL) -t "$(TOPDIR)" -l "$(EXPORTLIBS)"
# General housekeeping targets: dependencies, cleaning, etc.
#

View File

@ -34,10 +34,11 @@
# Get the input parameter list
USAGE="USAGE: $0 [-d] [-z] [-w|wy|wn] -t <top-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\""
USAGE="USAGE: $0 [-d] [-z] [-u] [-w|wy|wn] -t <top-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\""
unset TOPDIR
unset LIBLIST
unset TGZ
USRONLY=n
WINTOOL=n
LIBEXT=.a
@ -60,6 +61,9 @@ while [ ! -z "$1" ]; do
shift
TOPDIR=$1
;;
-u )
USRONLY=y
;;
-x )
shift
LIBEXT=$1
@ -129,7 +133,10 @@ mkdir "${EXPORTDIR}" || { echo "MK: 'mkdir ${EXPORTDIR}' failed"; exit 1; }
mkdir "${EXPORTDIR}/startup" || { echo "MK: 'mkdir ${EXPORTDIR}/startup' failed"; exit 1; }
mkdir "${EXPORTDIR}/libs" || { echo "MK: 'mkdir ${EXPORTDIR}/libs' failed"; exit 1; }
mkdir "${EXPORTDIR}/build" || { echo "MK: 'mkdir ${EXPORTDIR}/build' failed"; exit 1; }
mkdir "${EXPORTDIR}/arch" || { echo "MK: 'mkdir ${EXPORTDIR}/arch' failed"; exit 1; }
if [ "X${USRONLY}" != "Xy" ]; then
mkdir "${EXPORTDIR}/arch" || { echo "MK: 'mkdir ${EXPORTDIR}/arch' failed"; exit 1; }
fi
# Verify that we have a Make.defs file.
@ -202,8 +209,9 @@ cp -f "${ARCHDIR}"/*.h "${EXPORTDIR}"/arch/. 2>/dev/null
# as symbolic links to directories, then copy the header files from
# those directories into the EXPORTDIR
ARCH_HDRDIRS="arm armv7-m avr avr32 board common chip mips32"
for hdir in $ARCH_HDRDIRS; do
if [ "X${USRONLY}" != "Xy" ]; then
ARCH_HDRDIRS="arm armv7-m avr avr32 board common chip mips32"
for hdir in $ARCH_HDRDIRS; do
# Does the directory (or symbolic link) exist?
@ -233,26 +241,27 @@ for hdir in $ARCH_HDRDIRS; do
cp -f "${ARCHDIR}"/${hdir}/chip/*.h "${EXPORTDIR}"/arch/${hdir}/chip/. 2>/dev/null
fi
fi
done
done
# Copy OS internal header files as well. They are used by some architecture-
# specific header files.
# Copy OS internal header files as well. They are used by some architecture-
# specific header files.
mkdir "${EXPORTDIR}/arch/os" || \
mkdir "${EXPORTDIR}/arch/os" || \
{ echo "MK: 'mkdir ${EXPORTDIR}/arch/os' failed"; exit 1; }
OSDIRS="clock environ errno group init irq mqueue paging pthread sched semaphore signal task timer wdog"
OSDIRS="clock environ errno group init irq mqueue paging pthread sched semaphore signal task timer wdog"
for dir in ${OSDIRS}; do
for dir in ${OSDIRS}; do
mkdir "${EXPORTDIR}/arch/os/${dir}" || \
{ echo "MK: 'mkdir ${EXPORTDIR}/arch/os/${dir}' failed"; exit 1; }
cp -f "${TOPDIR}"/sched/${dir}/*.h "${EXPORTDIR}"/arch/os/${dir}/. 2>/dev/null
done
done
# Add the board library to the list of libraries
# Add the board library to the list of libraries
if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then
if [ -f "${ARCHDIR}/board/libboard${LIBEXT}" ]; then
LIBLIST="${LIBLIST} ${ARCHSUBDIR}/board/libboard${LIBEXT}"
fi
fi
# Then process each library