#!/bin/sh cd "$(dirname $0)" # --- # Defaults. # --- # Project variables. [ -f Makefile.cfg ] && mv Makefile.cfg Makefile.cfg.tmp name="$(make -s getname)" version="$(make -s getversion)" indev="$(make -s isindev)" maintainer="$(make -s getmaintainer)" [ -f Makefile.cfg.tmp ] && mv Makefile.cfg.tmp Makefile.cfg # Platform. platform="$(command -v gcc 1>/dev/null && gcc --print-multiarch)" platform="$([ "$platform" ] && echo "/$platform")" # Make options. make_full_log= more_warnings= # Build options. target= no_file= no_libusb= static= windows= optimize_size= optimize=y no_log= loglevel=none # none, info, warn, error, fatal default_zoom=8 default_storage=fls0 # Installation directories. root='' prefix='${root}/usr' prefix_set= hprefix='${root}/usr' bindir='${prefix}/bin' hbindir='${hprefix}/bin' libdir='${prefix}/lib'"$platform" includedir='${prefix}/include'"$platform" pkgdir='${libdir}/pkgconfig' mandir='${prefix}/share/man' # Installation options. install_devel=yes install_manpages=yes # Tweaks. cflags= ldflags= # --- # Help message. # --- usage() { cat </dev/null ]; then echo "--default-zoom: a number is expected (got \"$zoom\")" >&2 elif [ $zoom -lt 1 ]; then echo "--default-zoom: should be 1 or more (got $zoom)" >&2 elif [ $zoom -gt 16 ]; then echo "--default-zoom: should be 16 or less (got $zoom)" >&2 else default_zoom=$zoom; fi ;; --default-storage=*) storage="${arg#*=}" # check if 4 chars long if [ ! $(echo "$storage" | wc -c ) -eq 5 ]; then echo "$0: --default-storage: must be 4 characters long" continue fi # then set default_storage="$storage" ;; --no-devel) install_devel= ;; --no-manpages) install_manpages= ;; --root=*) root="${arg#*=}" ;; --hprefix=*) hprefix="${arg#*=}" ;; --prefix=*) prefix="${arg#*=}"; prefix_set=y ;; --hbindir=*) hbindir="${arg#*=}" ;; --bindir=*) bindir="${arg#*=}" ;; --pkgdir=*) pkgdir="${arg#*=}" ;; --libdir=*) libdir="${arg#*=}" ;; --includedir=*) includedir="${arg#*=}" ;; --mandir=*) mandir="${arg#*=}" ;; CFLAGS=*) cflags="${arg#*=}" ;; LDFLAGS=*) ldflags="${arg#*=}" ;; *) echo "$arg: didn't read" ;; esac; done # --- # Checks and tweaks. # --- # Cross-compilation things. if [ ! $prefix_set ] && [ $target ]; then prefix="$prefix"/"$target" fi # Check MS-Windows targets. win_target= case "$target" in *-mingw32) if [ ! "$static" ]; then windows=y; win_target=y fi;; esac # Evaluate variables. vars="prefix bindir libdir pkgdir includedir hprefix hbindir mandir" for var in $vars; do eval $var'='$(eval 'echo $'$var) done # Check that static and MS-Windows are not asked. if [ "$static" ] && [ "$windows" ]; then cat >&2 <&2 <&2 </dev/null 2>/dev/null # Create the configuration header. tools/write-header-config --version=${version} \ --maintainer="$(echo ${maintainer} | sed 's/"/\\"/g')" \ $([ "$no_file" ] && echo --no-file) \ $([ "$no_libusb" ] && echo --no-libusb) \ $([ "$no_log" ] && echo --no-log) \ >include/libcasio/config.h # Do it! exec 3>&1 1>Makefile.cfg cat <&3 3>&- chmod +x Makefile.cfg # Print the end message. echo "Configuration loaded, you can make now." # End of file.