new build system

Sat, 25 Feb 2023 11:01:46 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Feb 2023 11:01:46 +0100
changeset 742
7e67689241fd
parent 741
e9a5dd08258d
child 745
aea83a43b09a

new build system

.hgignore file | annotate | diff | comparison | revisions
Makefile file | annotate | diff | comparison | revisions
bsd.mk file | annotate | diff | comparison | revisions
clang.mk file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
cppcheck.mk file | annotate | diff | comparison | revisions
dav/Makefile file | annotate | diff | comparison | revisions
gcc.mk file | annotate | diff | comparison | revisions
install-sh file | annotate | diff | comparison | revisions
libidav/Makefile file | annotate | diff | comparison | revisions
libidav/session.c file | annotate | diff | comparison | revisions
make/Makefile file | annotate | diff | comparison | revisions
make/clang.mk file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/gcc.mk file | annotate | diff | comparison | revisions
make/install-sh file | annotate | diff | comparison | revisions
make/install.mk file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
make/suncc.mk file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
mingw.mk file | annotate | diff | comparison | revisions
osx.mk file | annotate | diff | comparison | revisions
suncc.mk file | annotate | diff | comparison | revisions
test/Makefile file | annotate | diff | comparison | revisions
ucx/Makefile file | annotate | diff | comparison | revisions
--- a/.hgignore	Wed Nov 02 11:45:56 2022 +0100
+++ b/.hgignore	Sat Feb 25 11:01:46 2023 +0100
@@ -3,6 +3,7 @@
 ^build/.*$
 ^docs/src/build/.*$
 core$
+^config.mk$
 ^.c?project$
 ^.settings/.*$
 ^test/bin-test/tmp-sync
--- a/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -1,7 +1,7 @@
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 #
-# Copyright 2018 Olaf Wintermann. All rights reserved.
+# Copyright 2011 Olaf Wintermann. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
@@ -26,69 +26,59 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-
-#
-# available configurations:
-#   gcc
-#   clang
-#   suncc
-#   mingw
-#   osx
-#   bsd
-#
-
-CONF=gcc
 PREFIX=/usr
 
-include $(CONF).mk
-include cppcheck.mk
+all: config.mk build/bin build/lib build/ucx build/dav build/libidav build/test build/tool ucx libidav dav test
+
+ucx: FORCE
+	cd ucx; $(MAKE) all
 
-all: build/tool build/ucx build/libidav build/test ucx libidav dav test
+libidav: build/bin build/lib build/dav build/libidav build/tool FORCE
+	cd libidav; $(MAKE) all
+	
+dav: FORCE build/bin build/lib build/dav build/libidav build/tool libidav ucx
+	cd dav; $(MAKE) all
 
-build:
-	mkdir -p build
+test: build/bin build/lib build/dav build/libidav build/test FORCE dav
+	cd test; $(MAKE) all
+
+build/bin:
+	mkdir -p build/bin
 
-build/tool:
-	mkdir -p build/tool
-    
+build/lib:
+	mkdir -p build/lib
+
+build/dav:
+	mkdir -p build/dav
+
+build/libidav:
+	mkdir -p build/libidav
+
 build/ucx:
 	mkdir -p build/ucx
-    
-build/libidav:
-	mkdir -p build/libidav
 
 build/test:
 	mkdir -p build/test
 
-ucx: FORCE
-	cd ucx; $(MAKE) CONF=$(CONF) all
+build/tool:
+	mkdir -p build/tool
 
-libidav: FORCE
-	cd libidav; $(MAKE) CONF=$(CONF) all
-	
-dav: FORCE libidav ucx
-	cd dav; $(MAKE) CONF=$(CONF) all
-
-test: FORCE dav
-	cd test; $(MAKE) CONF=$(CONF) all
-
-run: FORCE dav
-	./build/dav$(APP_EXT)
+config.mk:
+	@echo "create config"
+	./configure
 
-clean: FORCE
-	$(RM) $(RMFLAGS) -R build/
+clean:
+	@echo "clean"
+	rm -f -R build
 
-install: FORCE
-	@echo "install to $(DESTDIR)$(PREFIX)"
-	./install-sh -d $(DESTDIR)$(PREFIX)/bin
-	./install-sh build/dav $(DESTDIR)$(PREFIX)/bin
-	./install-sh build/dav-sync $(DESTDIR)$(PREFIX)/bin
+cleanall:
+	@echo "clean all"
+	rm -f -R build
+	rm -f -R work
+	rm -f config.mk
 
-cppcheck: FORCE build
-	truncate -s0 $(CPPCHECK_LOG)
-	cd libidav; $(MAKE) cppcheck
-	cd dav; $(MAKE) cppcheck
-	@echo "Static code analysis complete. See $(CPPCHECK_LOG) for the results."
+install: all
+	cd make; $(MAKE) -f install.mk install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
 
 FORCE:
 
