Update materials for building rsync with mgear.
[mgear/mgear.git] / experiments / if-two-commands.mk
CommitLineData
00804b7c
MM
1# Make expands the command script as a whole before splitting it into lines
2# and executing each line.
3
4define mm-gen-commands
5exec 3>$@.tmp && echo $(call sq,$(call fmt-make-assignment,cmd-$(target),$(cmd))) >&3 && set -o pipefail && { ($(cmd)) 2>&1 | sed -re '1s/^/errors-$$(target):=$$(empty)/; 1!s/^/errors-$$(target)+=$$(nl)/' >&3; xc=$$?; } && { [ $xc == 0 ] || echo "exitcode-$(target):=$$xc" >&3 } && if [ $xc != 0 ] || cmp -s $(target) $(target).tmp; then mv -f $@.tmp $@; else rm -f $(target) && mv -f $@.tmp $@ && mv -f $(target).tmp $(target); fi
6echo bar
7endef
8
9phooey:
10 $(if x,$(mm-gen-commands),)
11 $(eval include $@)