rnsl

Load a list of strings expanded by the shell
git clone git://git.meso-star.fr/rnsl.git
Log | Files | Refs | README | LICENSE

make.sh (1967B)


      1 #!/bin/sh
      2 
      3 # Copyright (C) 2022, 2023 Centre National de la Recherche Scientifique
      4 # Copyright (C) 2022, 2023 Institut Pierre-Simon Laplace
      5 # Copyright (C) 2022, 2023 Institut de Physique du Globe de Paris
      6 # Copyright (C) 2022, 2023 |Méso|Star> (contact@meso-star.com)
      7 # Copyright (C) 2022, 2023 Observatoire de Paris
      8 # Copyright (C) 2022, 2023 Université de Reims Champagne-Ardenne
      9 # Copyright (C) 2022, 2023 Université de Versaille Saint-Quentin
     10 # Copyright (C) 2022, 2023 Université Paul Sabatier
     11 #
     12 # This program is free software: you can redistribute it and/or modify
     13 # it under the terms of the GNU General Public License as published by
     14 # the Free Software Foundation, either version 3 of the License, or
     15 # (at your option) any later version.
     16 #
     17 # This program is distributed in the hope that it will be useful,
     18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     20 # GNU General Public License for more details.
     21 #
     22 # You should have received a copy of the GNU General Public License
     23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
     24 
     25 set -e
     26 
     27 config_test()
     28 {
     29   for i in "$@"; do
     30     test=$(basename "${i}" ".c")
     31     test_list="${test_list} ${test}"
     32     printf "%s: %s\n" "${test}" "src/${test}.o"
     33   done
     34   printf "test_bin: %s\n" "${test_list}"
     35 }
     36 
     37 run_test()
     38 {
     39   for i in "$@"; do
     40     test=$(basename "${i}" ".c")
     41 
     42     printf "%s " "${test}"
     43     if "./${test}" > /dev/null 2>&1; then
     44       printf "\033[1;32mOK\033[m\n"
     45     else
     46       printf "\033[1;31mError\033[m\n"
     47     fi
     48   done 2> /dev/null
     49 }
     50 
     51 clean_test()
     52 {
     53   for i in "$@"; do
     54     rm -f "$(basename "${i}" ".c")"
     55   done
     56 }
     57 
     58 install()
     59 {
     60   prefix=$1
     61   shift 1
     62 
     63   mkdir -p "${prefix}"
     64 
     65   for i in "$@"; do
     66     dst="${prefix}/${i##*/}"
     67 
     68     if cmp -s "${i}" "${dst}"; then
     69       printf "Up to date %s\n" "${dst}"
     70     else
     71       printf "Installing %s\n" "${dst}"
     72       cp "${i}" "${prefix}"
     73     fi
     74   done
     75 }
     76 
     77 "$@"