axify: Correctly install Makefile.ax if it doesn't exist
authorAlexander Barton <alex@barton.de>
Mon, 1 Sep 2014 21:54:38 +0000 (23:54 +0200)
committerAlexander Barton <alex@barton.de>
Mon, 1 Sep 2014 22:01:35 +0000 (00:01 +0200)
scripts/axify

index b40d9182ea2ed02561613c4827e7451f84726715..ec3d593c84764e3891a572d4aab13199967cbd37 100755 (executable)
@@ -26,11 +26,13 @@ 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
+
+target="$LIB_D/`basename "$MAKEFILE_AX"`"
+if [ ! -e "$target" -o "$MAKEFILE_AX" -nt "$target" ]; then
+       echo "Updating \"$target\" ..."
+       cp -v "$MAKEFILE_AX" "$target" || exit 1
 else
-       echo "Makefile \"$LIB_D/`basename "$MAKEFILE_AX"`\" is up to date."
+       echo "Makefile \"$target\" is up to date."
 fi
 
 # -- Project Makefile's ---