3 # ax-make: Alex' Simple Makefile System
4 # Copyright (c)2014 Alexander Barton (alex@barton.de)
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
14 [ -n "$1" ] && LIB_D="$1" || LIB_D="."
16 if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then
17 MAKEFILE_AX="/usr/local/share/ax-make/Makefile.ax"
18 elif [ -r "/usr/share/ax-make/Makefile.ax" ]; then
19 MAKEFILE_AX="/usr/share/ax-make/Makefile.ax"
21 echo "$NAME: No source \"Makefile.ax\" found!"
22 echo "$NAME: Please check your installation of \"ax-make\" and try again."
28 [ ! -d "$LIB_D" ] && mkdir -pv "$LIB_D"
30 target="$LIB_D/`basename "$MAKEFILE_AX"`"
31 if [ ! -e "$target" -o "$MAKEFILE_AX" -nt "$target" ]; then
32 echo "Updating \"$target\" ..."
33 cp -v "$MAKEFILE_AX" "$target" || exit 1
35 echo "Makefile \"$target\" is up to date."
38 # -- Project Makefile's ---
40 if [ ! -e "Makefile" ]; then
41 echo "Creating \"Makefile\" ..."
42 [ "$LIB_D" != "." ] && subdirs="$LIB_D" || subdirs=""
50 include $LIB_D/Makefile.ax
54 if [ "$LIB_D" != "." -a ! -e "$LIB_D/Makefile" ]; then
55 echo "Creating \"$LIB_D/Makefile\" ..."
56 cat >"$LIB_D/Makefile" <<EOF
65 # --- Standard project files ---
67 for f in AUTHORS COPYING README; do
68 if [ ! -e "$f" ]; then
69 echo "Creating empty \"$f\" ..."