star-cpr

Clip 2D meshes with 2D polygons
git clone git://git.meso-star.fr/star-cpr.git
Log | Files | Refs | README | LICENSE

make.sh (1551B)


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