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.
15 echo "Usage: $NAME [<lib-dir>]"
17 echo " <lib-dir> Library directory. Default: current working directory."
36 [ -n "$1" ] && LIB_D="$1" || LIB_D="."
38 if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then
39 MAKEFILE_AX="/usr/local/share/ax-make/Makefile.ax"
40 elif [ -r "/usr/share/ax-make/Makefile.ax" ]; then
41 MAKEFILE_AX="/usr/share/ax-make/Makefile.ax"
43 echo "$NAME: No source \"Makefile.ax\" found!"
44 echo "$NAME: Please check your installation of \"ax-make\" and try again."
50 if [ ! -d "$LIB_D" ]; then
51 mkdir -pv "$LIB_D" || exit 1
54 target="$LIB_D/`basename "$MAKEFILE_AX"`"
55 if [ ! -e "$target" -o "$MAKEFILE_AX" -nt "$target" ]; then
56 echo "Updating \"$target\" ..."
57 cp -v "$MAKEFILE_AX" "$target" || exit 1
59 echo "Makefile \"$target\" is up to date."
62 # -- Project Makefile's ---
64 if [ ! -e "Makefile" ]; then
65 echo "Creating \"Makefile\" ..."
66 [ "$LIB_D" != "." ] && subdirs="$LIB_D" || subdirs=""
74 include $LIB_D/Makefile.ax
78 if [ "$LIB_D" != "." -a ! -e "$LIB_D/Makefile" ]; then
79 echo "Creating \"$LIB_D/Makefile\" ..."
80 cat >"$LIB_D/Makefile" <<EOF
89 # --- Standard project files ---
92 if [ ! -e AUTHORS ]; then
93 if git --version >/dev/null 2>&1; then
94 echo "Creating \"AUTHORS\" file ..."
95 echo "`git config user.name` <`git config user.email`>" >>AUTHORS
100 for f in $authors COPYING README; do
101 if [ ! -e "$f" ]; then
102 echo "Creating empty \"$f\" file ..."