diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-12 23:54:13 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-12 23:54:13 +0000 |
commit | 074aac21225594a28e8a03540859a11d91152a9f (patch) | |
tree | f7404511855674fe0b78e278680732edc576d034 /nuttx/tools | |
parent | eecfa549d1a8deca62340eb10848dd8e6d505436 (diff) | |
download | px4-nuttx-074aac21225594a28e8a03540859a11d91152a9f.tar.gz px4-nuttx-074aac21225594a28e8a03540859a11d91152a9f.tar.bz2 px4-nuttx-074aac21225594a28e8a03540859a11d91152a9f.zip |
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
Diffstat (limited to 'nuttx/tools')
-rw-r--r-- | nuttx/tools/Makefile.export | 4 | ||||
-rwxr-xr-x | nuttx/tools/mkexport.sh | 46 |
2 files changed, 39 insertions, 11 deletions
diff --git a/nuttx/tools/Makefile.export b/nuttx/tools/Makefile.export index 6d2f13481..650dc7241 100644 --- a/nuttx/tools/Makefile.export +++ b/nuttx/tools/Makefile.export @@ -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 diff --git a/nuttx/tools/mkexport.sh b/nuttx/tools/mkexport.sh index 41e429cd2..36255fe46 100755 --- a/nuttx/tools/mkexport.sh +++ b/nuttx/tools/mkexport.sh @@ -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}" |