Export make target now produces a .zip file by default

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3778 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-07-12 23:54:13 +00:00
parent 09c2e9b9e3
commit 17e6f2e481
4 changed files with 198 additions and 141 deletions
+4
View File
@@ -36,9 +36,11 @@
include $(TOPDIR)/.config
include $(EXPORTDIR)/Make.defs
ifdef ARCHSCRIPT
LDPATH = ${shell echo "$(ARCHSCRIPT)" | sed -e "s/^-T[ ]*//g"}
LDNAME = ${shell basename ${LDPATH}}
LDDIR = ${shell dirname ${LDPATH}}
endif
ARCHSUBDIR = "arch/$(CONFIG_ARCH)/src"
ARCHDIR ="$(TOPDIR)/$(ARCHSUBDIR)"
@@ -51,9 +53,11 @@ $(EXPORTDIR)/makeinfo.sh: $(TOPDIR)/.config $(EXPORTDIR)/Make.defs
@echo "" >> $(EXPORTDIR)/makeinfo.sh
@echo "ARCHSUBDIR=\"$(ARCHSUBDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "ARCHDIR=\"$(ARCHDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
ifdef ARCHSCRIPT
@echo "LDNAME=\"$(LDNAME)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "LDDIR=\"$(LDDIR)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "LDPATH=\"$(LDPATH)\"" >> $(EXPORTDIR)/makeinfo.sh
endif
@echo "ARCHCFLAGS=\"$(ARCHCFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
@echo "ARCHCXXFLAGS=\"$(ARCHCXXFLAGS) $(ARCHCPUFLAGS)\"" >> $(EXPORTDIR)/makeinfo.sh
@chmod 755 $(EXPORTDIR)/makeinfo.sh
+35 -11
View File
@@ -41,9 +41,10 @@
# Get the input parameter list
USAGE="USAGE: $0 [-d] -t <top-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\""
USAGE="USAGE: $0 [-d] [-z] -t <top-dir> [-x <lib-ext>] -l \"lib1 [lib2 [lib3 ...]]\""
unset TOPDIR
unset LIBLIST
unset TGZ
LIBEXT=.a
while [ ! -z "$1" ]; do
@@ -63,6 +64,9 @@ while [ ! -z "$1" ]; do
shift
LIBEXT=$1
;;
-z )
TGZ=y
;;
-h )
echo $USAGE
exit 0
@@ -113,9 +117,14 @@ if [ -d "${EXPORTDIR}" ]; then
rm -rf "${EXPORTDIR}"
fi
# Remove any possible previous results
rm -f "${EXPORTDIR}.tar"
rm -f "${EXPORTDIR}.zip"
rm -f "${EXPORTDIR}.tar.gz"
# Create the export directory and some of its subdirectories
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; }
@@ -139,22 +148,32 @@ source "${EXPORTDIR}/makeinfo.sh"
rm -f "${EXPORTDIR}/makeinfo.sh"
rm -f "${EXPORTDIR}/Make.defs"
# Verifty the build info that we got from makeinfo.sh
# Verify the build info that we got from makeinfo.sh
if [ ! -d "${ARCHDIR}" ]; then
echo "MK: Directory ${ARCHDIR} does not exist"
exit 1
fi
if [ ! -f "${LDPATH}" ]; then
echo "MK: File ${LDPATH} does not exist"
exit 1
# Is there a linker script in this configuration?
if [ ! -z "${LDPATH}" ]; then
# Apparently so. Verify that the script exists
if [ ! -f "${LDPATH}" ]; then
echo "MK: File ${LDPATH} does not exist"
exit 1
fi
# Copy the linker script
cp --preserve=all "${LDPATH}" "${EXPORTDIR}/build/." || \
{ echo "MK: cp ${LDPATH} failed"; exit 1; }
fi
# Copy the build info that we got from makeinfo.sh
# Save the compilation options
cp --preserve=all "${LDPATH}" "${EXPORTDIR}/build/." || \
{ echo "MK: cp ${LDPATH} failed"; exit 1; }
echo "ARCHCFLAGS = ${ARCHCFLAGS}" >"${EXPORTDIR}/build/Make.defs"
echo "ARCHCXXFLAGS = ${ARCHCXXFLAGS}" >>"${EXPORTDIR}/build/Make.defs"
@@ -221,9 +240,14 @@ done
cd "${TOPDIR}" || \
{ echo "MK: 'cd ${TOPDIR}' failed"; exit 1; }
tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1
gzip -f "${EXPORTSUBDIR}.tar"
if [ "X${TGZ}" = "Xy" ]; then
tar cvf "${EXPORTSUBDIR}.tar" "${EXPORTSUBDIR}" 1>/dev/null 2>&1
gzip -f "${EXPORTSUBDIR}.tar"
else
zip -r "${EXPORTSUBDIR}.zip" "${EXPORTSUBDIR}" 1>/dev/null 2>&1
fi
# Clean up after ourselves
rm -rf "${EXPORTSUBDIR}"
rm -rf "${EXPORTSUBDIR}"