]> arthur.barton.de Git - ax-make.git/commitdiff
Add "axify" script to the project
authorAlexander Barton <alex@barton.de>
Wed, 28 May 2014 10:52:08 +0000 (12:52 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 28 May 2014 10:52:08 +0000 (12:52 +0200)
Makefile
scripts/Makefile [new file with mode: 0644]
scripts/axify [new file with mode: 0755]

index 4a26dffd4397942e1f57129279d1a08433aa12e7..0bf501e3fda1953b27c1b4b304443b296de0982e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,8 @@
 # (at your option) any later version.
 #
 
+SUBDIRS = scripts
+
 include Makefile.ax
 
 install-local:
diff --git a/scripts/Makefile b/scripts/Makefile
new file mode 100644 (file)
index 0000000..94d80ee
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# ax-make: Alex' Simple Makefile System
+# Copyright (c)2014 Alexander Barton (alex@barton.de)
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+
+ALL = axify
+
+include ../Makefile.ax
+
+install-local:
+       install -d -o $(USER) -g $(GROUP) -m 755 \
+        $(DESTDIR)$(PREFIX)/bin
+       install -p -o $(USER) -g $(GROUP) -m 755 axify \
+        $(DESTDIR)$(PREFIX)/bin/axify
diff --git a/scripts/axify b/scripts/axify
new file mode 100755 (executable)
index 0000000..b40d918
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/sh
+#
+# ax-make: Alex' Simple Makefile System
+# Copyright (c)2014 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+NAME=`basename "$0"`
+
+[ -n "$1" ] && LIB_D="$1" || LIB_D="."
+
+if [ -r "/usr/local/share/ax-make/Makefile.ax" ]; then
+       MAKEFILE_AX="/usr/local/share/ax-make/Makefile.ax"
+elif [ -r "/usr/share/ax-make/Makefile.ax" ]; then
+       MAKEFILE_AX="/usr/share/ax-make/Makefile.ax"
+else
+       echo "$NAME: No source \"Makefile.ax\" found!"
+       echo "$NAME: Please check your installation of \"ax-make\" and try again."
+       exit 1
+fi
+
+# -- Makefile.ax --
+
+[ ! -d "$LIB_D" ] && mkdir -pv "$LIB_D"
+if [ "$MAKEFILE_AX" -nt "$LIB_D/`basename "$MAKEFILE_AX"`" ]; then
+       echo "Updating \"$LIB_D/`basename "$MAKEFILE_AX"`\" ..."
+       cp -v "$MAKEFILE_AX" "$LIB_D/`basename "$MAKEFILE_AX"`" || exit 1
+else
+       echo "Makefile \"$LIB_D/`basename "$MAKEFILE_AX"`\" is up to date."
+fi
+
+# -- Project Makefile's ---
+
+if [ ! -e "Makefile" ]; then
+echo "Creating \"Makefile\" ..."
+[ "$LIB_D" != "." ] && subdirs="$LIB_D" || subdirs=""
+cat >"Makefile" <<EOF
+#
+# Makefile
+#
+
+SUBDIRS = $subdirs
+
+include $LIB_D/Makefile.ax
+EOF
+fi
+
+if [ "$LIB_D" != "." -a ! -e "$LIB_D/Makefile" ]; then
+echo "Creating \"$LIB_D/Makefile\" ..."
+cat >"$LIB_D/Makefile" <<EOF
+#
+# Makefile
+#
+
+include Makefile.ax
+EOF
+fi
+
+# --- Standard project files ---
+
+for f in AUTHORS COPYING README; do
+       if [ ! -e "$f" ]; then
+               echo "Creating empty \"$f\" ..."
+               touch "$f"
+       fi
+done
+
+exit 0