replace autoconf with uwproj

Fri, 22 Sep 2023 23:26:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 22 Sep 2023 23:26:23 +0200
changeset 68
ae763178ee1e
parent 67
767fe7a007f7
child 69
186e41b332d9

replace autoconf with uwproj

.hgignore file | annotate | diff | comparison | revisions
Makefile file | annotate | diff | comparison | revisions
Makefile.am file | annotate | diff | comparison | revisions
README file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
make/cc.mk file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
make/uwproj.xsd file | annotate | diff | comparison | revisions
prebuild.sh file | annotate | diff | comparison | revisions
src/Makefile file | annotate | diff | comparison | revisions
src/Makefile.am file | annotate | diff | comparison | revisions
src/cline.h file | annotate | diff | comparison | revisions
test/Makefile file | annotate | diff | comparison | revisions
test/Makefile.am file | annotate | diff | comparison | revisions
test/codeonly.sh file | annotate | diff | comparison | revisions
test/codeonly_chars.sh file | annotate | diff | comparison | revisions
test/nocomments.sh file | annotate | diff | comparison | revisions
test/total.sh file | annotate | diff | comparison | revisions
test/total_chars.sh file | annotate | diff | comparison | revisions
     1.1 --- a/.hgignore	Fri Jun 03 20:06:08 2022 +0200
     1.2 +++ b/.hgignore	Fri Sep 22 23:26:23 2023 +0200
     1.3 @@ -6,17 +6,4 @@
     1.4  \.chg\..*$
     1.5  \.rej$
     1.6  \.conflict\~$
     1.7 -^autom4te.cache/
     1.8 -^aclocal.m4$
     1.9 -^compile$
    1.10 -^depcomp$
    1.11 -^install-sh$
    1.12 -^missing$
    1.13 -^test-driver$
    1.14 -^configure$
    1.15 -^config\.
    1.16 -\.in$
    1.17 -^stamp-h
    1.18 -/test-suite.log$
    1.19 -^cline-.*\.tar.gz$
    1.20 -
    1.21 +^config\.mk$
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile	Fri Sep 22 23:26:23 2023 +0200
     2.3 @@ -0,0 +1,44 @@
     2.4 +# Copyright 2018 Mike Becker. All rights reserved.
     2.5 +#
     2.6 +# Redistribution and use in source and binary forms, with or without
     2.7 +# modification, are permitted provided that the following conditions are met:
     2.8 +#
     2.9 +# 1. Redistributions of source code must retain the above copyright
    2.10 +# notice, this list of conditions and the following disclaimer.
    2.11 +#
    2.12 +# 2. Redistributions in binary form must reproduce the above copyright
    2.13 +# notice, this list of conditions and the following disclaimer in the
    2.14 +# documentation and/or other materials provided with the distribution.
    2.15 +#
    2.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    2.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    2.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    2.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    2.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    2.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    2.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    2.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    2.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2.26 +
    2.27 +
    2.28 +all: build config.mk FORCE
    2.29 +	@cd src && $(MAKE) -s
    2.30 +
    2.31 +install: build config.mk FORCE
    2.32 +	@cd src && $(MAKE) -s install
    2.33 +
    2.34 +build:
    2.35 +	@mkdir -p build
    2.36 +
    2.37 +clean:
    2.38 +	@rm -f -R build
    2.39 +
    2.40 +config.mk:
    2.41 +	@echo "create config"
    2.42 +	@./configure --release
    2.43 +
    2.44 +check:
    2.45 +	@cd test && $(MAKE) -s
    2.46 +
    2.47 +FORCE:
     3.1 --- a/Makefile.am	Fri Jun 03 20:06:08 2022 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,25 +0,0 @@
     3.4 -# Copyright 2018 Mike Becker. All rights reserved.
     3.5 -# 
     3.6 -# Redistribution and use in source and binary forms, with or without
     3.7 -# modification, are permitted provided that the following conditions are met:
     3.8 -# 
     3.9 -# 1. Redistributions of source code must retain the above copyright
    3.10 -# notice, this list of conditions and the following disclaimer.
    3.11 -# 
    3.12 -# 2. Redistributions in binary form must reproduce the above copyright
    3.13 -# notice, this list of conditions and the following disclaimer in the
    3.14 -# documentation and/or other materials provided with the distribution.
    3.15 -# 
    3.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    3.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    3.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    3.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    3.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    3.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    3.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    3.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    3.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    3.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3.26 -
    3.27 -AUTOMAKE_OPTIONS = foreign
    3.28 -SUBDIRS = src test
     4.1 --- a/README	Fri Jun 03 20:06:08 2022 +0200
     4.2 +++ b/README	Fri Sep 22 23:26:23 2023 +0200
     4.3 @@ -5,8 +5,8 @@
     4.4  Contents:
     4.5  1) About ................................................................... 12
     4.6  2) Build instructions ...................................................... 24
     4.7 -3) Usage example ........................................................... 39
     4.8 -4) License ................................................................. 48
     4.9 +3) Usage example ........................................................... 35
    4.10 +4) License ................................................................. 44
    4.11  
    4.12  
    4.13  1) About ______________________________________________________________________
    4.14 @@ -23,18 +23,14 @@
    4.15  
    4.16  2) Build instructions _________________________________________________________
    4.17  
    4.18 -If you checked out the sources from version control, you firstly need to run
    4.19 -  ./prebuild.sh
    4.20 -This requires autotools installed on your system and creates a build dir.
    4.21 -  
    4.22 -In release version you can skip the first task and just run
    4.23 -  ./configure && make
    4.24 +When you want to build from source, you can just run
    4.25 +  make
    4.26  
    4.27  After building you get a system wide install with
    4.28    sudo make install
    4.29  
    4.30  To enable a debug build, configure with
    4.31 -  ./configure --enable-debug
    4.32 +  ./configure --debug
    4.33  
    4.34  3) Example usage ______________________________________________________________
    4.35  
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/configure	Fri Sep 22 23:26:23 2023 +0200
     5.3 @@ -0,0 +1,314 @@
     5.4 +#!/bin/sh
     5.5 +
     5.6 +# create temporary directory
     5.7 +TEMP_DIR=".tmp-`uname -n`"
     5.8 +rm -Rf "$TEMP_DIR"
     5.9 +if mkdir -p "$TEMP_DIR"; then
    5.10 +    :
    5.11 +else
    5.12 +    echo "Cannot create tmp dir $TEMP_DIR"
    5.13 +    echo "Abort"
    5.14 +    exit 1
    5.15 +fi
    5.16 +touch "$TEMP_DIR/options"
    5.17 +touch "$TEMP_DIR/features"
    5.18 +
    5.19 +# define standard variables
    5.20 +PREFIX=/usr
    5.21 +EPREFIX=
    5.22 +BINDIR=
    5.23 +SBINDIR=
    5.24 +LIBDIR=
    5.25 +LIBEXECDIR=
    5.26 +DATADIR=
    5.27 +SYSCONFDIR=
    5.28 +SHAREDSTATEDIR=
    5.29 +LOCALSTATEDIR=
    5.30 +INCLUDEDIR=
    5.31 +INFODIR=
    5.32 +MANDIR=
    5.33 +
    5.34 +# custom variables
    5.35 +
    5.36 +# features
    5.37 +
    5.38 +# clean abort
    5.39 +abort_configure()
    5.40 +{
    5.41 +    rm -Rf "$TEMP_DIR"
    5.42 +    exit 1
    5.43 +}
    5.44 +
    5.45 +# help text
    5.46 +printhelp()
    5.47 +{
    5.48 +    echo "Usage: $0 [OPTIONS]..."
    5.49 +    cat << __EOF__
    5.50 +Installation directories:
    5.51 +  --prefix=PREFIX         path prefix for architecture-independent files
    5.52 +                          [/usr]
    5.53 +  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
    5.54 +                          [PREFIX]
    5.55 +
    5.56 +  --bindir=DIR            user executables [EPREFIX/bin]
    5.57 +  --sbindir=DIR           system admin executables [EPREFIX/sbin]
    5.58 +  --libexecdir=DIR        program executables [EPREFIX/libexec]
    5.59 +  --sysconfdir=DIR        system configuration files [PREFIX/etc]
    5.60 +  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    5.61 +  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    5.62 +  --libdir=DIR            object code libraries [EPREFIX/lib]
    5.63 +  --includedir=DIR        C header files [PREFIX/include]
    5.64 +  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
    5.65 +  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
    5.66 +  --infodir=DIR           info documentation [DATAROOTDIR/info]
    5.67 +  --mandir=DIR            man documentation [DATAROOTDIR/man]
    5.68 +
    5.69 +__EOF__
    5.70 +}
    5.71 +
    5.72 +#
    5.73 +# parse arguments
    5.74 +#
    5.75 +BUILD_TYPE="default"
    5.76 +for ARG in "$@"
    5.77 +do
    5.78 +    case "$ARG" in
    5.79 +        "--prefix="*)         PREFIX=${ARG#--prefix=} ;;
    5.80 +        "--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
    5.81 +        "--bindir="*)         BINDIR=${ARG#----bindir=} ;;
    5.82 +        "--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
    5.83 +        "--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
    5.84 +        "--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
    5.85 +        "--datadir="*)        DATADIR=${ARG#--datadir=} ;;
    5.86 +        "--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
    5.87 +        "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
    5.88 +        "--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
    5.89 +        "--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
    5.90 +        "--infodir="*)        INFODIR=${ARG#--infodir=} ;;
    5.91 +        "--mandir"*)          MANDIR=${ARG#--mandir} ;;
    5.92 +        "--help"*) printhelp; abort_configure ;;
    5.93 +        "--debug")           BUILD_TYPE="debug" ;;
    5.94 +        "--release")         BUILD_TYPE="release" ;;
    5.95 +        "-"*) echo "unknown option: $ARG"; abort_configure ;;
    5.96 +    esac
    5.97 +done
    5.98 +
    5.99 +
   5.100 +# set dir variables
   5.101 +: ${EPREFIX:="$PREFIX"}
   5.102 +: ${BINDIR:="$EPREFIX/bin"}
   5.103 +: ${SBINDIR:="$EPREFIX/sbin"}
   5.104 +: ${LIBDIR:="$EPREFIX/lib"}
   5.105 +: ${LIBEXECDIR:="$EPREFIX/libexec"}
   5.106 +: ${DATADIR:="$PREFIX/share"}
   5.107 +: ${SYSCONFDIR:="$PREFIX/etc"}
   5.108 +: ${SHAREDSTATEDIR:="$PREFIX/com"}
   5.109 +: ${LOCALSTATEDIR:="$PREFIX/var"}
   5.110 +: ${INCLUDEDIR:="$PREFIX/include"}
   5.111 +: ${INFODIR:="$PREFIX/info"}
   5.112 +: ${MANDIR:="$PREFIX/man"}
   5.113 +
   5.114 +# Test for availability of pkg-config
   5.115 +PKG_CONFIG=`command -v pkg-config`
   5.116 +: ${PKG_CONFIG:="false"}
   5.117 +
   5.118 +# Simple uname based platform detection
   5.119 +# $PLATFORM is used for platform dependent dependency selection
   5.120 +OS=`uname -s`
   5.121 +OS_VERSION=`uname -r`
   5.122 +printf "detect platform... "
   5.123 +if [ "$OS" = "SunOS" ]; then
   5.124 +    PLATFORM="solaris sunos unix svr4"
   5.125 +fi
   5.126 +if [ "$OS" = "Linux" ]; then
   5.127 +    PLATFORM="linux unix"
   5.128 +fi
   5.129 +if [ "$OS" = "FreeBSD" ]; then
   5.130 +    PLATFORM="freebsd bsd unix"
   5.131 +fi
   5.132 +if [ "$OS" = "Darwin" ]; then
   5.133 +    PLATFORM="macos osx bsd unix"
   5.134 +fi
   5.135 +if echo "$OS" | grep -i "MINGW" > /dev/null; then
   5.136 +    PLATFORM="windows mingw"
   5.137 +fi
   5.138 +: ${PLATFORM:="unix"}
   5.139 +
   5.140 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
   5.141 +echo "$PLATFORM_NAME"
   5.142 +
   5.143 +isplatform()
   5.144 +{
   5.145 +    for p in $PLATFORM
   5.146 +    do
   5.147 +        if [ "$p" = "$1" ]; then
   5.148 +            return 0
   5.149 +        fi
   5.150 +    done
   5.151 +    return 1
   5.152 +}
   5.153 +notisplatform()
   5.154 +{
   5.155 +    for p in $PLATFORM
   5.156 +    do
   5.157 +        if [ "$p" = "$1" ]; then
   5.158 +            return 1
   5.159 +        fi
   5.160 +    done
   5.161 +    return 0
   5.162 +}
   5.163 +
   5.164 +
   5.165 +# generate vars.mk
   5.166 +cat > "$TEMP_DIR/vars.mk" << __EOF__
   5.167 +PREFIX=$PREFIX
   5.168 +EPREFIX=$EPREFIX
   5.169 +BINDIR=$BINDIR
   5.170 +SBINDIR=$SBINDIR
   5.171 +LIBDIR=$LIBDIR
   5.172 +LIBEXECDIR=$LIBEXECDIR
   5.173 +DATADIR=$DATADIR
   5.174 +SYSCONFDIR=$SYSCONFDIR
   5.175 +SHAREDSTATEDIR=$SHAREDSTATEDIR
   5.176 +LOCALSTATEDIR=$LOCALSTATEDIR
   5.177 +INCLUDEDIR=$INCLUDEDIR
   5.178 +INFODIR=$INFODIR
   5.179 +MANDIR=$MANDIR
   5.180 +__EOF__
   5.181 +sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
   5.182 +
   5.183 +
   5.184 +# toolchain detection utilities
   5.185 +. make/toolchain.sh
   5.186 +
   5.187 +#
   5.188 +# DEPENDENCIES
   5.189 +#
   5.190 +
   5.191 +# check languages
   5.192 +lang_c=
   5.193 +lang_cpp=
   5.194 +if detect_c_compiler ; then
   5.195 +    lang_c=1
   5.196 +fi
   5.197 +
   5.198 +# create buffer for make variables required by dependencies
   5.199 +echo > "$TEMP_DIR/make.mk"
   5.200 +
   5.201 +test_pkg_config()
   5.202 +{
   5.203 +    if "$PKG_CONFIG" --exists "$1" ; then :
   5.204 +    else return 1 ; fi
   5.205 +    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
   5.206 +    else return 1 ; fi
   5.207 +    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
   5.208 +    else return 1 ; fi
   5.209 +    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
   5.210 +    else return 1 ; fi
   5.211 +    return 0
   5.212 +}
   5.213 +
   5.214 +
   5.215 +
   5.216 +
   5.217 +
   5.218 +# start collecting dependency information
   5.219 +echo > "$TEMP_DIR/flags.mk"
   5.220 +
   5.221 +DEPENDENCIES_FAILED=
   5.222 +ERROR=0
   5.223 +# unnamed dependencies
   5.224 +TEMP_CFLAGS=
   5.225 +TEMP_CXXFLAGS=
   5.226 +TEMP_LDFLAGS=
   5.227 +while true
   5.228 +do
   5.229 +    while true
   5.230 +    do
   5.231 +        if [ -z "$lang_c" ] ; then
   5.232 +            ERROR=1
   5.233 +            break
   5.234 +        fi
   5.235 +
   5.236 +        break
   5.237 +    done
   5.238 +    break
   5.239 +done
   5.240 +
   5.241 +# add general dependency flags to flags.mk
   5.242 +echo "# general flags" >> "$TEMP_DIR/flags.mk"
   5.243 +if [ -n "${TEMP_CFLAGS}" ]; then
   5.244 +    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   5.245 +fi
   5.246 +if [ -n "${TEMP_CXXFLAGS}" ]; then
   5.247 +    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   5.248 +fi
   5.249 +if [ -n "${TEMP_LDFLAGS}" ]; then
   5.250 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   5.251 +fi
   5.252 +
   5.253 +#
   5.254 +# OPTION VALUES
   5.255 +#
   5.256 +
   5.257 +#
   5.258 +# TARGETS
   5.259 +#
   5.260 +
   5.261 +echo >> "$TEMP_DIR/flags.mk"
   5.262 +# Target: default
   5.263 +echo "# flags for target default" >> "$TEMP_DIR/flags.mk"
   5.264 +TEMP_CFLAGS=
   5.265 +TEMP_CXXFLAGS=
   5.266 +TEMP_LDFLAGS=
   5.267 +
   5.268 +
   5.269 +# Features
   5.270 +
   5.271 +
   5.272 +if [ -n "${TEMP_CFLAGS}" ]; then
   5.273 +    echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   5.274 +fi
   5.275 +if [ -n "${TEMP_CXXFLAGS}" ]; then
   5.276 +    echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   5.277 +fi
   5.278 +if [ "$BUILD_TYPE" = "debug" ]; then
   5.279 +    echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   5.280 +    echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   5.281 +fi
   5.282 +if [ "$BUILD_TYPE" = "release" ]; then
   5.283 +    echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   5.284 +    echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   5.285 +fi
   5.286 +if [ -n "${TEMP_LDFLAGS}" ]; then
   5.287 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   5.288 +fi
   5.289 +
   5.290 +
   5.291 +# final result
   5.292 +if [ $ERROR -ne 0 ]; then
   5.293 +    echo
   5.294 +    echo "Error: Unresolved dependencies"
   5.295 +    echo "$DEPENDENCIES_FAILED"
   5.296 +    abort_configure
   5.297 +fi
   5.298 +
   5.299 +echo "configure finished"
   5.300 +echo
   5.301 +echo "Build Config:"
   5.302 +echo "  PREFIX:    $PREFIX"
   5.303 +echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
   5.304 +echo
   5.305 +
   5.306 +# generate the config.mk file
   5.307 +cat > "$TEMP_DIR/config.mk" << __EOF__
   5.308 +#
   5.309 +# config.mk generated by configure
   5.310 +#
   5.311 +
   5.312 +__EOF__
   5.313 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
   5.314 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
   5.315 +rm -Rf "$TEMP_DIR"
   5.316 +
   5.317 +
     6.1 --- a/configure.ac	Fri Jun 03 20:06:08 2022 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,62 +0,0 @@
     6.4 -# Copyright 2018 Mike Becker. All rights reserved.
     6.5 -# 
     6.6 -# Redistribution and use in source and binary forms, with or without
     6.7 -# modification, are permitted provided that the following conditions are met:
     6.8 -# 
     6.9 -# 1. Redistributions of source code must retain the above copyright
    6.10 -# notice, this list of conditions and the following disclaimer.
    6.11 -# 
    6.12 -# 2. Redistributions in binary form must reproduce the above copyright
    6.13 -# notice, this list of conditions and the following disclaimer in the
    6.14 -# documentation and/or other materials provided with the distribution.
    6.15 -# 
    6.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    6.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    6.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    6.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    6.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    6.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    6.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    6.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    6.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    6.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    6.26 -
    6.27 -AC_PREREQ([2.69])
    6.28 -AC_INIT(cline, 1.4, universe@uap-core.de)
    6.29 -AM_INIT_AUTOMAKE
    6.30 -
    6.31 -# Conditionals
    6.32 -AC_ARG_ENABLE([debug],
    6.33 -[  --enable-debug          Turn on debugging],
    6.34 -[case "${enableval}" in
    6.35 -  yes) debug=true ;;
    6.36 -  no)  debug=false ;;
    6.37 -  *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
    6.38 -esac],[debug=false])
    6.39 -AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
    6.40 -
    6.41 -# Compiler (empty default options)
    6.42 -${CFLAGS=""}
    6.43 -AC_PROG_CC
    6.44 -
    6.45 -# Checks for header files.
    6.46 -AC_CHECK_HEADERS([stdlib.h string.h dirent.h regex.h])
    6.47 -
    6.48 -# Check for regex function.
    6.49 -AC_SEARCH_LIBS(regexec, regex)
    6.50 -
    6.51 -# Checks for typedefs, structures, and compiler characteristics.
    6.52 -AC_CHECK_HEADER_STDBOOL
    6.53 -AC_TYPE_SIZE_T
    6.54 -
    6.55 -# Checks for library functions.
    6.56 -AC_FUNC_MALLOC
    6.57 -AC_FUNC_REALLOC
    6.58 -AC_CHECK_FUNCS([memset regcomp strcasecmp strchr])
    6.59 -
    6.60 -# What shall be generated
    6.61 -AC_CONFIG_HEADERS([config.h])
    6.62 -AC_CONFIG_FILES([Makefile src/Makefile test/Makefile])
    6.63 -
    6.64 -# Just do it!
    6.65 -AC_OUTPUT
    6.66 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/make/cc.mk	Fri Sep 22 23:26:23 2023 +0200
     7.3 @@ -0,0 +1,11 @@
     7.4 +#
     7.5 +# cc toolchain config
     7.6 +#
     7.7 +
     7.8 +CFLAGS =
     7.9 +DEBUG_CC_FLAGS = -g
    7.10 +RELEASE_CC_FLAGS = -O3 -DNDEBUG
    7.11 +LDFLAGS =
    7.12 +
    7.13 +SHLIB_CFLAGS = -fPIC
    7.14 +SHLIB_LDFLAGS = -shared
    7.15 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/make/configure.vm	Fri Sep 22 23:26:23 2023 +0200
     8.3 @@ -0,0 +1,597 @@
     8.4 +#!/bin/sh
     8.5 +
     8.6 +# create temporary directory
     8.7 +TEMP_DIR=".tmp-`uname -n`"
     8.8 +rm -Rf "$TEMP_DIR"
     8.9 +if mkdir -p "$TEMP_DIR"; then
    8.10 +    :
    8.11 +else
    8.12 +    echo "Cannot create tmp dir $TEMP_DIR"
    8.13 +    echo "Abort"
    8.14 +    exit 1
    8.15 +fi
    8.16 +touch "$TEMP_DIR/options"
    8.17 +touch "$TEMP_DIR/features"
    8.18 +
    8.19 +# define standard variables
    8.20 +PREFIX=/usr
    8.21 +EPREFIX=
    8.22 +BINDIR=
    8.23 +SBINDIR=
    8.24 +LIBDIR=
    8.25 +LIBEXECDIR=
    8.26 +DATADIR=
    8.27 +SYSCONFDIR=
    8.28 +SHAREDSTATEDIR=
    8.29 +LOCALSTATEDIR=
    8.30 +INCLUDEDIR=
    8.31 +INFODIR=
    8.32 +MANDIR=
    8.33 +
    8.34 +# custom variables
    8.35 +#foreach( $var in $vars )
    8.36 +#if( $var.exec )
    8.37 +${var.varName}=`${var.value}`
    8.38 +#else
    8.39 +${var.varName}=${var.value}
    8.40 +#end
    8.41 +#end
    8.42 +
    8.43 +# features
    8.44 +#foreach( $feature in $features )
    8.45 +#if( ${feature.isDefault()} )
    8.46 +${feature.getVarName()}=auto
    8.47 +#end
    8.48 +#end
    8.49 +
    8.50 +# clean abort
    8.51 +abort_configure()
    8.52 +{
    8.53 +    rm -Rf "$TEMP_DIR"
    8.54 +    exit 1
    8.55 +}
    8.56 +
    8.57 +# help text
    8.58 +printhelp()
    8.59 +{
    8.60 +    echo "Usage: $0 [OPTIONS]..."
    8.61 +    cat << __EOF__
    8.62 +Installation directories:
    8.63 +  --prefix=PREFIX         path prefix for architecture-independent files
    8.64 +                          [/usr]
    8.65 +  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
    8.66 +                          [PREFIX]
    8.67 +
    8.68 +  --bindir=DIR            user executables [EPREFIX/bin]
    8.69 +  --sbindir=DIR           system admin executables [EPREFIX/sbin]
    8.70 +  --libexecdir=DIR        program executables [EPREFIX/libexec]
    8.71 +  --sysconfdir=DIR        system configuration files [PREFIX/etc]
    8.72 +  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    8.73 +  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    8.74 +  --libdir=DIR            object code libraries [EPREFIX/lib]
    8.75 +  --includedir=DIR        C header files [PREFIX/include]
    8.76 +  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
    8.77 +  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
    8.78 +  --infodir=DIR           info documentation [DATAROOTDIR/info]
    8.79 +  --mandir=DIR            man documentation [DATAROOTDIR/man]
    8.80 +
    8.81 +#if( $options.size() > 0 )
    8.82 +Options:
    8.83 +  --debug                 add extra compile flags for debug builds
    8.84 +  --release               add extra compile flags for release builds
    8.85 +#foreach( $opt in $options )
    8.86 +  --${opt.getArgument()}=${opt.getValuesString()}
    8.87 +#end
    8.88 +
    8.89 +#end
    8.90 +#if( $features.size() > 0 )
    8.91 +Optional Features:
    8.92 +#foreach( $feature in $features )
    8.93 +#if( $feature.default )
    8.94 +  --disable-${feature.arg}
    8.95 +#else
    8.96 +  --enable-${feature.arg}
    8.97 +#end
    8.98 +#end
    8.99 +
   8.100 +#end
   8.101 +__EOF__
   8.102 +}
   8.103 +
   8.104 +#
   8.105 +# parse arguments
   8.106 +#
   8.107 +BUILD_TYPE="default"
   8.108 +#set( $D = '$' )
   8.109 +for ARG in "$@"
   8.110 +do
   8.111 +    case "$ARG" in
   8.112 +        "--prefix="*)         PREFIX=${D}{ARG#--prefix=} ;;
   8.113 +        "--exec-prefix="*)    EPREFIX=${D}{ARG#--exec-prefix=} ;;
   8.114 +        "--bindir="*)         BINDIR=${D}{ARG#----bindir=} ;;
   8.115 +        "--sbindir="*)        SBINDIR=${D}{ARG#--sbindir=} ;;
   8.116 +        "--libdir="*)         LIBDIR=${D}{ARG#--libdir=} ;;
   8.117 +        "--libexecdir="*)     LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
   8.118 +        "--datadir="*)        DATADIR=${D}{ARG#--datadir=} ;;
   8.119 +        "--sysconfdir="*)     SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
   8.120 +        "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
   8.121 +        "--localstatedir="*)  LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
   8.122 +        "--includedir="*)     INCLUDEDIR=${D}{ARG#--includedir=} ;;
   8.123 +        "--infodir="*)        INFODIR=${D}{ARG#--infodir=} ;;
   8.124 +        "--mandir"*)          MANDIR=${D}{ARG#--mandir} ;;
   8.125 +        "--help"*) printhelp; abort_configure ;;
   8.126 +        "--debug")           BUILD_TYPE="debug" ;;
   8.127 +        "--release")         BUILD_TYPE="release" ;;
   8.128 +    #foreach( $opt in $options )
   8.129 +        "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
   8.130 +    #end
   8.131 +    #foreach( $feature in $features )
   8.132 +        "--enable-${feature.arg}") ${feature.getVarName()}=on ;;
   8.133 +        "--disable-${feature.arg}") unset ${feature.getVarName()} ;;
   8.134 +    #end
   8.135 +        "-"*) echo "unknown option: $ARG"; abort_configure ;;
   8.136 +    esac
   8.137 +done
   8.138 +
   8.139 +## Begin unparsed content. **
   8.140 +#[[
   8.141 +# set dir variables
   8.142 +: ${EPREFIX:="$PREFIX"}
   8.143 +: ${BINDIR:="$EPREFIX/bin"}
   8.144 +: ${SBINDIR:="$EPREFIX/sbin"}
   8.145 +: ${LIBDIR:="$EPREFIX/lib"}
   8.146 +: ${LIBEXECDIR:="$EPREFIX/libexec"}
   8.147 +: ${DATADIR:="$PREFIX/share"}
   8.148 +: ${SYSCONFDIR:="$PREFIX/etc"}
   8.149 +: ${SHAREDSTATEDIR:="$PREFIX/com"}
   8.150 +: ${LOCALSTATEDIR:="$PREFIX/var"}
   8.151 +: ${INCLUDEDIR:="$PREFIX/include"}
   8.152 +: ${INFODIR:="$PREFIX/info"}
   8.153 +: ${MANDIR:="$PREFIX/man"}
   8.154 +
   8.155 +# Test for availability of pkg-config
   8.156 +PKG_CONFIG=`command -v pkg-config`
   8.157 +: ${PKG_CONFIG:="false"}
   8.158 +
   8.159 +# Simple uname based platform detection
   8.160 +# $PLATFORM is used for platform dependent dependency selection
   8.161 +OS=`uname -s`
   8.162 +OS_VERSION=`uname -r`
   8.163 +printf "detect platform... "
   8.164 +if [ "$OS" = "SunOS" ]; then
   8.165 +    PLATFORM="solaris sunos unix svr4"
   8.166 +fi
   8.167 +if [ "$OS" = "Linux" ]; then
   8.168 +    PLATFORM="linux unix"
   8.169 +fi
   8.170 +if [ "$OS" = "FreeBSD" ]; then
   8.171 +    PLATFORM="freebsd bsd unix"
   8.172 +fi
   8.173 +if [ "$OS" = "Darwin" ]; then
   8.174 +    PLATFORM="macos osx bsd unix"
   8.175 +fi
   8.176 +if echo "$OS" | grep -i "MINGW" > /dev/null; then
   8.177 +    PLATFORM="windows mingw"
   8.178 +fi
   8.179 +: ${PLATFORM:="unix"}
   8.180 +
   8.181 +PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
   8.182 +echo "$PLATFORM_NAME"
   8.183 +
   8.184 +isplatform()
   8.185 +{
   8.186 +    for p in $PLATFORM
   8.187 +    do
   8.188 +        if [ "$p" = "$1" ]; then
   8.189 +            return 0
   8.190 +        fi
   8.191 +    done
   8.192 +    return 1
   8.193 +}
   8.194 +notisplatform()
   8.195 +{
   8.196 +    for p in $PLATFORM
   8.197 +    do
   8.198 +        if [ "$p" = "$1" ]; then
   8.199 +            return 1
   8.200 +        fi
   8.201 +    done
   8.202 +    return 0
   8.203 +}
   8.204 +]]#
   8.205 +## End of unparsed content **
   8.206 +
   8.207 +# generate vars.mk
   8.208 +cat > "$TEMP_DIR/vars.mk" << __EOF__
   8.209 +PREFIX=$PREFIX
   8.210 +EPREFIX=$EPREFIX
   8.211 +BINDIR=$BINDIR
   8.212 +SBINDIR=$SBINDIR
   8.213 +LIBDIR=$LIBDIR
   8.214 +LIBEXECDIR=$LIBEXECDIR
   8.215 +DATADIR=$DATADIR
   8.216 +SYSCONFDIR=$SYSCONFDIR
   8.217 +SHAREDSTATEDIR=$SHAREDSTATEDIR
   8.218 +LOCALSTATEDIR=$LOCALSTATEDIR
   8.219 +INCLUDEDIR=$INCLUDEDIR
   8.220 +INFODIR=$INFODIR
   8.221 +MANDIR=$MANDIR
   8.222 +#foreach( $var in $vars )
   8.223 +${var.varName}=$${var.varName}
   8.224 +#end
   8.225 +__EOF__
   8.226 +sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
   8.227 +
   8.228 +
   8.229 +# toolchain detection utilities
   8.230 +. make/toolchain.sh
   8.231 +
   8.232 +#
   8.233 +# DEPENDENCIES
   8.234 +#
   8.235 +
   8.236 +# check languages
   8.237 +lang_c=
   8.238 +lang_cpp=
   8.239 +#foreach( $lang in $languages )
   8.240 +if detect_${lang}_compiler ; then
   8.241 +    lang_${lang}=1
   8.242 +fi
   8.243 +#end
   8.244 +
   8.245 +# create buffer for make variables required by dependencies
   8.246 +echo > "$TEMP_DIR/make.mk"
   8.247 +
   8.248 +test_pkg_config()
   8.249 +{
   8.250 +    if "$PKG_CONFIG" --exists "$1" ; then :
   8.251 +    else return 1 ; fi
   8.252 +    if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then :
   8.253 +    else return 1 ; fi
   8.254 +    if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then :
   8.255 +    else return 1 ; fi
   8.256 +    if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then :
   8.257 +    else return 1 ; fi
   8.258 +    return 0
   8.259 +}
   8.260 +
   8.261 +#foreach( $dependency in $namedDependencies )
   8.262 +dependency_error_${dependency.name}()
   8.263 +{
   8.264 +    printf "checking for ${dependency.name}... "
   8.265 +    #foreach( $sub in $dependency.getSubdependencies() )
   8.266 +    # dependency $sub.getFullName()
   8.267 +    while true
   8.268 +    do
   8.269 +        #if( $sub.platform )
   8.270 +        if notisplatform "${sub.platform}"; then
   8.271 +            break
   8.272 +        fi
   8.273 +        #end
   8.274 +        #foreach( $np in $sub.getNotList() )
   8.275 +        if isplatform "${np}"; then
   8.276 +            break
   8.277 +        fi
   8.278 +        #end
   8.279 +        #foreach( $lang in $sub.lang )
   8.280 +        if [ -z "$lang_${lang}" ] ; then
   8.281 +            break
   8.282 +        fi
   8.283 +        #end
   8.284 +        #if( $sub.pkgconfig.size() > 0 )
   8.285 +        if [ -z "$PKG_CONFIG" ]; then
   8.286 +            break
   8.287 +        fi
   8.288 +        #end
   8.289 +        #foreach( $test in $sub.tests )
   8.290 +        if $test > /dev/null ; then
   8.291 +            :
   8.292 +        else
   8.293 +            break
   8.294 +        fi
   8.295 +        #end
   8.296 +        #foreach( $pkg in $sub.pkgconfig )
   8.297 +        if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then
   8.298 +            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
   8.299 +            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
   8.300 +        else
   8.301 +            break
   8.302 +        fi
   8.303 +        #end
   8.304 +        #foreach( $flags in $sub.flags )
   8.305 +        #if( $flags.exec )
   8.306 +        if tmp_flags=`$flags.value` ; then
   8.307 +            TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
   8.308 +        else
   8.309 +            break
   8.310 +        fi
   8.311 +        #else
   8.312 +        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
   8.313 +        #end
   8.314 +        #end
   8.315 +        #if ( $sub.make.length() > 0 )
   8.316 +        cat >> $TEMP_DIR/make.mk << __EOF__
   8.317 +# Dependency: $dependency.name
   8.318 +$sub.make
   8.319 +__EOF__
   8.320 +        #end
   8.321 +        echo yes
   8.322 +        return 1
   8.323 +    done
   8.324 +
   8.325 +    #end
   8.326 +    echo no
   8.327 +    return 0
   8.328 +}
   8.329 +#end
   8.330 +
   8.331 +
   8.332 +
   8.333 +
   8.334 +# start collecting dependency information
   8.335 +echo > "$TEMP_DIR/flags.mk"
   8.336 +
   8.337 +DEPENDENCIES_FAILED=
   8.338 +ERROR=0
   8.339 +#if( $dependencies.size() > 0 )
   8.340 +# unnamed dependencies
   8.341 +TEMP_CFLAGS=
   8.342 +TEMP_CXXFLAGS=
   8.343 +TEMP_LDFLAGS=
   8.344 +#foreach( $dependency in $dependencies )
   8.345 +while true
   8.346 +do
   8.347 +    #if( $dependency.platform )
   8.348 +    if notisplatform "${dependency.platform}"; then
   8.349 +        break
   8.350 +    fi
   8.351 +    #end
   8.352 +    #foreach( $np in $dependency.getNotList() )
   8.353 +    if isplatform "${np}"; then
   8.354 +        break
   8.355 +    fi
   8.356 +    #end
   8.357 +    while true
   8.358 +    do
   8.359 +        #foreach( $lang in $dependency.lang )
   8.360 +        if [ -z "$lang_${lang}" ] ; then
   8.361 +            ERROR=1
   8.362 +            break
   8.363 +        fi
   8.364 +        #end
   8.365 +        #if( $dependency.pkgconfig.size() > 0 )
   8.366 +        if [ -z "$PKG_CONFIG" ]; then
   8.367 +            ERROR=1
   8.368 +            break
   8.369 +        fi
   8.370 +        #end
   8.371 +        #foreach( $pkg in $dependency.pkgconfig )
   8.372 +        printf "checking for pkg-config package $pkg.name... "
   8.373 +        if test_pkg_config "$pkg.name" "$pkg.atleast" "$pkg.exact" "$pkg.max" ; then
   8.374 +            echo yes
   8.375 +            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags $pkg.name`"
   8.376 +            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs $pkg.name`"
   8.377 +        else
   8.378 +            echo no
   8.379 +            ERROR=1
   8.380 +            break
   8.381 +        fi
   8.382 +        #end
   8.383 +
   8.384 +        #foreach( $flags in $dependency.flags )
   8.385 +        #if( $flags.exec )
   8.386 +        $flags.value > /dev/null
   8.387 +        if tmp_flags=`$flags.value` ; then
   8.388 +            TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
   8.389 +        else
   8.390 +            ERROR=1
   8.391 +            break
   8.392 +        fi
   8.393 +        #else
   8.394 +        TEMP_$flags.varName="$TEMP_$flags.varName $flags.value"
   8.395 +        #end
   8.396 +        #end
   8.397 +        #if ( $dependency.make.length() > 0 )
   8.398 +        cat >> "$TEMP_DIR/make.mk" << __EOF__
   8.399 +$dependency.make
   8.400 +__EOF__
   8.401 +        #end
   8.402 +        break
   8.403 +    done
   8.404 +    break
   8.405 +done
   8.406 +#end
   8.407 +
   8.408 +# add general dependency flags to flags.mk
   8.409 +echo "# general flags" >> "$TEMP_DIR/flags.mk"
   8.410 +if [ -n "${TEMP_CFLAGS}" ]; then
   8.411 +    echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   8.412 +fi
   8.413 +if [ -n "${TEMP_CXXFLAGS}" ]; then
   8.414 +    echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   8.415 +fi
   8.416 +if [ -n "${TEMP_LDFLAGS}" ]; then
   8.417 +    echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   8.418 +fi
   8.419 +#end
   8.420 +
   8.421 +#
   8.422 +# OPTION VALUES
   8.423 +#
   8.424 +#foreach( $opt in $options )
   8.425 +#foreach( $val in $opt.values )
   8.426 +${val.func}()
   8.427 +{
   8.428 +    VERR=0
   8.429 +    #foreach( $dep in $val.dependencies )
   8.430 +    if dependency_error_$dep ; then
   8.431 +        VERR=1
   8.432 +    fi
   8.433 +    #end
   8.434 +    if [ $VERR -ne 0 ]; then
   8.435 +        return 1
   8.436 +    fi
   8.437 +    #foreach( $def in $val.defines )
   8.438 +        TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
   8.439 +        TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}"
   8.440 +    #end
   8.441 +    #if( $val.hasMake() )
   8.442 +    cat >> "$TEMP_DIR/make.mk" << __EOF__
   8.443 +$val.make
   8.444 +__EOF__
   8.445 +    #end
   8.446 +    return 0
   8.447 +}
   8.448 +#end
   8.449 +#end
   8.450 +
   8.451 +#
   8.452 +# TARGETS
   8.453 +#
   8.454 +
   8.455 +#foreach( $target in $targets )
   8.456 +echo >> "$TEMP_DIR/flags.mk"
   8.457 +#if ( $target.name )
   8.458 +# Target: $target.name
   8.459 +echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk"
   8.460 +#else
   8.461 +# Target
   8.462 +echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
   8.463 +#end
   8.464 +TEMP_CFLAGS=
   8.465 +TEMP_CXXFLAGS=
   8.466 +TEMP_LDFLAGS=
   8.467 +
   8.468 +#foreach( $dependency in $target.dependencies )
   8.469 +if dependency_error_$dependency; then
   8.470 +    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
   8.471 +    ERROR=1
   8.472 +fi
   8.473 +#end
   8.474 +
   8.475 +# Features
   8.476 +#foreach( $feature in $target.features )
   8.477 +if [ -n "$${feature.getVarName()}" ]; then
   8.478 +#foreach( $dependency in $feature.dependencies )
   8.479 +    # check dependency
   8.480 +    if dependency_error_$dependency ; then
   8.481 +        # "auto" features can fail and are just disabled in this case
   8.482 +        if [ "$${feature.getVarName()}" = "auto" ]; then
   8.483 +            DISABLE_${feature.getVarName()}=1
   8.484 +        else
   8.485 +            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
   8.486 +            ERROR=1
   8.487 +        fi
   8.488 +    fi
   8.489 +#end
   8.490 +    if [ -n "$DISABLE_${feature.getVarName()}" ]; then
   8.491 +        unset ${feature.getVarName()}
   8.492 +    fi
   8.493 +fi
   8.494 +#end
   8.495 +
   8.496 +#foreach( $opt in $target.options )
   8.497 +# Option: --${opt.argument}
   8.498 +if [ -z ${D}${opt.getVarName()} ]; then
   8.499 +    SAVED_ERROR="$ERROR"
   8.500 +    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
   8.501 +    ERROR=1
   8.502 +    while true
   8.503 +    do
   8.504 +        #foreach( $optdef in $opt.defaults )
   8.505 +        #if( $optdef.platform )
   8.506 +        if isplatform "$optdef.platform"; then
   8.507 +        #end
   8.508 +        if $optdef.func ; then
   8.509 +            echo "  ${opt.argument}: ${optdef.valueName}" >> "$TEMP_DIR/options"
   8.510 +            ERROR=0
   8.511 +            break
   8.512 +        fi
   8.513 +        #if( $optdef.platform )
   8.514 +        fi
   8.515 +        #end
   8.516 +        #end
   8.517 +        break
   8.518 +    done
   8.519 +    if [ $ERROR -ne 0 ]; then
   8.520 +        SAVED_ERROR=1
   8.521 +    fi
   8.522 +    ERROR="$SAVED_ERROR"
   8.523 +    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
   8.524 +else
   8.525 +    if false; then
   8.526 +        false
   8.527 +    #foreach( $optval in $opt.values )
   8.528 +    elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
   8.529 +        echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
   8.530 +        if $optval.func ; then
   8.531 +            :
   8.532 +        else
   8.533 +            ERROR=1
   8.534 +        fi
   8.535 +    #end
   8.536 +    fi
   8.537 +fi
   8.538 +#end
   8.539 +
   8.540 +if [ -n "${TEMP_CFLAGS}" ]; then
   8.541 +    echo "${target.getCFlags()}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
   8.542 +fi
   8.543 +if [ -n "${TEMP_CXXFLAGS}" ]; then
   8.544 +    echo "${target.getCXXFlags()}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
   8.545 +fi
   8.546 +if [ "$BUILD_TYPE" = "debug" ]; then
   8.547 +    echo '${target.getCFlags()} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   8.548 +    echo '${target.getCXXFlags()} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   8.549 +fi
   8.550 +if [ "$BUILD_TYPE" = "release" ]; then
   8.551 +    echo '${target.getCFlags()} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
   8.552 +    echo '${target.getCXXFlags()} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
   8.553 +fi
   8.554 +if [ -n "${TEMP_LDFLAGS}" ]; then
   8.555 +    echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
   8.556 +fi
   8.557 +
   8.558 +#end
   8.559 +
   8.560 +# final result
   8.561 +if [ $ERROR -ne 0 ]; then
   8.562 +    echo
   8.563 +    echo "Error: Unresolved dependencies"
   8.564 +    echo "$DEPENDENCIES_FAILED"
   8.565 +    abort_configure
   8.566 +fi
   8.567 +
   8.568 +echo "configure finished"
   8.569 +echo
   8.570 +echo "Build Config:"
   8.571 +echo "  PREFIX:    $PREFIX"
   8.572 +echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
   8.573 +#if ( $options.size() > 0 )
   8.574 +echo "Options:"
   8.575 +cat "$TEMP_DIR/options"
   8.576 +#end
   8.577 +#if ( $features.size() > 0 )
   8.578 +echo "Features:"
   8.579 +#foreach( $feature in $features )
   8.580 +if [ -n "$${feature.getVarName()}" ]; then
   8.581 +echo "  $feature.name: on"
   8.582 +else
   8.583 +echo "  $feature.name: off"
   8.584 +fi
   8.585 +#end
   8.586 +#end
   8.587 +echo
   8.588 +
   8.589 +# generate the config.mk file
   8.590 +cat > "$TEMP_DIR/config.mk" << __EOF__
   8.591 +#
   8.592 +# config.mk generated by configure
   8.593 +#
   8.594 +
   8.595 +__EOF__
   8.596 +write_toolchain_defaults "$TEMP_DIR/toolchain.mk"
   8.597 +cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk
   8.598 +rm -Rf "$TEMP_DIR"
   8.599 +
   8.600 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/make/project.xml	Fri Sep 22 23:26:23 2023 +0200
     9.3 @@ -0,0 +1,7 @@
     9.4 +<?xml version="1.0" encoding="UTF-8"?>
     9.5 +<project xmlns="http://unixwork.de/uwproj">
     9.6 +	<dependency>
     9.7 +		<lang>c</lang>
     9.8 +	</dependency>
     9.9 +</project>
    9.10 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/make/toolchain.sh	Fri Sep 22 23:26:23 2023 +0200
    10.3 @@ -0,0 +1,186 @@
    10.4 +#!/bin/sh
    10.5 +#
    10.6 +# toolchain detection
    10.7 +#
    10.8 +
    10.9 +C_COMPILERS="gcc clang suncc cc"
   10.10 +CPP_COMPILERS="g++ clang++ sunCC CC"
   10.11 +unset TOOLCHAIN_NAME
   10.12 +unset TOOLCHAIN_CC
   10.13 +unset TOOLCHAIN_CXX
   10.14 +
   10.15 +check_c_compiler()
   10.16 +{
   10.17 +	cat > "$TEMP_DIR/test.c" << __EOF__
   10.18 +/* test file */
   10.19 +#include <stdio.h>
   10.20 +int main(int argc, char **argv) {
   10.21 +#if defined(__clang__)
   10.22 +	printf("clang\n");
   10.23 +#elif defined(__GNUC__)
   10.24 +	printf("gcc\n");
   10.25 +#elif defined(__sun)
   10.26 +	printf("suncc\n");
   10.27 +#else
   10.28 +	printf("unknown\n");
   10.29 +#endif
   10.30 +	return 0;
   10.31 +}
   10.32 +__EOF__
   10.33 +	rm -f "$TEMP_DIR/checkcc"
   10.34 +	$1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
   10.35 +}
   10.36 +
   10.37 +check_cpp_compiler()
   10.38 +{
   10.39 +	cat > "$TEMP_DIR/test.cpp" << __EOF__
   10.40 +/* test file */
   10.41 +#include <iostream>
   10.42 +int main(int argc, char **argv) {
   10.43 +#if defined(__clang__)
   10.44 +	std::cout << "clang" << std::endl;
   10.45 +#elif defined(__GNUC__)
   10.46 +	std::cout << "gcc" << std::endl;
   10.47 +#elif defined(__sun)
   10.48 +	std::cout << "suncc" << std::endl;
   10.49 +#else
   10.50 +	std::cout << "cc" << std::endl;
   10.51 +#endif
   10.52 +	return 0;
   10.53 +}
   10.54 +__EOF__
   10.55 +	rm -f "$TEMP_DIR/checkcc"
   10.56 +	$1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
   10.57 +}
   10.58 +
   10.59 +create_libtest_source()
   10.60 +{
   10.61 +  # $1: filename
   10.62 +  # $2: optional include
   10.63 +	cat > "$TEMP_DIR/$1" << __EOF__
   10.64 +/* libtest file */
   10.65 +int main(int argc, char **argv) {
   10.66 +	return 0;
   10.67 +}
   10.68 +__EOF__
   10.69 +  if [ -n "$2" ]; then
   10.70 +    echo "#include <$2>" >> "$TEMP_DIR/$1"
   10.71 +  fi
   10.72 +}
   10.73 +
   10.74 +check_c_lib()
   10.75 +{
   10.76 +  # $1: libname
   10.77 +  # $2: optional include
   10.78 +  if [ -z "$TOOLCHAIN_CC" ]; then
   10.79 +    return 1
   10.80 +  fi
   10.81 +  create_libtest_source "test.c" "$2"
   10.82 +  rm -f "$TEMP_DIR/checklib"
   10.83 +	$TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
   10.84 +}
   10.85 +
   10.86 +check_cpp_lib()
   10.87 +{
   10.88 +  # $1: libname
   10.89 +  # $2: optional include
   10.90 +  if [ -z "$TOOLCHAIN_CXX" ]; then
   10.91 +    return 1
   10.92 +  fi
   10.93 +	create_libtest_source "test.cpp" "$2"
   10.94 +  rm -f "$TEMP_DIR/checklib"
   10.95 +	$TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
   10.96 +}
   10.97 +
   10.98 +check_lib()
   10.99 +{
  10.100 +  # $1: libname
  10.101 +  # $2: optional include
  10.102 +	if [ -n "$TOOLCHAIN_CC" ]; then
  10.103 +		check_c_lib "$1" "$2"
  10.104 +	elif  [ -n "$TOOLCHAIN_CXX" ]; then
  10.105 +	  check_cpp_lib "$1" "$2"
  10.106 +	fi
  10.107 +}
  10.108 +
  10.109 +detect_c_compiler()
  10.110 +{
  10.111 +  if [ -n "$TOOLCHAIN_CC" ]; then
  10.112 +    return 0
  10.113 +  fi
  10.114 +  printf "detect C compiler... "
  10.115 +  if [ -n "$CC" ]; then
  10.116 +    if check_c_compiler "$CC"; then
  10.117 +      TOOLCHAIN_CC=$CC
  10.118 +      TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
  10.119 +      echo "$CC"
  10.120 +      return 0
  10.121 +    else
  10.122 +      echo "$CC is not a working C compiler"
  10.123 +      return 1
  10.124 +    fi
  10.125 +  else
  10.126 +    for COMP in $C_COMPILERS
  10.127 +    do
  10.128 +      if check_c_compiler "$COMP"; then
  10.129 +        TOOLCHAIN_CC=$COMP
  10.130 +        TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
  10.131 +        echo "$COMP"
  10.132 +        return 0
  10.133 +      fi
  10.134 +    done
  10.135 +    echo "not found"
  10.136 +    return 1
  10.137 +  fi
  10.138 +}
  10.139 +
  10.140 +detect_cpp_compiler()
  10.141 +{
  10.142 +  if [ -n "$TOOLCHAIN_CXX" ]; then
  10.143 +    return 0
  10.144 +  fi
  10.145 +  printf "detect C++ compiler... "
  10.146 +
  10.147 +  if [ -n "$CXX" ]; then
  10.148 +    if check_cpp_compiler "$CXX"; then
  10.149 +      TOOLCHAIN_CXX=$CXX
  10.150 +      TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
  10.151 +      echo "$CXX"
  10.152 +      return 0
  10.153 +    else
  10.154 +      echo "$CXX is not a working C++ compiler"
  10.155 +      return 1
  10.156 +    fi
  10.157 +  else
  10.158 +    for COMP in $CPP_COMPILERS
  10.159 +    do
  10.160 +      if check_cpp_compiler "$COMP"; then
  10.161 +        TOOLCHAIN_CXX=$COMP
  10.162 +        TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
  10.163 +        echo "$COMP"
  10.164 +        return 0
  10.165 +      fi
  10.166 +    done
  10.167 +    echo "${TOOLCHAIN_CXX:-"not found"}"
  10.168 +    return 1
  10.169 +  fi
  10.170 +}
  10.171 +
  10.172 +write_toolchain_defaults()
  10.173 +{
  10.174 +  echo "# toolchain" >> "$1"
  10.175 +  if [ -n "$TOOLCHAIN_CC" ]; then
  10.176 +    echo "CC = ${TOOLCHAIN_CC}" >> "$1"
  10.177 +  fi
  10.178 +  if [ -n "$TOOLCHAIN_CXX" ]; then
  10.179 +    echo "CXX = ${TOOLCHAIN_CXX}" >> "$1"
  10.180 +  fi
  10.181 +  echo >> "$1"
  10.182 +  if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then
  10.183 +    cat "make/${TOOLCHAIN_NAME}.mk" >> "$1"
  10.184 +  elif [ -f "make/cc.mk" ]; then
  10.185 +    cat "make/cc.mk" >> "$1"
  10.186 +  else
  10.187 +    echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete."
  10.188 +  fi
  10.189 +}
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/make/uwproj.xsd	Fri Sep 22 23:26:23 2023 +0200
    11.3 @@ -0,0 +1,131 @@
    11.4 +<?xml version="1.0" encoding="UTF-8"?>
    11.5 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    11.6 +           xmlns="http://unixwork.de/uwproj"
    11.7 +           targetNamespace="http://unixwork.de/uwproj"
    11.8 +           elementFormDefault="qualified"
    11.9 +           version="0.1"
   11.10 +>
   11.11 +    <xs:element name="project" type="ProjectType"/>
   11.12 +
   11.13 +    <xs:complexType name="ProjectType">
   11.14 +        <xs:sequence>
   11.15 +            <xs:element name="config" type="ConfigType" minOccurs="0"/>
   11.16 +            <xs:element name="dependency" type="DependencyType" minOccurs="0" maxOccurs="unbounded"/>
   11.17 +            <xs:element name="target" type="TargetType" minOccurs="0" maxOccurs="unbounded"/>
   11.18 +        </xs:sequence>
   11.19 +    </xs:complexType>
   11.20 +
   11.21 +    <xs:complexType name="ConfigType">
   11.22 +        <xs:sequence>
   11.23 +            <xs:element name="var" type="ConfigVarType" minOccurs="0" maxOccurs="unbounded"/>
   11.24 +        </xs:sequence>
   11.25 +    </xs:complexType>
   11.26 +
   11.27 +    <xs:complexType name="ConfigVarType">
   11.28 +        <xs:simpleContent>
   11.29 +            <xs:extension base="xs:string">
   11.30 +                <xs:attribute name="name" type="xs:string" use="required"/>
   11.31 +                <xs:attribute name="exec" type="xs:boolean" default="false"/>
   11.32 +            </xs:extension>
   11.33 +        </xs:simpleContent>
   11.34 +    </xs:complexType>
   11.35 +
   11.36 +    <xs:complexType name="PkgConfigType">
   11.37 +        <xs:simpleContent>
   11.38 +            <xs:extension base="xs:string">
   11.39 +                <xs:attribute name="atleast" type="xs:string"/>
   11.40 +                <xs:attribute name="exact" type="xs:string"/>
   11.41 +                <xs:attribute name="max" type="xs:string"/>
   11.42 +            </xs:extension>
   11.43 +        </xs:simpleContent>
   11.44 +    </xs:complexType>
   11.45 +
   11.46 +    <xs:simpleType name="LangType">
   11.47 +        <xs:restriction base="xs:string">
   11.48 +            <xs:enumeration value="c"/>
   11.49 +            <xs:enumeration value="cpp"/>
   11.50 +        </xs:restriction>
   11.51 +    </xs:simpleType>
   11.52 +
   11.53 +    <xs:complexType name="DependencyType">
   11.54 +        <xs:choice minOccurs="0" maxOccurs="unbounded">
   11.55 +            <xs:element name="lang" type="LangType"/>
   11.56 +            <xs:element name="cflags" type="FlagsType"/>
   11.57 +            <xs:element name="cxxflags" type="FlagsType"/>
   11.58 +            <xs:element name="ldflags" type="FlagsType"/>
   11.59 +            <xs:element name="pkgconfig" type="PkgConfigType"/>
   11.60 +            <xs:element name="test" type="xs:string"/>
   11.61 +            <xs:element name="make" type="xs:string"/>
   11.62 +        </xs:choice>
   11.63 +        <xs:attribute name="name" type="xs:string"/>
   11.64 +        <xs:attribute name="platform" type="xs:string"/>
   11.65 +        <xs:attribute name="not" type="xs:string"/>
   11.66 +    </xs:complexType>
   11.67 +
   11.68 +    <xs:complexType name="FlagsType">
   11.69 +        <xs:simpleContent>
   11.70 +            <xs:extension base="xs:string">
   11.71 +                <xs:attribute name="exec" type="xs:boolean" default="false"/>
   11.72 +            </xs:extension>
   11.73 +        </xs:simpleContent>
   11.74 +    </xs:complexType>
   11.75 +
   11.76 +    <xs:complexType name="TargetType">
   11.77 +        <xs:choice minOccurs="0" maxOccurs="unbounded">
   11.78 +            <xs:element name="feature" type="FeatureType"/>
   11.79 +            <xs:element name="option" type="OptionType"/>
   11.80 +            <xs:element name="define" type="DefineType"/>
   11.81 +            <xs:element name="dependencies" type="DependenciesType"/>
   11.82 +            <xs:element name="alldependencies">
   11.83 +                <xs:complexType/>
   11.84 +            </xs:element>
   11.85 +        </xs:choice>
   11.86 +        <xs:attribute name="name" type="xs:string"/>
   11.87 +    </xs:complexType>
   11.88 +
   11.89 +    <xs:complexType name="FeatureType">
   11.90 +        <xs:choice minOccurs="0" maxOccurs="unbounded">
   11.91 +            <xs:group ref="TargetDataGroup"/>
   11.92 +        </xs:choice>
   11.93 +        <xs:attribute name="name" type="xs:string" use="required"/>
   11.94 +        <xs:attribute name="arg" type="xs:string"/>
   11.95 +        <xs:attribute name="default" type="xs:boolean" default="false"/>
   11.96 +    </xs:complexType>
   11.97 +
   11.98 +    <xs:complexType name="OptionType">
   11.99 +        <xs:sequence>
  11.100 +            <xs:element name="value" type="OptionValueType" minOccurs="0" maxOccurs="unbounded"/>
  11.101 +            <xs:element name="default" type="OptionDefaultType" minOccurs="0" maxOccurs="unbounded"/>
  11.102 +        </xs:sequence>
  11.103 +        <xs:attribute name="arg" type="xs:string"/>
  11.104 +    </xs:complexType>
  11.105 +
  11.106 +    <xs:complexType name="OptionValueType">
  11.107 +        <xs:choice minOccurs="0" maxOccurs="unbounded">
  11.108 +            <xs:group ref="TargetDataGroup"/>
  11.109 +        </xs:choice>
  11.110 +        <xs:attribute name="str" type="xs:string" use="required"/>
  11.111 +    </xs:complexType>
  11.112 +
  11.113 +    <xs:complexType name="OptionDefaultType">
  11.114 +        <xs:attribute name="value" type="xs:string" use="required"/>
  11.115 +        <xs:attribute name="platform" type="xs:string"/>
  11.116 +    </xs:complexType>
  11.117 +
  11.118 +    <xs:group name="TargetDataGroup">
  11.119 +        <xs:choice>
  11.120 +            <xs:element name="define" type="DefineType" minOccurs="0" maxOccurs="unbounded"/>
  11.121 +            <xs:element name="dependencies" type="DependenciesType" minOccurs="0" maxOccurs="unbounded"/>
  11.122 +            <xs:element name="make" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  11.123 +        </xs:choice>
  11.124 +    </xs:group>
  11.125 +
  11.126 +    <xs:complexType name="DefineType">
  11.127 +        <xs:attribute name="name" type="xs:string" use="required"/>
  11.128 +        <xs:attribute name="value" type="xs:string"/>
  11.129 +    </xs:complexType>
  11.130 +
  11.131 +    <xs:simpleType name="DependenciesType">
  11.132 +        <xs:restriction base="xs:string"/>
  11.133 +    </xs:simpleType>
  11.134 +</xs:schema>
  11.135 \ No newline at end of file
    12.1 --- a/prebuild.sh	Fri Jun 03 20:06:08 2022 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,28 +0,0 @@
    12.4 -# Copyright 2018 Mike Becker. All rights reserved.
    12.5 -# 
    12.6 -# Redistribution and use in source and binary forms, with or without
    12.7 -# modification, are permitted provided that the following conditions are met:
    12.8 -# 
    12.9 -# 1. Redistributions of source code must retain the above copyright
   12.10 -# notice, this list of conditions and the following disclaimer.
   12.11 -# 
   12.12 -# 2. Redistributions in binary form must reproduce the above copyright
   12.13 -# notice, this list of conditions and the following disclaimer in the
   12.14 -# documentation and/or other materials provided with the distribution.
   12.15 -# 
   12.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   12.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   12.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   12.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   12.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   12.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   12.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   12.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   12.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   12.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   12.26 -
   12.27 -autoreconf -i
   12.28 -mkdir -p build
   12.29 -cd build
   12.30 -../configure "$@"
   12.31 -
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/Makefile	Fri Sep 22 23:26:23 2023 +0200
    13.3 @@ -0,0 +1,46 @@
    13.4 +# Copyright 2018 Mike Becker. All rights reserved.
    13.5 +# 
    13.6 +# Redistribution and use in source and binary forms, with or without
    13.7 +# modification, are permitted provided that the following conditions are met:
    13.8 +# 
    13.9 +# 1. Redistributions of source code must retain the above copyright
   13.10 +# notice, this list of conditions and the following disclaimer.
   13.11 +# 
   13.12 +# 2. Redistributions in binary form must reproduce the above copyright
   13.13 +# notice, this list of conditions and the following disclaimer in the
   13.14 +# documentation and/or other materials provided with the distribution.
   13.15 +# 
   13.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   13.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   13.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   13.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   13.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   13.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   13.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   13.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   13.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   13.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   13.26 +
   13.27 +include ../config.mk
   13.28 +
   13.29 +BUILD_DIR = ../build
   13.30 +SRC = arguments.c bfile_heuristics.c cline.c regex_parser.c scanner.c settings.c string_list.c
   13.31 +
   13.32 +OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o)
   13.33 +
   13.34 +all: $(BUILD_DIR)/cline FORCE
   13.35 +	echo "Build successful."
   13.36 +
   13.37 +install: $(BUILD_DIR)/cline FORCE
   13.38 +	cd .. && cp "build/cline" "$(BINDIR)/cline"
   13.39 +	echo "Installed to: $(BINDIR)/cline"
   13.40 +
   13.41 +$(BUILD_DIR)/cline: $(OBJ)
   13.42 +	echo "Linking executable..."
   13.43 +	$(CC) $(LDFLAGS) -o $@ $(OBJ)
   13.44 +
   13.45 +$(BUILD_DIR)/%.o: %.c
   13.46 +	echo "Compiling $<"
   13.47 +	$(CC) $(CFLAGS) -c -o $@ $<
   13.48 +
   13.49 +FORCE:
   13.50 \ No newline at end of file
    14.1 --- a/src/Makefile.am	Fri Jun 03 20:06:08 2022 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,35 +0,0 @@
    14.4 -# Copyright 2018 Mike Becker. All rights reserved.
    14.5 -# 
    14.6 -# Redistribution and use in source and binary forms, with or without
    14.7 -# modification, are permitted provided that the following conditions are met:
    14.8 -# 
    14.9 -# 1. Redistributions of source code must retain the above copyright
   14.10 -# notice, this list of conditions and the following disclaimer.
   14.11 -# 
   14.12 -# 2. Redistributions in binary form must reproduce the above copyright
   14.13 -# notice, this list of conditions and the following disclaimer in the
   14.14 -# documentation and/or other materials provided with the distribution.
   14.15 -# 
   14.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   14.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   14.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   14.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   14.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   14.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   14.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   14.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   14.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   14.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   14.26 -
   14.27 -if DEBUG
   14.28 -AM_CFLAGS = -g -O0 -Wall
   14.29 -else
   14.30 -AM_CFLAGS = -O2
   14.31 -endif
   14.32 -
   14.33 -bin_PROGRAMS = cline
   14.34 -cline_SOURCES = arguments.c bfile_heuristics.c cline.c regex_parser.c \
   14.35 -		scanner.c settings.c string_list.c
   14.36 -
   14.37 -EXTRA_DIST = arguments.h bfile_heuristics.h cline.h regex_parser.h scanner.h \
   14.38 -	     settings.h stdinc.h string_list.h
    15.1 --- a/src/cline.h	Fri Jun 03 20:06:08 2022 +0200
    15.2 +++ b/src/cline.h	Fri Sep 22 23:26:23 2023 +0200
    15.3 @@ -27,11 +27,7 @@
    15.4  #ifndef CLINE_H_
    15.5  #define CLINE_H_
    15.6  
    15.7 -#if HAVE_CONFIG_H
    15.8 -#include <config.h>
    15.9 -#else
   15.10 -#error "Package must be built having a config.h."
   15.11 -#endif
   15.12 +#define VERSION "1.4.1"
   15.13  
   15.14  #include "stdinc.h"
   15.15  #include "settings.h"
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/Makefile	Fri Sep 22 23:26:23 2023 +0200
    16.3 @@ -0,0 +1,35 @@
    16.4 +# Copyright 2018 Mike Becker. All rights reserved.
    16.5 +#
    16.6 +# Redistribution and use in source and binary forms, with or without
    16.7 +# modification, are permitted provided that the following conditions are met:
    16.8 +#
    16.9 +# 1. Redistributions of source code must retain the above copyright
   16.10 +# notice, this list of conditions and the following disclaimer.
   16.11 +#
   16.12 +# 2. Redistributions in binary form must reproduce the above copyright
   16.13 +# notice, this list of conditions and the following disclaimer in the
   16.14 +# documentation and/or other materials provided with the distribution.
   16.15 +#
   16.16 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   16.17 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16.18 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   16.19 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   16.20 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   16.21 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   16.22 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   16.23 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   16.24 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   16.25 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   16.26 +
   16.27 +TEST_SCRIPTS = \
   16.28 +  codeonly.force \
   16.29 +  codeonly_chars.force \
   16.30 +  nocomments.force \
   16.31 +  total.force \
   16.32 +  total_chars.force
   16.33 +
   16.34 +all: $(TEST_SCRIPTS)
   16.35 +	echo "Tests successful."
   16.36 +
   16.37 +%.force: %.sh
   16.38 +	./$<
    17.1 --- a/test/Makefile.am	Fri Jun 03 20:06:08 2022 +0200
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,26 +0,0 @@
    17.4 -# Copyright 2018 Mike Becker. All rights reserved.
    17.5 -# 
    17.6 -# Redistribution and use in source and binary forms, with or without
    17.7 -# modification, are permitted provided that the following conditions are met:
    17.8 -# 
    17.9 -# 1. Redistributions of source code must retain the above copyright
   17.10 -# notice, this list of conditions and the following disclaimer.
   17.11 -# 
   17.12 -# 2. Redistributions in binary form must reproduce the above copyright
   17.13 -# notice, this list of conditions and the following disclaimer in the
   17.14 -# documentation and/or other materials provided with the distribution.
   17.15 -# 
   17.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   17.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   17.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   17.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   17.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   17.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   17.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   17.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   17.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   17.26 -
   17.27 -TESTS = $(check_SCRIPTS)
   17.28 -check_SCRIPTS = total.sh total_chars.sh nocomments.sh codeonly.sh codeonly_chars.sh
   17.29 -EXTRA_DIST = $(check_SCRIPTS) testfile.c
    18.1 --- a/test/codeonly.sh	Fri Jun 03 20:06:08 2022 +0200
    18.2 +++ b/test/codeonly.sh	Fri Sep 22 23:26:23 2023 +0200
    18.3 @@ -29,16 +29,13 @@
    18.4  
    18.5  echo -n "Verifying correctness of code only line count: "
    18.6  
    18.7 -clineprg="$(pwd)/../src/cline"
    18.8 -
    18.9 -cd $srcdir
   18.10 -count=`$clineprg -Vs testfile.c --exclude-cstyle-comments --exclude-blank-lines`
   18.11 +count=`../build/cline -Vs testfile.c --exclude-cstyle-comments --exclude-blank-lines`
   18.12  expected=5
   18.13  
   18.14  if [ "$count" -eq "$expected" ]; then
   18.15      echo "OK."
   18.16 -    exit 0;
   18.17 +    exit 0
   18.18  else
   18.19      echo "FAIL! $count is not $expected"
   18.20 -    exit 1;
   18.21 +    exit 1
   18.22  fi
    19.1 --- a/test/codeonly_chars.sh	Fri Jun 03 20:06:08 2022 +0200
    19.2 +++ b/test/codeonly_chars.sh	Fri Sep 22 23:26:23 2023 +0200
    19.3 @@ -29,16 +29,13 @@
    19.4  
    19.5  echo -n "Verifying correctness of code only character count: "
    19.6  
    19.7 -clineprg="$(pwd)/../src/cline"
    19.8 -
    19.9 -cd $srcdir
   19.10 -count=`$clineprg -Vcs testfile.c --exclude-cstyle-comments`
   19.11 +count=`../build/cline -Vcs testfile.c --exclude-cstyle-comments`
   19.12  expected=50
   19.13  
   19.14  if [ "$count" -eq "$expected" ]; then
   19.15      echo "OK."
   19.16 -    exit 0;
   19.17 +    exit 0
   19.18  else
   19.19      echo "FAIL! $count is not $expected"
   19.20 -    exit 1;
   19.21 +    exit 1
   19.22  fi
    20.1 --- a/test/nocomments.sh	Fri Jun 03 20:06:08 2022 +0200
    20.2 +++ b/test/nocomments.sh	Fri Sep 22 23:26:23 2023 +0200
    20.3 @@ -29,16 +29,13 @@
    20.4  
    20.5  echo -n "Verifying correctness of line count without comments: "
    20.6  
    20.7 -clineprg="$(pwd)/../src/cline"
    20.8 -
    20.9 -cd $srcdir
   20.10 -count=`$clineprg -Vs testfile.c --exclude-cstyle-comments`
   20.11 +count=`../build/cline -Vs testfile.c --exclude-cstyle-comments`
   20.12  expected=12
   20.13  
   20.14  if [ "$count" -eq "$expected" ]; then
   20.15      echo "OK."
   20.16 -    exit 0;
   20.17 +    exit 0
   20.18  else
   20.19      echo "FAIL! $count is not $expected"
   20.20 -    exit 1;
   20.21 +    exit 1
   20.22  fi
    21.1 --- a/test/total.sh	Fri Jun 03 20:06:08 2022 +0200
    21.2 +++ b/test/total.sh	Fri Sep 22 23:26:23 2023 +0200
    21.3 @@ -29,16 +29,13 @@
    21.4  
    21.5  echo -n "Verifying correctness of total line count: "
    21.6  
    21.7 -clineprg="$(pwd)/../src/cline"
    21.8 -
    21.9 -cd $srcdir
   21.10 -count=`$clineprg -Vs testfile.c`
   21.11 +count=`../build/cline -Vs testfile.c`
   21.12  expected=21
   21.13  
   21.14  if [ "$count" -eq "$expected" ]; then
   21.15      echo "OK."
   21.16 -    exit 0;
   21.17 +    exit 0
   21.18  else
   21.19      echo "FAIL! $count is not $expected"
   21.20 -    exit 1;
   21.21 +    exit 1
   21.22  fi
    22.1 --- a/test/total_chars.sh	Fri Jun 03 20:06:08 2022 +0200
    22.2 +++ b/test/total_chars.sh	Fri Sep 22 23:26:23 2023 +0200
    22.3 @@ -29,16 +29,13 @@
    22.4  
    22.5  echo -n "Verifying correctness of total character count: "
    22.6  
    22.7 -clineprg="$(pwd)/../src/cline"
    22.8 -
    22.9 -cd $srcdir
   22.10 -count=`$clineprg -Vcs testfile.c`
   22.11 +count=`../build/cline -Vcs testfile.c`
   22.12  expected=334
   22.13  
   22.14  if [ "$count" -eq "$expected" ]; then
   22.15      echo "OK."
   22.16 -    exit 0;
   22.17 +    exit 0
   22.18  else
   22.19      echo "FAIL! $count is not $expected"
   22.20 -    exit 1;
   22.21 +    exit 1
   22.22  fi

mercurial