source: trunk/build_support/move-if-change @ 795

Last change on this file since 795 was 795, checked in by Peter Johansson, 14 years ago

refs #388

Create a sub-directory 'lib/yat' in which files from yat are
placed. The files may be updated via 'make fetch', see file README for
more details on how to change which files are updated/copied through
this mechanism.

The reason we do not use subversion's external mechanism is that we
don't want the files to be synchronised with yat automatically. We
want the update to be moderated by some developer.

I chose to fetch files using the svn client rather than wget because
the svn allows us to get an Id string with information from the yat
repository. 'wget' would just download the file as it appears on the
server that is the string is not expanded.

The file 'config_public.h' is created by configure just as in
yat. This implies that automake adds $(top_builddir)/lib/yat to the
include path so unless in a VPATH build $(top_srcdir)/lib/yat is in
the include path. As we have already added $(top_srcdir)/lib to the
include path, and there are both a lib/utility.h and a
lib/yat/utility.h it is not obvious which file is included when having
'include "utility.h"'. For this reason, when being in bin/ and test/
it is needed to include "../lib/utility.h" rather than "utility.h"
when we want to include 'lib/utility.h'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 513 bytes
Line 
1#!/bin/sh
2# Like mv $1 $2, but if the files are the same, just delete $1.
3# Status is zero if successful, nonzero otherwise.
4
5usage="$0: usage: $0 [-v] SOURCE DEST"
6
7if test "x$1" = "x-v"; then
8  verbose=yes
9  shift
10fi
11
12case $# in
132) ;;
14*) echo "$usage" >&2; exit 1;;
15esac
16
17for arg in "$1" "$2"; do
18  case $arg in
19   -*) echo "$usage" >&2; exit 1;;
20  esac
21done
22
23if test -r "$2" && cmp -s "$1" "$2"; then
24  rm -f "$1"
25else
26  if test "x$verbose" = "xyes"; then
27    echo "updating file $2"
28  fi
29  mv -f "$1" "$2"
30fi
Note: See TracBrowser for help on using the repository browser.