--- a/bsd.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2017 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = clang
-LD = clang
-AR = ar
-RM = rm
-
-CFLAGS  = -g -c -D_FILE_OFFSET_BITS=64
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
-DAV_CFLAGS = `curl-config --cflags` `pkg-config --cflags libxml-2.0`
-DAV_LDFLAGS = -L/usr/lib -lssl -lcrypto `curl-config --libs` `pkg-config --libs libxml-2.0` -lpthread -lm
-
--- a/clang.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2016 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = clang
-LD = clang
-AR = ar
-RM = rm
-
-CFLAGS  = -g -c -D_FILE_OFFSET_BITS=64
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
-DAV_CFLAGS = `curl-config --cflags` `pkg-config --cflags openssl libxml-2.0`
-DAV_LDFLAGS = `curl-config --libs` `pkg-config --libs openssl libxml-2.0` -lpthread -lm
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,605 @@
+#!/bin/sh
+
+
+PREFIX=/usr
+EPREFIX=$PREFIX
+
+BINDIR=
+SBINDIR=
+LIBDIR=
+LIBEXECDIR=
+DATADIR=
+SYSCONFDIR=
+SHAREDSTATEDIR=
+LOCALSTATEDIR=
+INCLUDEDIR=
+INFODIR=
+MANDIR=
+
+OS=`uname -s`
+OS_VERSION=`uname -r`
+
+TEMP_DIR=".tmp-`uname -n`"
+mkdir -p $TEMP_DIR
+if [ $? -ne 0 ]; then
+	echo "Cannot create tmp dir"
+	echo "Abort"
+fi
+touch $TEMP_DIR/options
+touch $TEMP_DIR/features
+
+# features
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [OPTIONS]..."
+	cat << __EOF__
+Installation directories:
+  --prefix=PREFIX         path prefix for architecture-independent files
+                          [/usr]
+  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
+                          [PREFIX]
+
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        system configuration files [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+
+__EOF__
+}
+
+#
+# parse arguments 
+#
+for ARG in $@
+do
+    case "$ARG" in
+		"--prefix="*)         PREFIX=${ARG#--prefix=} ;;
+		"--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
+		"--bindir="*)         BINDIR=${ARG#----bindir=} ;;
+		"--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
+		"--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
+		"--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
+		"--datadir="*)        DATADIR=${ARG#--datadir=} ;;
+		"--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
+		"--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
+		"--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
+		"--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
+		"--infodir="*)        INFODIR=${ARG#--infodir=} ;;
+		"--mandir"*)          MANDIR=${ARG#--mandir} ;;
+		"--help"*) printhelp; exit 1 ;;
+		"-"*) echo "unknown option: $ARG"; exit 1 ;;
+	esac
+done
+
+# set dir variables
+if [ -z "$BINDIR" ]; then
+	BINDIR=$EPREFIX/bin
+fi
+if [ -z "$SBINDIR" ]; then
+	SBINDIR=$EPREFIX/sbin
+fi
+if [ -z "$LIBDIR" ]; then
+	LIBDIR=$EPREFIX/lib
+fi
+if [ -z "$LIBEXEC" ]; then
+	LIBEXECDIR=$EPREFIX/libexec
+fi
+if [ -z "$DATADIR" ]; then
+	DATADIR=$PREFIX/share
+fi
+if [ -z "$SYSCONFDIR" ]; then
+	SYSCONFDIR=$PREFIX/etc
+fi
+if [ -z "$SHAREDSTATEDIR" ]; then
+	SHAREDSTATEDIR=$PREFIX/com
+fi
+if [ -z "$LOCALSTATEDIR" ]; then
+	LOCALSTATEDIR=$PREFIX/var
+fi
+if [ -z "$INCLUDEDIR" ]; then
+	INCLUDEDIR=$PREFIX/include
+fi
+if [ -z "$INFODIR" ]; then
+	INFODIR=$PREFIX/info
+fi
+if [ -z "$MANDIR" ]; then
+	MANDIR=$PREFIX/man
+fi
+
+which pkg-config > /dev/null
+if [ $? -eq 0 ]; then
+    PKG_CONFIG=pkg-config
+else
+    PKG_CONFIG=false
+fi
+
+# Simple uname based platform detection
+# $PLATFORM is used for platform dependent dependency selection
+printf "detect platform... "
+if [ $OS = SunOS ]; then
+    PLATFORM="solaris sunos unix svr4"
+fi
+if [ $OS = Linux ]; then
+    PLATFORM="linux unix"
+fi
+if [ $OS = FreeBSD ]; then
+    PLATFORM="freebsd bsd unix"
+fi
+if [ $OS = Darwin ]; then
+    PLATFORM="macos osx bsd unix"
+fi
+echo $OS | grep "MINGW" > /dev/null
+if [ $? -eq 0 ]; then
+    PLATFORM="windows mingw"
+fi
+
+if [ -z "$PLATFORM" ]; then
+    PLATFORM="unix"
+fi
+
+for p in $PLATFORM
+do
+	PLATFORM_NAME=$p
+	break
+done
+echo $PLATFORM_NAME
+
+isplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
+
+# generate config.mk and config.h
+cat > $TEMP_DIR/config.mk << __EOF__
+#
+# config.mk generated by configure
+#
+
+# general vars
+
+PREFIX=$PREFIX
+EPREFIX=$EPREFIX
+
+BINDIR=$BINDIR
+SBINDIR=$SBINDIR
+LIBDIR=$LIBDIR
+LIBEXECDIR=$LIBEXECDIR
+DATADIR=$DATADIR
+SYSCONFDIR=$SYSCONFDIR
+SHAREDSTATEDIR=$SHAREDSTATEDIR
+LOCALSTATEDIR=$LOCALSTATEDIR
+INCLUDEDIR=$INCLUDEDIR
+INFODIR=$INFODIR
+MANDIR=$MANDIR
+
+__EOF__
+
+echo > $TEMP_DIR/make.mk
+
+ENV_CFLAGS=$CFLAGS
+ENV_LDFLAGS=$LDFLAGS
+ENV_CXXFLAGS=$CXXFLAGS
+
+# Toolchain detection
+# this will insert make vars to config.mk
+. make/toolchain.sh
+
+# add user specified flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${ENV_CFLAGS}" ]; then
+    echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
+    echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${ENV_LDFLAGS}" ]; then
+    echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#
+# DEPENDENCIES
+#
+
+dependency_curl()
+{
+    printf "checking for curl... "
+    # dependency curl platform="windows"
+    while true
+    do
+    	if isnotplatform "windows"; then
+            break
+        fi
+        CFLAGS="$CFLAGS -I/mingw/include"    
+        LDFLAGS="$LDFLAGS -lcurl"    
+		echo yes
+        return 0
+    done
+	
+    # dependency curl platform="macos"
+    while true
+    do
+    	if isnotplatform "macos"; then
+            break
+        fi
+        curl-config --cflags > /dev/null
+        if [ $? -eq 0 ]; then
+            CFLAGS="$CFLAGS `curl-config --cflags`"
+        else
+            break
+        fi
+        curl-config --ldflags > /dev/null
+        if [ $? -eq 0 ]; then
+            LDFLAGS="$LDFLAGS `curl-config --ldflags`"
+        else
+            break
+        fi
+		echo yes
+        return 0
+    done
+	
+    # dependency curl 
+    while true
+    do
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+		$PKG_CONFIG libcurl
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libcurl`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libcurl`"
+		echo yes
+        return 0
+    done
+	
+    # dependency curl 
+    while true
+    do
+        curl-config --cflags > /dev/null
+        if [ $? -eq 0 ]; then
+            CFLAGS="$CFLAGS `curl-config --cflags`"
+        else
+            break
+        fi
+        curl-config --ldflags > /dev/null
+        if [ $? -eq 0 ]; then
+            LDFLAGS="$LDFLAGS `curl-config --ldflags`"
+        else
+            break
+        fi
+        which curl-config > /dev/null
+        if [ $? -ne 0 ]; then
+        	break
+        fi
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+dependency_openssl()
+{
+    printf "checking for openssl... "
+    # dependency openssl platform="windows"
+    while true
+    do
+    	if isnotplatform "windows"; then
+            break
+        fi
+        LDFLAGS="$LDFLAGS -lssl -lcrypto"    
+		echo yes
+        return 0
+    done
+	
+    # dependency openssl platform="macos"
+    while true
+    do
+    	if isnotplatform "macos"; then
+            break
+        fi
+        LDFLAGS="$LDFLAGS -framework CoreFoundation"    
+		echo yes
+        return 0
+    done
+	
+    # dependency openssl platform="bsd"
+    while true
+    do
+    	if isnotplatform "bsd"; then
+            break
+        fi
+		if isplatform "macos"; then
+            break
+        fi
+        LDFLAGS="$LDFLAGS -lssl -lcrypto"    
+		echo yes
+        return 0
+    done
+	
+    # dependency openssl 
+    while true
+    do
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+		$PKG_CONFIG openssl
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags openssl`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`"
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+dependency_libxml2()
+{
+    printf "checking for libxml2... "
+    # dependency libxml2 platform="windows"
+    while true
+    do
+    	if isnotplatform "windows"; then
+            break
+        fi
+        xml2-config --cflags > /dev/null
+        if [ $? -eq 0 ]; then
+            CFLAGS="$CFLAGS `xml2-config --cflags`"
+        else
+            break
+        fi
+        xml2-config --libs > /dev/null
+        if [ $? -eq 0 ]; then
+            LDFLAGS="$LDFLAGS `xml2-config --libs`"
+        else
+            break
+        fi
+		echo yes
+        return 0
+    done
+	
+    # dependency libxml2 platform="macos"
+    while true
+    do
+    	if isnotplatform "macos"; then
+            break
+        fi
+        xml2-config --cflags > /dev/null
+        if [ $? -eq 0 ]; then
+            CFLAGS="$CFLAGS `xml2-config --cflags`"
+        else
+            break
+        fi
+        xml2-config --libs > /dev/null
+        if [ $? -eq 0 ]; then
+            LDFLAGS="$LDFLAGS `xml2-config --libs`"
+        else
+            break
+        fi
+		echo yes
+        return 0
+    done
+	
+    # dependency libxml2 
+    while true
+    do
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+		$PKG_CONFIG libxml-2.0
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
+		echo yes
+        return 0
+    done
+	
+    # dependency libxml2 
+    while true
+    do
+        xml2-config --cflags > /dev/null
+        if [ $? -eq 0 ]; then
+            CFLAGS="$CFLAGS `xml2-config --cflags`"
+        else
+            break
+        fi
+        xml2-config --libs > /dev/null
+        if [ $? -eq 0 ]; then
+            LDFLAGS="$LDFLAGS `xml2-config --libs`"
+        else
+            break
+        fi
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+
+DEPENDENCIES_FAILED=
+ERROR=0
+# general dependencies
+CFLAGS=
+LDFLAGS=
+while true
+do
+    while true
+    do
+        
+        LDFLAGS="$LDFLAGS -lpthread"    
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if isnotplatform "bsd"; then
+        break
+    fi
+    if isplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+        CFLAGS="$CFLAGS -I/usr/local/include"    
+        LDFLAGS="$LDFLAGS -L/usr/local/lib"    
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if isnotplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+		cat >> $TEMP_DIR/make.mk << __EOF__
+OBJ_EXT = .o
+LIB_EXT = .a
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if isnotplatform "unix"; then
+        break
+    fi
+    if isplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+		cat >> $TEMP_DIR/make.mk << __EOF__
+OBJ_EXT = .o
+LIB_EXT = .a
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+
+# add general dependency flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${CFLAGS}" ]; then
+    echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${CXXFLAGS}" ]; then
+    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${LDFLAGS}" ]; then
+    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#
+# OPTION VALUES
+#
+
+#
+# TARGETS
+#
+CFLAGS=
+CXXFLAGS=
+LDFLAGS=
+
+# Target: dav
+CFLAGS=
+LDFLAGS=
+CXXFLAGS=
+
+dependency_curl
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
+	ERROR=1
+fi
+dependency_libxml2
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
+	ERROR=1
+fi
+dependency_openssl
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
+	ERROR=1
+fi
+
+# Features
+
+
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${CFLAGS}" ]; then
+    echo "DAV_CFLAGS  += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${CXXFLAGS}" ]; then
+    echo "DAV_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${LDFLAGS}" ]; then
+    echo "DAV_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+if [ $ERROR -ne 0 ]; then
+	echo
+	echo "Error: Unresolved dependencies"
+	echo $DEPENDENCIES_FAILED
+	rm -Rf $TEMP_DIR
+	exit 1
+fi
+
+echo "configure finished"
+echo
+echo "Build Config:"
+echo "  PREFIX:    $PREFIX"
+echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+echo
+cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk
+rm -Rf $TEMP_DIR
+
+
--- a/cppcheck.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2018 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CPPCHECK=cppcheck
-CPPCHECK_CONFIG=--max-configs=32 -j 4
-CPPCHECK_FLAGS=`curl-config --cflags` `pkg-config --cflags-only-I openssl libxml-2.0`
-CPPCHECK_LOG=build/cppcheck.log
-
--- a/dav/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/dav/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -26,9 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CONF=gcc
-include ../$(CONF).mk
-include ../cppcheck.mk
+BUILD_ROOT = ..
+
+include ../config.mk
 
 DAV_SRC  = main.c
 DAV_SRC += config.c
@@ -61,24 +61,27 @@
 SYNC_OBJ = $(SYNC_SRC:%.c=../build/tool/%$(OBJ_EXT))
 XATTR_OBJ = $(XATTR_SRC:%.c=../build/tool/%$(OBJ_EXT))
 
-
-all: ../build/dav ../build/dav-sync ../build/xattrtool
+DAV_BIN = ../build/bin/dav$(APP_EXT)
+DAV_SYNC_BIN = ../build/bin/dav-sync$(APP_EXT)
+XATTRTOOL_BIN = ../build/bin/xattrtool$(APP_EXT)
 
-../build/dav: $(DAV_OBJ) ../build/libidav$(LIB_EXT)
-	$(LD) -o ../build/dav$(APP_EXT) $(DAV_OBJ) \
+all: ../build/bin/dav ../build/bin/dav-sync ../build/bin/xattrtool
+
+$(DAV_BIN): $(DAV_OBJ) ../build/libidav$(LIB_EXT)
+	$(LD) -o $(DAV_BIN) $(DAV_OBJ) \
 		../build/libidav$(LIB_EXT) ../build/libucx$(LIB_EXT)  \
 		$(LDFLAGS) $(DAV_LDFLAGS)
 
-../build/dav-sync: $(SYNC_OBJ) ../build/libidav$(LIB_EXT)
-	$(LD) -o ../build/dav-sync$(APP_EXT) $(SYNC_OBJ) \
+$(DAV_SYNC_BIN): $(SYNC_OBJ) ../build/libidav$(LIB_EXT)
+	$(LD) -o $(DAV_SYNC_BIN) $(SYNC_OBJ) \
 		../build/libidav$(LIB_EXT) ../build/libucx$(LIB_EXT)  \
 		$(LDFLAGS) $(DAV_LDFLAGS)
 
-../build/xattrtool: $(XATTR_OBJ)
-	$(LD) -o ../build/xattrtool$(APP_EXT) $(XATTR_OBJ) $(LDFLAGS)
+$(XATTRTOOL_BIN): $(XATTR_OBJ)
+	$(LD) -o $(XATTRTOOL_BIN) $(XATTR_OBJ) $(LDFLAGS)
 
 ../build/tool/%$(OBJ_EXT): %.c 
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx -o $@ $<
+	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ -I../ucx -c -o $@ $<
 
 
 cppcheck: $(DAV_SRC) $(SYNC_SRC)
--- a/gcc.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2018 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = gcc
-LD = gcc
-AR = ar
-RM = rm
-
-CFLAGS  = -std=gnu99 -g -c -D_FILE_OFFSET_BITS=64
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
-DAV_CFLAGS = `curl-config --cflags` `pkg-config --cflags openssl libxml-2.0`
-DAV_LDFLAGS = `curl-config --libs` `pkg-config --libs openssl libxml-2.0` -lpthread -lm
-
--- a/install-sh	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,501 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2013-12-25.23; # UTC
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-tab='	'
-nl='
-'
-IFS=" $tab$nl"
-
-# Set DOITPROG to "echo" to test this script.
-
-doit=${DOITPROG-}
-doit_exec=${doit:-exec}
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-is_target_a_directory=possibly
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
-
-    -d) dir_arg=true;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-        shift;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-        case $mode in
-          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
-            echo "$0: invalid mode: $mode" >&2
-            exit 1;;
-        esac
-        shift;;
-
-    -o) chowncmd="$chownprog $2"
-        shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t)
-        is_target_a_directory=always
-        dst_arg=$2
-        # Protect names problematic for 'test' and other utilities.
-        case $dst_arg in
-          -* | [=\(\)!]) dst_arg=./$dst_arg;;
-        esac
-        shift;;
-
-    -T) is_target_a_directory=never;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --) shift
-        break;;
-
-    -*) echo "$0: invalid option: $1" >&2
-        exit 1;;
-
-    *)  break;;
-  esac
-  shift
-done
-
-# We allow the use of options -d and -T together, by making -d
-# take the precedence; this is for compatibility with GNU install.
-
-if test -n "$dir_arg"; then
-  if test -n "$dst_arg"; then
-    echo "$0: target directory not allowed when installing a directory." >&2
-    exit 1
-  fi
-fi
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-    # Protect names problematic for 'test' and other utilities.
-    case $dst_arg in
-      -* | [=\(\)!]) dst_arg=./$dst_arg;;
-    esac
-  done
-fi
-
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call 'install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-if test -z "$dir_arg"; then
-  if test $# -gt 1 || test "$is_target_a_directory" = always; then
-    if test ! -d "$dst_arg"; then
-      echo "$0: $dst_arg: Is not a directory." >&2
-      exit 1
-    fi
-  fi
-fi
-
-if test -z "$dir_arg"; then
-  do_exit='(exit $ret); exit $ret'
-  trap "ret=129; $do_exit" 1
-  trap "ret=130; $do_exit" 2
-  trap "ret=141; $do_exit" 13
-  trap "ret=143; $do_exit" 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-        u_plus_rw=
-      else
-        u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-        u_plus_rw=
-      else
-        u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
-for src
-do
-  # Protect names problematic for 'test' and other utilities.
-  case $src in
-    -* | [=\(\)!]) src=./$src;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dst_arg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-    dst=$dst_arg
-
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test "$is_target_a_directory" = never; then
-        echo "$0: $dst_arg: Is a directory" >&2
-        exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      dstdir=`dirname "$dst"`
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-        # Create intermediate dirs using mode 755 as modified by the umask.
-        # This is like FreeBSD 'install' as of 1997-10-28.
-        umask=`umask`
-        case $stripcmd.$umask in
-          # Optimize common cases.
-          *[2367][2367]) mkdir_umask=$umask;;
-          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-          *[0-7])
-            mkdir_umask=`expr $umask + 22 \
-              - $umask % 100 % 40 + $umask % 20 \
-              - $umask % 10 % 4 + $umask % 2
-            `;;
-          *) mkdir_umask=$umask,go-w;;
-        esac
-
-        # With -d, create the new directory with the user-specified mode.
-        # Otherwise, rely on $mkdir_umask.
-        if test -n "$dir_arg"; then
-          mkdir_mode=-m$mode
-        else
-          mkdir_mode=
-        fi
-
-        posix_mkdir=false
-        case $umask in
-          *[123567][0-7][0-7])
-            # POSIX mkdir -p sets u+wx bits regardless of umask, which
-            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-            ;;
-          *)
-            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-            if (umask $mkdir_umask &&
-                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-            then
-              if test -z "$dir_arg" || {
-                   # Check for POSIX incompatibilities with -m.
-                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-                   # other-writable bit of parent directory when it shouldn't.
-                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-                   case $ls_ld_tmpdir in
-                     d????-?r-*) different_mode=700;;
-                     d????-?--*) different_mode=755;;
-                     *) false;;
-                   esac &&
-                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-                   }
-                 }
-              then posix_mkdir=:
-              fi
-              rmdir "$tmpdir/d" "$tmpdir"
-            else
-              # Remove any dirs left behind by ancient mkdir implementations.
-              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-            fi
-            trap '' 0;;
-        esac;;
-    esac
-
-    if
-      $posix_mkdir && (
-        umask $mkdir_umask &&
-        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-        /*) prefix='/';;
-        [-=\(\)!]*) prefix='./';;
-        *)  prefix='';;
-      esac
-
-      oIFS=$IFS
-      IFS=/
-      set -f
-      set fnord $dstdir
-      shift
-      set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-        test X"$d" = X && continue
-
-        prefix=$prefix$d
-        if test -d "$prefix"; then
-          prefixes=
-        else
-          if $posix_mkdir; then
-            (umask=$mkdir_umask &&
-             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-            # Don't fail if two instances are running concurrently.
-            test -d "$prefix" || exit 1
-          else
-            case $prefix in
-              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-              *) qprefix=$prefix;;
-            esac
-            prefixes="$prefixes '$qprefix'"
-          fi
-        fi
-        prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-        # Don't fail if two instances are running concurrently.
-        (umask $mkdir_umask &&
-         eval "\$doit_exec \$mkdirprog $prefixes") ||
-          test -d "$dstdir" || exit 1
-        obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
-       set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       set +f &&
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-        # Now remove or move aside any old file at destination location.
-        # We try this two ways since rm can't unlink itself on some
-        # systems and the destination file might be busy for other
-        # reasons.  In this case, the final cleanup might fail but the new
-        # file should still install successfully.
-        {
-          test ! -f "$dst" ||
-          $doit $rmcmd -f "$dst" 2>/dev/null ||
-          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-          } ||
-          { echo "$0: cannot unlink or rename $dst" >&2
-            (exit 1); exit 1
-          }
-        } &&
-
-        # Now rename the file to the real destination.
-        $doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
-
-    trap '' 0
-  fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
--- a/libidav/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/libidav/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -26,9 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-CONF=gcc
-include ../$(CONF).mk
-include ../cppcheck.mk
+BUILD_ROOT = ..
+
+include ../config.mk
 
 # list of source files
 SRC  = webdav.c
@@ -50,7 +50,7 @@
 	$(AR) $(ARFLAGS) $(AOFLAGS)../build/libidav$(LIB_EXT) $(OBJ)
 
 ../build/libidav/%$(OBJ_EXT): %.c
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I.. -I../ucx $(COFLAGS)$@ $<
+	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I.. -I../ucx -c -o $@ $<
 
 cppcheck: $(SRC)
 	$(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) -I../ucx $+ 2>> ../$(CPPCHECK_LOG)
--- a/libidav/session.c	Wed Nov 02 11:45:56 2022 +0100
+++ b/libidav/session.c	Sat Feb 25 11:01:46 2023 +0100
@@ -244,9 +244,9 @@
             case CURLE_SSL_ENGINE_SETFAILED:
             case CURLE_SSL_CERTPROBLEM:
             case CURLE_SSL_CIPHER:
-#ifndef CURLE_SSL_CACERT
-            case CURLE_SSL_CACERT:
-#endif
+//#ifndef CURLE_SSL_CACERT
+//            case CURLE_SSL_CACERT:
+//#endif
             case CURLE_SSL_CACERT_BADFILE:
             case CURLE_SSL_SHUTDOWN_FAILED:
             case CURLE_SSL_CRL_BADFILE:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,94 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2018 Olaf Wintermann. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#   1. Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+#
+# available configurations:
+#   gcc
+#   clang
+#   suncc
+#   mingw
+#   osx
+#   bsd
+#
+
+CONF=gcc
+PREFIX=/usr
+
+include $(CONF).mk
+include cppcheck.mk
+
+all: build/tool build/ucx build/libidav build/test ucx libidav dav test
+
+build:
+	mkdir -p build
+
+build/tool:
+	mkdir -p build/tool
+
+build/ucx:
+	mkdir -p build/ucx
+
+build/libidav:
+	mkdir -p build/libidav
+
+build/test:
+	mkdir -p build/test
+
+ucx: FORCE
+	cd ucx; $(MAKE) CONF=$(CONF) all
+
+libidav: FORCE
+	cd libidav; $(MAKE) CONF=$(CONF) all
+	
+dav: FORCE libidav ucx
+	cd dav; $(MAKE) CONF=$(CONF) all
+
+test: FORCE dav
+	cd test; $(MAKE) CONF=$(CONF) all
+
+run: FORCE dav
+	./build/dav$(APP_EXT)
+
+clean: FORCE
+	$(RM) $(RMFLAGS) -R build/
+
+install: FORCE
+	@echo "install to $(DESTDIR)$(PREFIX)"
+	./install-sh -d $(DESTDIR)$(PREFIX)/bin
+	./install-sh build/dav $(DESTDIR)$(PREFIX)/bin
+	./install-sh build/dav-sync $(DESTDIR)$(PREFIX)/bin
+
+cppcheck: FORCE build
+	truncate -s0 $(CPPCHECK_LOG)
+	cd libidav; $(MAKE) cppcheck
+	cd dav; $(MAKE) cppcheck
+	@echo "Static code analysis complete. See $(CPPCHECK_LOG) for the results."
+
+FORCE:
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/clang.mk	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,9 @@
+#
+# clang toolchain config
+#
+
+CFLAGS = -g
+LDFLAGS = 
+
+SHLIB_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -shared
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/configure.vm	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,615 @@
+#!/bin/sh
+
+#foreach( $var in $vars )
+#if( $var.exec )
+${var.name}=`${var.value}`
+#else
+${var.name}=${var.value}
+#end
+#end
+
+#if ( ! $project.hasVar("PREFIX") )
+PREFIX=/usr
+#end
+#if ( ! $project.hasVar("EPREFIX") )
+EPREFIX=$PREFIX
+#end
+
+#if ( ! $project.hasVar("BINDIR") )
+BINDIR=
+#end
+#if ( ! $project.hasVar("SBINDIR") )
+SBINDIR=
+#end
+#if ( ! $project.hasVar("LIBDIR") )
+LIBDIR=
+#end
+#if ( ! $project.hasVar("LIBEXECDIR") )
+LIBEXECDIR=
+#end
+#if ( ! $project.hasVar("DATADIR") )
+DATADIR=
+#end
+#if ( ! $project.hasVar("SYSCONFDIR") )
+SYSCONFDIR=
+#end
+#if ( ! $project.hasVar("SHAREDSTATEDIR") )
+SHAREDSTATEDIR=
+#end
+#if ( ! $project.hasVar("LOCALSTATEDIR") )
+LOCALSTATEDIR=
+#end
+#if ( ! $project.hasVar("INCLUDEDIR") )
+INCLUDEDIR=
+#end
+#if ( ! $project.hasVar("INFODIR") )
+INFODIR=
+#end
+#if ( ! $project.hasVar("MANDIR") )
+MANDIR=
+#end
+
+OS=`uname -s`
+OS_VERSION=`uname -r`
+
+TEMP_DIR=".tmp-`uname -n`"
+mkdir -p $TEMP_DIR
+if [ $? -ne 0 ]; then
+	echo "Cannot create tmp dir"
+	echo "Abort"
+fi
+touch $TEMP_DIR/options
+touch $TEMP_DIR/features
+
+# features
+#foreach( $feature in $features )
+#if( ${feature.isDefault()} )
+${feature.getVarName()}=on
+#end
+#end
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [OPTIONS]..."
+	cat << __EOF__
+Installation directories:
+  --prefix=PREFIX         path prefix for architecture-independent files
+                          [/usr]
+  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
+                          [PREFIX]
+
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        system configuration files [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+
+#if( $options.size() > 0 )
+Options:
+#foreach( $opt in $options )
+  --${opt.getArgument()}=${opt.getValuesString()}
+#end
+
+#end
+#if( $features.size() > 0 )
+Optional Features:
+#foreach( $feature in $features )
+#if( $feature.default )
+  --disable-${feature.arg}
+#else
+  --enable-${feature.arg}
+#end
+#end
+
+#end
+__EOF__
+}
+
+#
+# parse arguments 
+#
+#set( $D = '$' )
+for ARG in $@
+do
+    case "$ARG" in
+		"--prefix="*)         PREFIX=${D}{ARG#--prefix=} ;;
+		"--exec-prefix="*)    EPREFIX=${D}{ARG#--exec-prefix=} ;;
+		"--bindir="*)         BINDIR=${D}{ARG#----bindir=} ;;
+		"--sbindir="*)        SBINDIR=${D}{ARG#--sbindir=} ;;
+		"--libdir="*)         LIBDIR=${D}{ARG#--libdir=} ;;
+		"--libexecdir="*)     LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
+		"--datadir="*)        DATADIR=${D}{ARG#--datadir=} ;;
+		"--sysconfdir="*)     SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
+		"--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
+		"--localstatedir="*)  LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
+		"--includedir="*)     INCLUDEDIR=${D}{ARG#--includedir=} ;;
+		"--infodir="*)        INFODIR=${D}{ARG#--infodir=} ;;
+		"--mandir"*)          MANDIR=${D}{ARG#--mandir} ;;
+		"--help"*) printhelp; exit 1 ;;
+	#foreach( $opt in $options )
+    	"--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
+    #end
+	#foreach( $feature in $features )
+		"--enable-${feature.arg}") ${feature.getVarName()}=on ;;
+		"--disable-${feature.arg}") unset ${feature.getVarName()} ;;
+	#end
+		"-"*) echo "unknown option: $ARG"; exit 1 ;;
+	esac
+done
+
+# set dir variables
+if [ -z "$BINDIR" ]; then
+	BINDIR=$EPREFIX/bin
+fi
+if [ -z "$SBINDIR" ]; then
+	SBINDIR=$EPREFIX/sbin
+fi
+if [ -z "$LIBDIR" ]; then
+	LIBDIR=$EPREFIX/lib
+fi
+if [ -z "$LIBEXEC" ]; then
+	LIBEXECDIR=$EPREFIX/libexec
+fi
+if [ -z "$DATADIR" ]; then
+	DATADIR=$PREFIX/share
+fi
+if [ -z "$SYSCONFDIR" ]; then
+	SYSCONFDIR=$PREFIX/etc
+fi
+if [ -z "$SHAREDSTATEDIR" ]; then
+	SHAREDSTATEDIR=$PREFIX/com
+fi
+if [ -z "$LOCALSTATEDIR" ]; then
+	LOCALSTATEDIR=$PREFIX/var
+fi
+if [ -z "$INCLUDEDIR" ]; then
+	INCLUDEDIR=$PREFIX/include
+fi
+if [ -z "$INFODIR" ]; then
+	INFODIR=$PREFIX/info
+fi
+if [ -z "$MANDIR" ]; then
+	MANDIR=$PREFIX/man
+fi
+
+which pkg-config > /dev/null
+if [ $? -eq 0 ]; then
+    PKG_CONFIG=pkg-config
+else
+    PKG_CONFIG=false
+fi
+
+# Simple uname based platform detection
+# $PLATFORM is used for platform dependent dependency selection
+printf "detect platform... "
+if [ $OS = SunOS ]; then
+    PLATFORM="solaris sunos unix svr4"
+fi
+if [ $OS = Linux ]; then
+    PLATFORM="linux unix"
+fi
+if [ $OS = FreeBSD ]; then
+    PLATFORM="freebsd bsd unix"
+fi
+if [ $OS = Darwin ]; then
+    PLATFORM="macos osx bsd unix"
+fi
+echo $OS | grep "MINGW" > /dev/null
+if [ $? -eq 0 ]; then
+    PLATFORM="windows mingw"
+fi
+
+if [ -z "$PLATFORM" ]; then
+    PLATFORM="unix"
+fi
+
+for p in $PLATFORM
+do
+	PLATFORM_NAME=$p
+	break
+done
+echo $PLATFORM_NAME
+
+isplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
+
+# generate config.mk and config.h
+cat > $TEMP_DIR/config.mk << __EOF__
+#
+# config.mk generated by configure
+#
+
+# general vars
+#foreach( $var in $vars )
+${var.name}=$${var.name}
+#end
+
+#if ( ! $project.hasVar("PREFIX") )
+PREFIX=$PREFIX
+#end
+#if ( ! $project.hasVar("EPREFIX") )
+EPREFIX=$EPREFIX
+#end
+
+#if ( ! $project.hasVar("BINDIR") )
+BINDIR=$BINDIR
+#end
+#if ( ! $project.hasVar("SBINDIR") )
+SBINDIR=$SBINDIR
+#end
+#if ( ! $project.hasVar("LIBDIR") )
+LIBDIR=$LIBDIR
+#end
+#if ( ! $project.hasVar("LIBEXECDIR") )
+LIBEXECDIR=$LIBEXECDIR
+#end
+#if ( ! $project.hasVar("DATADIR") )
+DATADIR=$DATADIR
+#end
+#if ( ! $project.hasVar("SYSCONFDIR") )
+SYSCONFDIR=$SYSCONFDIR
+#end
+#if ( ! $project.hasVar("SHAREDSTATEDIR") )
+SHAREDSTATEDIR=$SHAREDSTATEDIR
+#end
+#if ( ! $project.hasVar("LOCALSTATEDIR") )
+LOCALSTATEDIR=$LOCALSTATEDIR
+#end
+#if ( ! $project.hasVar("INCLUDEDIR") )
+INCLUDEDIR=$INCLUDEDIR
+#end
+#if ( ! $project.hasVar("INFODIR") )
+INFODIR=$INFODIR
+#end
+#if ( ! $project.hasVar("MANDIR") )
+MANDIR=$MANDIR
+#end
+
+__EOF__
+
+echo > $TEMP_DIR/make.mk
+
+ENV_CFLAGS=$CFLAGS
+ENV_LDFLAGS=$LDFLAGS
+ENV_CXXFLAGS=$CXXFLAGS
+
+# Toolchain detection
+# this will insert make vars to config.mk
+. make/toolchain.sh
+
+# add user specified flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${ENV_CFLAGS}" ]; then
+    echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
+    echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${ENV_LDFLAGS}" ]; then
+    echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#
+# DEPENDENCIES
+#
+
+#foreach( $dependency in $namedDependencies )
+dependency_${dependency.name}()
+{
+    printf "checking for ${dependency.name}... "
+    #foreach( $sub in $dependency.getSubdependencies() )
+    # dependency $sub.name $sub.getPlatformString()
+    while true
+    do
+    	#if( $sub.platform )
+    	if isnotplatform "${sub.platform}"; then
+            break
+        fi
+    	#end
+		#foreach( $not in $sub.getNotList() )
+		if isplatform "${not}"; then
+            break
+        fi
+		#end
+        #if( $sub.pkgconfig.size() > 0 )
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+        #end
+        #foreach( $pkg in $sub.pkgconfig )
+		$PKG_CONFIG $pkg.getPkgConfigParam()
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        #end
+        #foreach( $flags in $sub.flags )
+        #if( $flags.exec )
+        $flags.value > /dev/null
+        if [ $? -eq 0 ]; then
+            $flags.varName="$$flags.varName `$flags.value`"
+        else
+            break
+        fi
+        #else
+        $flags.varName="$$flags.varName $flags.value"    
+        #end
+        #end
+        #foreach( $test in $sub.tests )
+        $test > /dev/null
+        if [ $? -ne 0 ]; then
+        	break
+        fi
+        #end
+		#if ( $sub.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# Dependency: $dependency.name		
+$sub.make
+__EOF__
+        #end
+		echo yes
+        return 0
+    done
+	
+	#end
+	echo no
+	return 1
+}
+#end
+
+DEPENDENCIES_FAILED=
+ERROR=0
+#if( $dependencies.size() > 0 )
+# general dependencies
+CFLAGS=
+LDFLAGS=
+#foreach( $dependency in $dependencies )
+while true
+do
+	#if( $dependency.platform )
+    if isnotplatform "${dependency.platform}"; then
+        break
+    fi
+    #end
+	#foreach( $not in $dependency.getNotList() )
+    if isplatform "${not}"; then
+        break
+    fi
+	#end
+    while true
+    do
+        #if( $dependency.pkgconfig.size() > 0 )
+        if [ -z "$PKG_CONFIG" ]; then
+            ERROR=1
+            break
+        fi
+        #end
+        #foreach( $pkg in $dependency.pkgconfig )
+        printf "checking for pkg-config package $pkg.getPkgConfigParam()... "
+		$PKG_CONFIG $pkg.getPkgConfigParam()
+        if [ $? -ne 0 ]; then
+            echo no
+            ERROR=1
+            break
+        fi
+        echo yes
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs $pkg.getPkgConfigParam()`"
+        #end
+        
+        #foreach( $flags in $dependency.flags )
+        #if( $flags.exec )
+        $flags.value > /dev/null
+        if [ $? -ne 0 ]; then
+            $flags.varName="$$flags.varName `$flags.value`"
+        else
+            ERROR=1
+            break
+        fi
+        #else
+        $flags.varName="$$flags.varName $flags.value"    
+        #end
+        #end
+		#if ( $dependency.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+$dependency.make
+__EOF__
+        #end
+        
+        break
+    done
+    
+    break
+done
+#end
+
+# add general dependency flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${CFLAGS}" ]; then
+    echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${CXXFLAGS}" ]; then
+    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${LDFLAGS}" ]; then
+    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+#end
+
+#
+# OPTION VALUES
+#
+#foreach( $opt in $options )
+#foreach( $val in $opt.values )
+${val.func}()
+{
+	VERR=0
+	#foreach( $dep in $val.dependencies )
+	dependency_$dep
+	if [ $? -ne 0 ]; then
+		VERR=1
+	fi
+	#end
+	if [ $VERR -ne 0 ]; then
+		return 1
+	fi
+	#foreach( $def in $val.defines )
+		CFLAGS="$CFLAGS ${def.toFlags()}"
+	#end
+	#if( $val.hasMake() )
+	cat >> $TEMP_DIR/make.mk << __EOF__
+$val.make
+__EOF__
+	#end
+	return 0
+}
+#end
+#end
+
+#
+# TARGETS
+#
+CFLAGS=
+CXXFLAGS=
+LDFLAGS=
+
+#foreach( $target in $targets )
+#if ( $target.name )
+# Target: $target.name
+#else
+# Target
+#end
+CFLAGS=
+LDFLAGS=
+CXXFLAGS=
+
+#foreach( $dependency in $target.dependencies )
+dependency_$dependency
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
+	ERROR=1
+fi
+#end
+
+# Features
+#foreach( $feature in $target.features )
+if [ ! -z "$${feature.getVarName()}" ]; then
+#foreach( $dependency in $feature.dependencies )
+	# check dependency
+	dependency_$dependency
+	if [ $? -ne 0 ]; then
+		# "auto" features can fail and are just disabled in this case
+		if [ $${feature.getVarName()} != "auto" ]; then
+			DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
+			ERROR=1
+		fi
+	fi
+#end
+fi
+#end
+
+#foreach( $opt in $target.options )
+# Option: --${opt.argument}
+if [ -z ${D}${opt.getVarName()} ]; then
+	SAVED_ERROR=$ERROR
+	SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED
+	ERROR=0
+	while true
+	do
+		#foreach( $optdef in $opt.defaults )
+		#if( $optdef.platform )
+		if isplatform "$optdef.platform"; then
+		#end
+		$optdef.func
+		if [ $? -eq 0 ]; then
+			echo "  ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options
+			ERROR=0
+			break
+		fi
+		#if( $optdef.platform )
+		fi
+		#end
+		#end
+		break
+	done
+	if [ $ERROR -ne 0 ]; then
+		SAVED_ERROR=1
+	fi
+	ERROR=$SAVED_ERROR
+	DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
+else
+	if false; then
+		false
+	#foreach( $optval in $opt.values )
+	elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then
+		echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
+		$optval.func
+		if [ $? -ne 0 ]; then
+			ERROR=1
+		fi
+	#end
+	fi
+fi
+#end
+
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${CFLAGS}" ]; then
+    echo "${target.getCFlags()}  += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${CXXFLAGS}" ]; then
+    echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${LDFLAGS}" ]; then
+    echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#end
+if [ $ERROR -ne 0 ]; then
+	echo
+	echo "Error: Unresolved dependencies"
+	echo $DEPENDENCIES_FAILED
+	rm -Rf $TEMP_DIR
+	exit 1
+fi
+
+echo "configure finished"
+echo
+echo "Build Config:"
+echo "  PREFIX:    $PREFIX"
+echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+#if ( $options.size() > 0 )
+echo "Options:"
+cat $TEMP_DIR/options
+#end
+echo
+cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk
+rm -Rf $TEMP_DIR
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/gcc.mk	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,11 @@
+#
+# gcc toolchain config
+#
+
+CFLAGS = -std=gnu11 -g
+LDFLAGS = 
+
+SHLIB_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -shared
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/install-sh	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,501 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2013-12-25.23; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab='	'
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+        case $mode in
+          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+            echo "$0: invalid mode: $mode" >&2
+            exit 1;;
+        esac
+        shift;;
+
+    -o) chowncmd="$chownprog $2"
+        shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t)
+        is_target_a_directory=always
+        dst_arg=$2
+        # Protect names problematic for 'test' and other utilities.
+        case $dst_arg in
+          -* | [=\(\)!]) dst_arg=./$dst_arg;;
+        esac
+        shift;;
+
+    -T) is_target_a_directory=never;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --) shift
+        break;;
+
+    -*) echo "$0: invalid option: $1" >&2
+        exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+  if test -n "$dst_arg"; then
+    echo "$0: target directory not allowed when installing a directory." >&2
+    exit 1
+  fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call 'install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  if test $# -gt 1 || test "$is_target_a_directory" = always; then
+    if test ! -d "$dst_arg"; then
+      echo "$0: $dst_arg: Is not a directory." >&2
+      exit 1
+    fi
+  fi
+fi
+
+if test -z "$dir_arg"; then
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+        u_plus_rw=
+      else
+        u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names problematic for 'test' and other utilities.
+  case $src in
+    -* | [=\(\)!]) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+    dst=$dst_arg
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test "$is_target_a_directory" = never; then
+        echo "$0: $dst_arg: Is a directory" >&2
+        exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      dstdir=`dirname "$dst"`
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+        # Create intermediate dirs using mode 755 as modified by the umask.
+        # This is like FreeBSD 'install' as of 1997-10-28.
+        umask=`umask`
+        case $stripcmd.$umask in
+          # Optimize common cases.
+          *[2367][2367]) mkdir_umask=$umask;;
+          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+          *[0-7])
+            mkdir_umask=`expr $umask + 22 \
+              - $umask % 100 % 40 + $umask % 20 \
+              - $umask % 10 % 4 + $umask % 2
+            `;;
+          *) mkdir_umask=$umask,go-w;;
+        esac
+
+        # With -d, create the new directory with the user-specified mode.
+        # Otherwise, rely on $mkdir_umask.
+        if test -n "$dir_arg"; then
+          mkdir_mode=-m$mode
+        else
+          mkdir_mode=
+        fi
+
+        posix_mkdir=false
+        case $umask in
+          *[123567][0-7][0-7])
+            # POSIX mkdir -p sets u+wx bits regardless of umask, which
+            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+            ;;
+          *)
+            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+            if (umask $mkdir_umask &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+            then
+              if test -z "$dir_arg" || {
+                   # Check for POSIX incompatibilities with -m.
+                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+                   # other-writable bit of parent directory when it shouldn't.
+                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                   case $ls_ld_tmpdir in
+                     d????-?r-*) different_mode=700;;
+                     d????-?--*) different_mode=755;;
+                     *) false;;
+                   esac &&
+                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+                   }
+                 }
+              then posix_mkdir=:
+              fi
+              rmdir "$tmpdir/d" "$tmpdir"
+            else
+              # Remove any dirs left behind by ancient mkdir implementations.
+              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+            fi
+            trap '' 0;;
+        esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+        umask $mkdir_umask &&
+        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+        /*) prefix='/';;
+        [-=\(\)!]*) prefix='./';;
+        *)  prefix='';;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      set -f
+      set fnord $dstdir
+      shift
+      set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+        test X"$d" = X && continue
+
+        prefix=$prefix$d
+        if test -d "$prefix"; then
+          prefixes=
+        else
+          if $posix_mkdir; then
+            (umask=$mkdir_umask &&
+             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+            # Don't fail if two instances are running concurrently.
+            test -d "$prefix" || exit 1
+          else
+            case $prefix in
+              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+              *) qprefix=$prefix;;
+            esac
+            prefixes="$prefixes '$qprefix'"
+          fi
+        fi
+        prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+        # Don't fail if two instances are running concurrently.
+        (umask $mkdir_umask &&
+         eval "\$doit_exec \$mkdirprog $prefixes") ||
+          test -d "$dstdir" || exit 1
+        obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
+       set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       set +f &&
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+        # Now remove or move aside any old file at destination location.
+        # We try this two ways since rm can't unlink itself on some
+        # systems and the destination file might be busy for other
+        # reasons.  In this case, the final cleanup might fail but the new
+        # file should still install successfully.
+        {
+          test ! -f "$dst" ||
+          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+          } ||
+          { echo "$0: cannot unlink or rename $dst" >&2
+            (exit 1); exit 1
+          }
+        } &&
+
+        # Now rename the file to the real destination.
+        $doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/install.mk	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,37 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2013 Olaf Wintermann. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#   1. Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+BUILD_ROOT = ..
+
+include ../config.mk
+
+install: install-dir install-bin
+	@echo "install to $(DESTDIR)$(PREFIX)"
+	./install-sh -d $(DESTDIR)$(PREFIX)/bin
+	./install-sh ../build/bin/dav $(DESTDIR)$(PREFIX)/bin
+	./install-sh ../build/bin/dav-sync $(DESTDIR)$(PREFIX)/bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/project.xml	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<dependency name="curl" platform="windows">
+		<cflags>-I/mingw/include</cflags>
+		<ldflags>-lcurl</ldflags>
+	</dependency>
+	<dependency name="curl" platform="macos">
+		<cflags type="exec">curl-config --cflags</cflags>
+		<ldflags type="exec">curl-config --ldflags</ldflags>
+	</dependency>
+	<dependency name="curl">
+		<pkgconfig>libcurl</pkgconfig>
+	</dependency>
+	<dependency name="curl">
+		<test>which curl-config</test>
+		<cflags type="exec">curl-config --cflags</cflags>
+		<ldflags type="exec">curl-config --ldflags</ldflags>
+	</dependency>
+	
+	<dependency name="libxml2" platform="windows">
+		<cflags type="exec">xml2-config --cflags</cflags>
+		<ldflags type="exec">xml2-config --libs</ldflags>
+	</dependency>
+	<dependency name="libxml2" platform="macos">
+		<cflags type="exec">xml2-config --cflags</cflags>
+		<ldflags type="exec">xml2-config --libs</ldflags>
+	</dependency>
+	<dependency name="libxml2">
+		<pkgconfig>libxml-2.0</pkgconfig>
+	</dependency>
+	<dependency name="libxml2">
+		<cflags type="exec">xml2-config --cflags</cflags>
+		<ldflags type="exec">xml2-config --libs</ldflags>
+	</dependency>
+	
+	<dependency name="openssl" platform="windows">
+		<ldflags>-lssl -lcrypto</ldflags>
+	</dependency>
+	<dependency name="openssl" platform="macos">
+		<ldflags>-framework CoreFoundation</ldflags>
+	</dependency>
+	<dependency name="openssl" platform="bsd" not="macos">
+		<ldflags>-lssl -lcrypto</ldflags>
+	</dependency>
+	<dependency name="openssl">
+		<pkgconfig>openssl</pkgconfig>
+	</dependency>
+
+	<dependency>
+		<ldflags>-lpthread</ldflags>
+	</dependency>
+	
+	<dependency platform="bsd" not="macos">
+		<cflags>-I/usr/local/include</cflags>
+		<ldflags>-L/usr/local/lib</ldflags>
+	</dependency>
+
+	<dependency platform="macos">
+		<make>OBJ_EXT = .o</make>
+		<make>LIB_EXT = .a</make>
+	</dependency>
+	<dependency platform="unix" not="macos">
+		<make>OBJ_EXT = .o</make>
+		<make>LIB_EXT = .a</make>
+	</dependency>
+
+
+	<target name="dav">
+		<dependencies>curl,libxml2,openssl</dependencies>
+	</target>
+</project>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/suncc.mk	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,10 @@
+#
+# suncc toolchain
+#
+
+CFLAGS += -xc99 -g -m64
+LDFLAGS += -m64 -Wl,-R,'$$ORIGIN/../lib'
+
+SHLIB_CFLAGS = -Kpic
+SHLIB_LDFLAGS = -G -m64
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/toolchain.sh	Sat Feb 25 11:01:46 2023 +0100
@@ -0,0 +1,181 @@
+#!/bin/sh
+#
+# toolchain detection
+#
+
+C_COMPILERS="cc gcc clang suncc"
+CPP_COMPILERS="CC g++ clang++ sunCC"
+unset CC_ARG_CHECKED
+unset TOOLCHAIN_DETECTION_ERROR
+unset TOOLCHAIN_NAME
+
+check_c_compiler()
+{
+	cat > $TEMP_DIR/test.c << __EOF__
+/* test file */
+#include <stdio.h>
+int main(int argc, char **argv) {
+#if defined(__clang__)
+	printf("clang\n");
+#elif defined(__GNUC__)
+	printf("gcc\n");
+#elif defined(__sun)
+	printf("suncc\n");
+#else
+	printf("unknown\n");
+#endif
+	return 0;
+}
+__EOF__
+	rm -f $TEMP_DIR/checkcc
+	$1 -o $TEMP_DIR/checkcc $CFLAGS $LDFLAGS $TEMP_DIR/test.c 2> /dev/null
+	
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+	return 0
+}
+
+check_cpp_compiler()
+{
+	cat > $TEMP_DIR/test.cpp << __EOF__
+/* test file */
+#include <iostream>
+int main(int argc, char **argv) {
+#if defined(__clang__)
+	std::cout << "clang" << std::endl;
+#elif defined(__GNUC__)
+	std::cout << "gcc" << std::endl;
+#elif defined(__sun)
+	std::cout << "suncc" << std::endl;
+#else
+	std::cout << "unknown" << std::endl;
+#endif
+	return 0;
+}
+__EOF__
+	rm -f $TEMP_DIR/checkcc
+	$1 -o $TEMP_DIR/checkcc $CXXFLAGS $LDFLAGS $TEMP_DIR/test.cpp 2> /dev/null
+	
+	if [ $? -ne 0 ]; then
+		return 1
+	fi
+	return 0
+}
+
+printf "detect C compiler... "
+
+for COMP in $C_COMPILERS
+do
+	check_c_compiler $COMP
+	if [ $? -ne 0 ]; then
+		if [ ! -z "$CC" ]; then
+			if [ $COMP = $CC ]; then
+				echo "$CC is not a working C Compiler"
+				TOOLCHAIN_DETECTION_ERROR="error"
+				break
+			fi
+		fi
+	else
+		TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+		USE_TOOLCHAIN=$TOOLCHAIN_NAME
+		if [ $COMP = "cc" ]; then
+			# we have found a working compiler, but in case
+			# the compiler is gcc or clang, we try to use
+			# these commands and not 'cc'
+			TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+			if [ $TOOLCHAIN_NAME = "gcc" ]; then
+				check_c_compiler "gcc"
+				if [ $? -eq 0 ]; then
+					COMP=gcc
+					USE_TOOLCHAIN="gcc"
+				fi
+			fi
+			if [ $TOOLCHAIN_NAME = "clang" ]; then
+				check_c_compiler "clang"
+				if [ $? -eq 0 ]; then
+					COMP=clang
+					USE_TOOLCHAIN="clang"
+				fi
+			fi
+		fi
+		
+		TOOLCHAIN_NAME=$USE_TOOLCHAIN
+		TOOLCHAIN_CC=$COMP
+		echo $COMP
+		break
+	fi
+done
+if [ -z $TOOLCHAIN_CC ]; then
+	echo "not found"
+fi
+
+printf "detect C++ compiler... "
+
+for COMP in $CPP_COMPILERS
+do
+	check_cpp_compiler $COMP
+	if [ $? -ne 0 ]; then
+		if [ ! -z "$CXX" ]; then
+			if [ $COMP = $CXX ]; then
+				echo "$CC is not a working C++ Compiler"
+				TOOLCHAIN_DETECTION_ERROR="error"
+				break
+			fi
+		fi
+	else
+		if [ $COMP = "CC" ]; then
+			# we have found a working compiler, but in case
+			# the compiler is gcc or clang, we try to use
+			# these commands and not 'cc'
+			TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+			USE_TOOLCHAIN=$TOOLCHAIN_NAME
+			if [ $TOOLCHAIN_NAME = "gcc" ]; then
+				check_cpp_compiler "g++"
+				if [ $? -eq 0 ]; then
+				   COMP=g++
+				   USE_TOOLCHAIN="gcc"
+				fi
+			fi
+			if [ $TOOLCHAIN_NAME = "clang" ]; then
+				check_cpp_compiler "clang++"
+				if [ $? -eq 0 ]; then
+				   COMP=clang++
+				   USE_TOOLCHAIN="clang"
+				fi
+			fi
+		fi
+		
+		TOOLCHAIN_NAME=$USE_TOOLCHAIN
+		TOOLCHAIN_CXX=$COMP
+		echo $COMP
+		break
+	fi
+done
+if [ -z $TOOLCHAIN_CXX ]; then
+	echo "not found"
+fi
+
+TOOLCHAIN_LD=$TOOLCHAIN_CC
+
+if [ -z "$TOOLCHAIN_NAME" ]; then
+	TOOLCHAIN_DETECTION_ERROR="error"
+else
+	cat >> $TEMP_DIR/config.mk << __EOF__
+# toolchain
+__EOF__
+	echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk
+	if [ ! -z "$TOOLCHAIN_CXX" ]; then
+		echo "CXX = ${TOOLCHAIN_CXX}" >> $TEMP_DIR/config.mk
+	fi
+	echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk
+	echo >> $TEMP_DIR/config.mk
+	
+	cat "make/${TOOLCHAIN_NAME}.mk" > /dev/null 2>&1
+	if [ $? -eq 0 ]; then 
+		echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk
+	else
+		echo "SHLIB_CFLAGS = -fPIC" >> $TEMP_DIR/config.mk
+		echo "SHLIB_LDFLAGS = -shared" >> $TEMP_DIR/config.mk
+	fi
+fi
--- a/mingw.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2018 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = gcc
-LD = gcc
-AR = ar
-RM = rm
-
-CFLAGS  = -std=gnu99 -g -c
-COFLAGS = -o
-LDFLAGS = -municode
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT = .exe
-
-DAV_CFLAGS = `xml2-config --cflags` -I/mingw/include
-DAV_LDFLAGS = `xml2-config --libs` -L/mingw/lib -lcurl -lws2_32 -lgdi32  -luuid -lole32 -loleaut32 -lgnurx -lbcrypt
-
--- a/osx.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2018 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = cc
-LD = cc
-AR = ar
-RM = rm
-
-CFLAGS  = -g -c -Wno-deprecated -Wno-format
-COFLAGS = -o
-LDFLAGS = 
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
-DAV_CFLAGS = `xml2-config --cflags`
-DAV_LDFLAGS = -framework CoreFoundation -lcurl -lxml2 -lpthread -lm
--- a/suncc.mk	Wed Nov 02 11:45:56 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2018 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CC = cc
-LD = cc
-AR = ar
-RM = rm
-
-CFLAGS  =  -g -c -xc99 -D_FILE_OFFSET_BITS=64
-COFLAGS = -o
-LDFLAGS = -lmd -lm
-LOFLAGS = -o
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = .o
-LIB_EXT = .a
-APP_EXT =
-
-DAV_CFLAGS = `curl-config --cflags` `pkg-config --cflags openssl libxml-2.0`
-DAV_LDFLAGS = `pkg-config --libs openssl libxml-2.0` `curl-config --libs` -lpthread -lm
-
--- a/test/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/test/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -26,7 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include ../$(CONF).mk
+BUILD_ROOT = ..
+
+include ../config.mk
 
 TEST_SRC  = main.c
 TEST_SRC += base64.c
@@ -45,5 +47,5 @@
 		$(LDFLAGS) $(DAV_LDFLAGS)
 
 ../build/test/%$(OBJ_EXT): %.c 
-	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ucx -I../ -o $@ $<
+	$(CC) $(CFLAGS) $(DAV_CFLAGS) -I../ucx -I../ -c -o $@ $<
 
--- a/ucx/Makefile	Wed Nov 02 11:45:56 2022 +0100
+++ b/ucx/Makefile	Sat Feb 25 11:01:46 2023 +0100
@@ -26,7 +26,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include ../$(CONF).mk
+BUILD_ROOT = ..
+
+include ../config.mk
 
 # list of source files
 SRC  = utils.c
@@ -51,7 +53,7 @@
 	$(AR) $(ARFLAGS) $(AOFLAGS)../build/libucx$(LIB_EXT) $(OBJ)
 
 ../build/ucx/%$(OBJ_EXT): %.c
-	$(CC) $(CFLAGS) $(COFLAGS)$@ $<
+	$(CC) $(CFLAGS) -c -o $@ $<
 
 ../build/ucx:
 	$(MKDIR) $(MKDIRFLAGS) ../build/ucx

mercurial