Annotation of rpl/scripts/mkrplso.in, revision 1.7

1.7     ! bertrand    1: #!@BASH_PATH@
1.1       bertrand    2: 
                      3: #===============================================================================
                      4: # RPL/2 version @VERSION@
                      5: #   Interpréteur du langage de programmation du calculateur HP-28S,
                      6: #
                      7: #   Date de création    : 02 Avril 1.998
                      8: #
                      9: #   Tous droits réservés à l'auteur, Joël BERTRAND
                     10: #===============================================================================
                     11: 
                     12: #===============================================================================
                     13: # Copyright (C) 2001 BERTRAND Joël
                     14: #
                     15: # This file is part of RPL/2.
                     16: #
                     17: # RPL/2 is free software; you can redistribute it and/or modify it
                     18: # under the terms of the GNU General Public License as published by the
                     19: # Free Software Foundation; either version 2, or (at your option) any
                     20: # later version.
                     21: #
                     22: # RPL/2 is distributed in the hope that it will be useful, but WITHOUT
                     23: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
                     24: # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     25: # for more details.
                     26: #
                     27: # You should have received a copy of the GNU General Public License
                     28: # along with Octave; see the file COPYING.  If not, write to the Free
                     29: # Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
                     30: #===============================================================================
                     31: 
                     32: #===============================================================================
                     33: # Script de compilation des bibliothèques partagées du langage RPL/2
                     34: #
                     35: #    Tous droits réservés, J. BERTRAND 29.03.2001
                     36: #===============================================================================
                     37: 
                     38: #===============================================================================
                     39: # Les paramètres du script sont identiques à ceux de g77. Seul
                     40: # ajout, l'option -strip retirant la table des symboles de la bibliothèque
                     41: # dynamique.
                     42: #
                     43: # Exemples :
                     44: #   mkrplso essai.c -o essai.rplso -strip
                     45: #   mkrplso essai.c -o essai.rplso -O6
                     46: #   mkrplso essai.c lib.a -o essai.rplso
                     47: #===============================================================================
                     48: 
                     49: echo +++RPL/2 @VERSION@ shared library build tool
                     50: 
                     51: PRESENCE_FICHIER_SORTIE=FAUX
                     52: PRESENCE_OPTION_STRIP=FAUX
                     53: COMPILATION_SEULE=FAUX
                     54: DRAPEAU=FAUX
                     55: P=1
1.6       bertrand   56: RPLC_MAIN=
1.1       bertrand   57: 
                     58: for i in $@;
                     59: do
                     60:    P=$(($P+1))
                     61: 
                     62:    if [ $DRAPEAU = "VRAI" ]; then
                     63:        DRAPEAU=FAUX
                     64:        FICHIER_SORTIE=$i
                     65:    fi
                     66: 
                     67:    if [ $i = "-o" ]; then
                     68:        if [ $PRESENCE_FICHIER_SORTIE = VRAI ]; then
                     69:            echo +++Error: more than one output file
                     70:            exit 1
                     71:        fi
                     72: 
                     73:        PRESENCE_FICHIER_SORTIE=VRAI
                     74: 
                     75:        if [ $P -gt $# ]; then
                     76:            echo +++Error: no output file
                     77:            exit 1
                     78:        else
                     79:            DRAPEAU=VRAI
                     80:        fi
                     81:    fi
                     82: 
                     83:    if [ $i = "-c" ]; then
                     84:        COMPILATION_SEULE=VRAI
                     85:    fi
1.6       bertrand   86: 
                     87:    if [ -e "$i" ]; then
                     88:        if [ $(rplfile -m $(dirname $(which $0))/../share/rplfiles $i | \
                     89:                grep "C source" | wc -l) = 1 ]; then
                     90:            if [ $(grep exportExternalFunctions $i | wc -l) = 1 ]; then
                     91:                RPLC_MAIN=-D__RPLC_MAIN
                     92:            fi
                     93:        fi
                     94:    fi
                     95:            
1.1       bertrand   96: done
                     97: 
                     98: if [ $PRESENCE_FICHIER_SORTIE = FAUX ]; then
                     99:    echo +++Error: no output file
                    100:    exit 1
                    101: fi
                    102: 
                    103: PROCESSEUR=$(uname -m)
                    104: test $PROCESSEUR = i386 && OPTIONS=-mieee-fp
                    105: test $PROCESSEUR = i486 && OPTIONS=-mieee-fp
                    106: test $PROCESSEUR = i586 && OPTIONS=-mieee-fp
                    107: test $PROCESSEUR = i686 && OPTIONS=-mieee-fp
                    108: test $PROCESSEUR = alpha && OPTIONS=-mieee
                    109: test $PROCESSEUR = sparc && OPTIONS=
                    110: test $PROCESSEUR = i86pc && OPTIONS=
                    111: 
                    112: ARGUMENTS_G77=""
                    113: 
                    114: for i in $@;
                    115: do
                    116:    if [ $i = "-strip" ]; then
                    117:        PRESENCE_OPTION_STRIP=VRAI
                    118:    else
                    119:        ARGUMENTS_G77="$ARGUMENTS_G77 $i"
                    120:    fi
                    121: done
                    122: 
                    123: P=0
                    124: for i in $(which $0 | tr '/' ' ');
                    125: do
                    126:    P=$(($P+1))
                    127: done
                    128: 
                    129: if [ $COMPILATION_SEULE = "VRAI" ]; then
                    130:    echo +++Compiler for RPL/2 version @VERSION@
                    131:    gfortran -x c $ARGUMENTS_G77 -fPIC -Wall -DRPLCONFIG $OPTIONS $CFLAGS\
1.3       bertrand  132:            -I$(which $0 | cut -d '/' -f -$(($P-1)))/include -funsigned-char\
1.6       bertrand  133:            -D_d_version_rpl=\"@VERSION@\" -std=gnu99 $RPLC_MAIN
1.1       bertrand  134: else
                    135:    echo +++Linker for RPL/2 version @VERSION@
                    136:    gfortran $ARGUMENTS_G77 -shared -fPIC -Wall -DRPLCONFIG $OPTIONS $CFLAGS\
1.6       bertrand  137:            -I$(which $0 | cut -d '/' -f -$(($P-1)))/include -funsigned-char\
                    138:            $RPLC_MAIN
1.1       bertrand  139: fi
                    140: 
                    141: test $PRESENCE_OPTION_STRIP = VRAI && strip -s $FICHIER_SORTIE
                    142: chmod 644 $FICHIER_SORTIE
                    143: 
                    144: exit 0

CVSweb interface <joel.bertrand@systella.fr>