| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | MYDIR="$( cd "$( dirnamescip-shell system . . dirname. "${BASH_SOURCE[0]}" )" && pwdscip-shell system . . pwd. )" |
| 4 | pushd "$MYDIR" 1>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 5 | |
| 6 | ROOT_DIR="$(gitscip-shell system . . git. rev-parse --show-toplevel)" |
| 7 | cd "$ROOT_DIR" |
| 8 | |
| 9 | FILES="$(gitscip-shell system . . git. grep --name-only "Bedrock\.")" |
| 10 | |
| 11 | COQLIB="$(${COQBIN}coqc -config | grepscip-shell system . . grep. 'COQLIB=' | sedscip-shell system . . sed. s'/^COQLIB=//g')" |
| 12 | |
| 13 | MYCOQPATH="$COQPATH${COQPATH:+:}$COQLIB" |
| 14 | |
| 15 | echoscip-shell system . . echo. "My COQPATH is $MYCOQPATH" |
| 16 | |
| 17 | for VFILE in $FILES; do |
| 18 | if [scip-shell system . . `[`. ! -e "$VFILE" ]; then |
| 19 | echoscip-shell system . . echo. "Could not find $VFILE" |
| 20 | continue |
| 21 | elif [scip-shell system . . `[`. ! -e "${VFILE}o" ]; then |
| 22 | echoscip-shell system . . echo. "Already going to rebuild ${VFILE}o" |
| 23 | continue |
| 24 | fi |
| 25 | |
| 26 | VOFILES="$(grepscip-shell system . . grep. -o "Bedrock\.[^ ]*" "$VFILE" | sedscip-shell system . . sed. s'/\.$//g' | sedscip-shell system . . sed. s'|\.|/|g' | sedscip-shell system . . sed. s'/$/.vo/g' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq.)" |
| 27 | for VOFILE in $VOFILES; do |
| 28 | if [scip-shell system . . `[`. ! -e "${VFILE}o" ]; then # we already got rid of it |
| 29 | break |
| 30 | fi |
| 31 | FOUND="" |
| 32 | ( IFS=: |
| 33 | for DIR in $MYCOQPATH; do |
| 34 | if [scip-shell system . . `[`. -e "$DIR/$VOFILE" ]; then |
| 35 | FOUND=1 |
| 36 | if [scip-shell system . . `[`. "$DIR/$VOFILE" -nt "${VFILE}o" ]; then |
| 37 | echoscip-shell system . . echo. "Now going to rebuild ${VFILE}o; $DIR/$VOFILE is newer" |
| 38 | rmscip-shell system . . rm. -f "${VFILE}o" |
| 39 | else |
| 40 | echoscip-shell system . . echo. "Not necessarily rebuilding ${VFILE}o; $DIR/$VOFILE is older" |
| 41 | fi |
| 42 | break |
| 43 | fi |
| 44 | done |
| 45 | if [scip-shell system . . `[`. -z "$FOUND" ]; then |
| 46 | echoscip-shell system . . echo. "WARNING: Could not find $VOFILE, which $VFILE depends on" |
| 47 | fi |
| 48 | ) |
| 49 | done |
| 50 | done |
| 51 | |
| 52 | popd 1>/dev/nullscip-shell filesystem . . `/dev/null`. |