loader_aw

Load OBJ/MTL file formats
git clone git://git.meso-star.fr/loader_aw.git
Log | Files | Refs | README | LICENSE

commit 76fa3218bad5cf942da839291155cdbdaa19c4a3
parent 4a702032597c3dcbabc08e069602705d09b9cb6b
Author: vaplv <vaplv@free.fr>
Date:   Mon, 11 Apr 2022 21:47:56 +0200

Add a make.sh script

Use it in the Makefile to clean-up the tests management

Diffstat:
MMakefile | 17++---------------
Amake.sh | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile @@ -93,23 +93,10 @@ test: build_tests .test: Makefile @echo "Setup tests" - @{ for i in $(TEST_SRC); do \ - test=$$(echo "$${i}" | sed 's/src\/\(.\{1,\}\).c$$/\1/'); \ - printf "test_bin: %s\n" "$${test}"; \ - printf "%s: %s\n" "$${test}" "src/$${test}.o"; \ - done; } > .test + @$(SHELL) make.sh config_test $(TEST_SRC) > .test test_run: test_bin - @n=0; \ - for i in $(TEST_SRC); do \ - test=$$(echo $${i} | sed 's/src\/\(.\{1,\}\).c$$/\1/'); \ - [ "$${test}" = "test_aw" ] && continue; \ - printf "%s" $${test}; \ - ./"$${test}" > /dev/null 2>&1 \ - && printf " \e[1;32mOK\e[m\n" \ - || { printf " \e[1;31mErreur\e[m\n"; n=$$((n+1)); }; \ - done; \ - if [ "$${n}" -ne 0 ]; then printf "%d errors\n" "$${n}"; exit 1; fi + @$(SHELL) make.sh run_test src/test_aw_mtl.c src/test_aw_obj.c $(TEST_OBJ): config.mk $(CC) $(CFLAGS) -c $(@:.o=.c) -o $@ diff --git a/make.sh b/make.sh @@ -0,0 +1,63 @@ +#!/bin/sh -e + +# Copyright (C) 2013-2021 Vincent Forest (vaplv@free.fr) +# +# This CMake script is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This CMake script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this CMake script. If not, see <http://www.gnu.org/licenses/>. + +config_test() +{ + if [ $# -lt 1 ]; then + echo "usage: config_test [src ...]" >&2 + exit 1 + fi + + for i in "$@"; do + test=$(echo "${i}" | sed 's/src\/\(.\{1,\}\).c$/\1/') + test_list="${test_list} ${test}" + printf "%s: %s\n" "${test}" "src/${test}.o" + done + printf "test_bin: %s\n" "${test_list}" +} + +run_test() +{ + n=0 + + for i in "$@"; do + test=$(echo "${i}" | sed 's/src\/\(.\{1,\}\).c$/\1/') + + printf "%s " "${test}" + if ./"${test}" > /dev/null 2>&1; then + printf "\e[1;32mOK\e[m\n" + else + printf "\e[1;31mErreur\e[m\n" + n=$((n+1)) + fi + done + + if [ "${n}" -ne 0 ]; then + printf "%d errors\n" "${n}" + exit 1 + fi +} + +clean_test() +{ + for i in "$@"; do + test=$(echo "${i}" | sed 's/src\/\(.\{1,\}\).c$/\1/') + rm -f "${test}" + done +} + +"$@"