Last change
on this file since 654 was
483,
checked in by rybkin, 16 years ago
|
See C.L. 378
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | |
---|
2 | usage () |
---|
3 | { |
---|
4 | echo "Usage: cmt_format_deps.sh [-no_stamps] DEP OBJ SRC DEPENDENCIES" |
---|
5 | echo "Create DEP [and its STAMP] containing Make rule with target DEP OBJ" |
---|
6 | echo "and prerequisites [STAMP] SRC SRC-DEPENDENCIES... based on DEPENDENCIES." |
---|
7 | } |
---|
8 | |
---|
9 | : ${CMTMSGPREFIX:=$0:} |
---|
10 | |
---|
11 | if [ "${makecmd}" ]; then |
---|
12 | [ "${cmtmsg}" ] && echo "${CMTMSGPREFIX}" "($0)" |
---|
13 | set -x |
---|
14 | fi |
---|
15 | |
---|
16 | if [ "$1" = "-no_stamps" ]; then |
---|
17 | no_stamps=yes |
---|
18 | shift |
---|
19 | fi |
---|
20 | [ $# -eq 4 ] || { usage; exit 2; } |
---|
21 | |
---|
22 | if [ "${no_stamps}" ]; then |
---|
23 | \rm -f ${1} || exit |
---|
24 | sed '1s#^[^:]*[:]\{1,2\}#'$1' '$2' : #' $4 >${1} || exit |
---|
25 | else |
---|
26 | # the stamp file records the last change of the dependencies, |
---|
27 | # i.e., the contents of ${1}, while the last modification time of ${1} |
---|
28 | # changes every time the dependencies are calculated |
---|
29 | stamp=${1}.stamp |
---|
30 | tmp=${1}.tmp |
---|
31 | \rm -f ${tmp} || exit |
---|
32 | sed '1s#^[^:]*[:]\{1,2\}#'$1' '$2' : '${stamp}' #' $4 >${tmp} || exit |
---|
33 | |
---|
34 | if [ -f "${1}" ] && cmp -s ${1} ${tmp}; then |
---|
35 | [ -f ${stamp} ] || touch ${stamp} |
---|
36 | \rm -f ${tmp} || exit |
---|
37 | else |
---|
38 | touch ${stamp} |
---|
39 | \mv -f ${tmp} ${1} || exit |
---|
40 | fi |
---|
41 | touch ${1} |
---|
42 | fi |
---|
43 | |
---|
44 | if [ "${makecmd}" ]; then set +x; fi |
---|
Note: See
TracBrowser
for help on using the repository browser.