From c46d04e1b5bd45912be07773c2cd8b82aa7fa01a Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 5 Jan 2008 14:10:22 +0000 Subject: Add config scripts git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@493 42af7a65-404d-4744-a932-0658087f49c3 --- misc/pascal/Configure | 188 ++++++++++++++++++++++++++++++++++++++++++++++ misc/pascal/Make.config.h | 78 +++++++++++++++++++ misc/pascal/Make.defs | 50 ++++++++++++ misc/pascal/Reconfigure | 89 ++++++++++++++++++++++ misc/pascal/config.info | 60 +++++++++++++++ misc/pascal/zipme | 71 +++++++++++++++++ 6 files changed, 536 insertions(+) create mode 100755 misc/pascal/Configure create mode 100644 misc/pascal/Make.config.h create mode 100644 misc/pascal/Make.defs create mode 100755 misc/pascal/Reconfigure create mode 100755 misc/pascal/config.info create mode 100755 misc/pascal/zipme (limited to 'misc/pascal') diff --git a/misc/pascal/Configure b/misc/pascal/Configure new file mode 100755 index 000000000..da64f209d --- /dev/null +++ b/misc/pascal/Configure @@ -0,0 +1,188 @@ +#! /bin/sh +############################################################################ +# Configure +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +Usage=" \n ++---------------- \n +| USAGE: \n +| ./Configure [--debug] [--help] \n +| \n +| OPTIONS: \n +| --debug \n +| Prints what script is doing \n +| \n +| --reconfig \n +| Just regenerate the Make.config file \n +| \n +| --help \n +| Prints this block. \n ++---------------- \n +" + +# readans prompt default +# +function readans () { + echo -n "$1 ($2): " + IFS='@' read ans || exit 1 + [ -z "$ans" ] && ans=$2 +} + +# readyn prompt default +# +function readyn () { + while :; do + readans "$1 [Y/N]" $2 + case "$ans" in + [yY] | [yY]es ) + ans=y + break ;; + [nN] | [nN]o ) + ans=n + break ;; + * ) + echo "Please answer Y or N" + ;; + esac + done +} + +# Process command line arguments +# +REGEN="NO" +while [ $# -gt 0 ] ; do + case "$1" in + --debug ) + set -x + Pause="read press return to continue" + ;; + --regen ) + REGEN="YES" + ;; + *) + echo $Usage + exit -1 + ;; + esac + shift +done + +# Setup configurations files +# +CONFIGFILE=.config +MAKECONFIG=Make.config +TMPCONFIGFILE=TMP.config +TMPMAKECONFIG=TMP.Make.config + +# Remove temporary configuration files in case we are restarting +# after control-C +# +rm -f $TMPCONFIGFILE $TMPMAKECONFIG + +# Get information about the configuration settings +# +source config.info + +# Set up default values for all configuration settings +# +for i in $CONFIGS +do + config_name=$(echo $i|cut -d':' -f1) + default_value=$(echo $i|cut -d':' -f2) + eval $config_name=$default_value +done + +# If we have been previously configured, then there should be both +# .config and Make.config files. Source the .config file, overwriting +# the defaults that we set up above. +# +if [ -e ${CONFIGFILE} ] ; then + source ${CONFIGFILE} +else + # We can't regenerate the Make.config file if there is no + # .config file + # + REGEN="NO" +fi + +# Output the new Config file and Makefile fragment headers +# +SEPARATOR="# ----------------------------------------------------------------------" + +if [ "${REGEN}" != "YES" ]; then + echo "#!/bin/sh" >${TMPCONFIGFILE} + echo "#" >>${TMPCONFIGFILE} + echo "# Auto generated by Configure. Do not edit" >>${TMPCONFIGFILE} + echo "#" >>${TMPCONFIGFILE} +fi + +echo $SEPARATOR >${TMPMAKECONFIG} +echo "# Make.config" >>${TMPMAKECONFIG} +echo "#" >>${TMPMAKECONFIG} +echo "# This file controls the configuration of the compiler" >>${TMPMAKECONFIG} +echo "# Auto generated by Configure. Do not edit" >>${TMPMAKECONFIG} +echo $SEPARATOR >>${TMPMAKECONFIG} +echo "#" >>${TMPMAKECONFIG} + +# Prompt for the setting of each configuration variable +for i in $CONFIGS +do + config_name=$(echo $i|cut -d':' -f1) + eval desc=\$${config_name}_INFO + eval config_value=\$$config_name + + if [ "${REGEN}" != "YES" ]; then + readyn "$desc" $config_value + eval config_value=$ans + echo "$config_name=$config_value" >>${TMPCONFIGFILE} + fi + + echo $SEPARATOR >>${TMPMAKECONFIG} + echo "# $desc" >>${TMPMAKECONFIG} + echo $SEPARATOR >>${TMPMAKECONFIG} + echo "$config_name = $config_value" >>${TMPMAKECONFIG} + echo "" >>${TMPMAKECONFIG} +done + +# Make the changes permanent +# +if [ "${REGEN}" != "YES" ]; then + mv -f $TMPCONFIGFILE $CONFIGFILE + chmod 755 $CONFIGFILE + echo "Config script \"${CONFIGFILE}\" created" +fi + +mv -f $TMPMAKECONFIG $MAKECONFIG +chmod 644 $MAKECONFIG +echo "Make fragment \"${MAKECONFIG}\" created" diff --git a/misc/pascal/Make.config.h b/misc/pascal/Make.config.h new file mode 100644 index 000000000..ab34b4fd3 --- /dev/null +++ b/misc/pascal/Make.config.h @@ -0,0 +1,78 @@ +############################################################################ +# Make.config.h +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +# +# Directories +# +PASCAL = ${shell pwd} + +include $(PASCAL)/Make.config +include $(PASCAL)/Make.defs + +INCDIR = $(PASCAL)/include +CONFIGH = $(INCDIR)/config.h + +CONFIGS = CONFIG_DEBUG CONFIG_TRACE CONFIG_INSN16 CONFIG_INSN32 + +# ---------------------------------------------------------------------- +# Objects and targets + +all: config.h +.PHONY: all config.h $(CONFIGS) header trailer clean + +$(CONFIGS): + @if [ "$($@)" = "y" ] ; then \ + echo "#define $@ 1" >>$(CONFIGH) ; \ + else \ + echo "#undef $@" >>$(CONFIGH) ; \ + fi + +header: + @$(RM) $(INCDIR)/config.h + @echo "/* config.h: Autogenerated -- Do not edit. */" >$(CONFIGH) + @echo "" >>$(CONFIGH) + @echo "#ifndef __CONFIG_H" >>$(CONFIGH) + @echo "#define __CONFIG_H 1" >>$(CONFIGH) + @echo "" >>$(CONFIGH) + +trailer: + @echo "" >>$(CONFIGH) + @echo "#endif /* __CONFIG_H */" >>$(CONFIGH) + +$(CONFIGH): Make.config header $(CONFIGS) trailer + +config.h: $(CONFIGH) + +clean: + $(RM) $(INCDIR)/config.h diff --git a/misc/pascal/Make.defs b/misc/pascal/Make.defs new file mode 100644 index 000000000..cb0afc924 --- /dev/null +++ b/misc/pascal/Make.defs @@ -0,0 +1,50 @@ +############################################################################ +# Make.defs +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +# +# Tools +# +CC = /usr/bin/gcc +CPP = /usr/bin/cpp +LD = /usr/bin/ld +MAKE = /usr/bin/make +AR = /usr/bin/ar + +RM = /bin/rm -f + +DEFINES = +INCLUDES = -I. -I$(INCDIR) +CFLAGS = -Wall -g $(DEFINES) $(INCLUDES) +LDFLAGS = -L$(LIBDIR) +ARFLAGS = -r diff --git a/misc/pascal/Reconfigure b/misc/pascal/Reconfigure new file mode 100755 index 000000000..98c5e5e74 --- /dev/null +++ b/misc/pascal/Reconfigure @@ -0,0 +1,89 @@ +#! /bin/sh +############################################################################ +# Reconfigure +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +function show_usage () +{ + echo "USAGE:" + echo " ./Configure [--debug] [--help] " + echo "OPTIONS:" + echo " --debug" + echo " Prints what script is doing" + echo " --help" + echo " Prints this information" + exit 1 +} + +# Process command line arguments +# +DEBUG= +CONFIGFILE= +while [ $# -gt 0 ] ; do + case "$1" in + --debug ) + DEBUG=$1 + ;; + --help ) + show_usage + exit 1 + ;; + * ) + CONFIGFILE=$1 + ;; + esac + shift +done + +if [ -z "${CONFIGFILE}" ]; then + echo " not specified" + show_usage + exit 1 +fi + +if [ ! -x "${CONFIGFILE}" ]; then + echo "Executable =\"${CONFIGFILE}\" does not exist" + show_usage + exit 1 +fi + +if [ ! -x Configure ]; then + echo "./Configure script does not exist" + exit 1 +fi + +cp -f ${CONFIGFILE} .config || \ + { echo "Copy of ${CONFIGFILE} .config failed" ; exit 1 ; } + +./Configure --regen $DEBUG diff --git a/misc/pascal/config.info b/misc/pascal/config.info new file mode 100755 index 000000000..8832061eb --- /dev/null +++ b/misc/pascal/config.info @@ -0,0 +1,60 @@ +#! /bin/sh +############################################################################ +# config.info +# +# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ +# +# Configuration information +# Format is : +# +CONFIGS= + +# DEBUG configuration +CONFIG_DEBUG_INFO="Enable DEBUG instrumentation" +CONFIGS="$CONFIGS CONFIG_DEBUG:n" + +# TRACE configuration +CONFIG_TRACE_INFO="Enable TRACE instrumentation" +CONFIGS="$CONFIGS CONFIG_TRACE:n" + +# 16-bit processor model selection +CONFIG_INSN16_INFO="Use a 16-bit processor model" +CONFIGS="$CONFIGS CONFIG_INSN16:y" + +# 32-bit processor model selection +CONFIG_INSN32_INFO="Use a 32-bit processor model" +CONFIGS="$CONFIGS CONFIG_INSN32:n" + +# Register model selection +CONFIG_REGM_INFO="Processor module supports a register machine" +CONFIGS="$CONFIGS CONFIG_REGM:n" diff --git a/misc/pascal/zipme b/misc/pascal/zipme new file mode 100755 index 000000000..1d9d87194 --- /dev/null +++ b/misc/pascal/zipme @@ -0,0 +1,71 @@ +#!/bin/sh + +#set -x + +DATECODE=$1 + +TAR="tar cvf" +ZIP=bzip2 + +# Move up one directory + +cd .. +HOME=`pwd` +DIR=${HOME}/pascal +SUBDIR=pascal + +# Make sure we know what is going on + +if [ -z ${DATECODE} ] ; then + echo "You must supply a date code like MMDDYY as a parameter" + exit 1; +fi + +if [ ! -d ${SUBDIR} ] ; then + echo "Directory ${SUBDIR} does not exist." + exit 1; +fi + +if [ ! -x ${SUBDIR}/$0 ] ; then + echo "You must cd to the directory containing this script." + exit 1; +fi + +# Define the ZIP file pathes + +TAR_NAME=${SUBDIR}-${DATECODE}.tar +ZIP_NAME=${TAR_NAME}.bz2 + +# Prepare the directory + +make -C ${SUBDIR} deep-clean + +find ${SUBDIR} -name \*~ -exec rm -f {} \; || \ + { echo "Removal of emacs garbage failed!" ; exit 1 ; } + +find ${SUBDIR} -name \#\* -exec rm -f {} \; || \ + { echo "Removal of emacs garbage failed!" ; exit 1 ; } + +find ${SUBDIR} -name .\*swp\* -exec rm -f {} \; || \ + { echo "Removal of vi garbage failed!" ; exit 1 ; } + +# Remove any previous tarballs + +if [ -f ${TAR_NAME} ] ; then + echo "Removing ${HOME}/${TAR_NAME}" + rm -f ${TAR_NAME} || \ + { echo "rm ${TAR_NAME} failed!" ; exit 1 ; } +fi + +if [ -f ${ZIP_NAME} ] ; then + echo "Removing ${HOME}/${ZIP_NAME}" + rm -f ${ZIP_NAME} || \ + { echo "rm ${ZIP_NAME} failed!" ; exit 1 ; } +fi + +# Then zip it + +${TAR} ${TAR_NAME} ${SUBDIR} || \ + { echo "tar of ${DIR} failed!" ; exit 1 ; } +${ZIP} ${TAR_NAME} || \ + { echo "zip of ${TAR_NAME} failed!" ; exit 1 ; } -- cgit v1.2.3