#!/bin/sh # Needs sysutils/watchman, textproc/jq set -e BUILD_OBJ=/usr/home/mat/work/freebsd/doc-obj watchman watch ${PWD} > /dev/null # Subscribe to changes in $PWD, don't care about anything it returns, # so trim the fields. search='[ "subscribe", "'${PWD}'", "doc2-'$$'", { "expression": [ "allof", [ "type", "f" ], [ "not", [ "match", ".git/*", "wholename" ] ] ], "fields": [ "name" ] } ]' # First two lines are ignored echo "$search" | stdbuf -o L watchman -j -p --no-pretty | stdbuf -o L sed -u '1d;2d' | while read foo do [ -x run-this.sh ] && ./run-this.sh && chmod -x run-this.sh for i in `git diff-index --name-only trunk -- *_*|cut -d / -f 1,2,3|sort -u` do ( cd $i current_branch=$(git rev-parse --abbrev-ref HEAD) export WRKDIRPREFIX=${BUILD_OBJ}/${current_branch} export MAKEOBJDIRPREFIX=${WRKDIRPREFIX}/obj make obj && make objlink && make -k "$@" || : echo $foo|jq '.files[]' echo -n "BUILT $i at " LANG=C date ) done done