Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/mk/mkconv

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

x=/tmp/mk$pid

fn sigexit { rm -f $x }
fn sigint { rm -f $x }

tee $x < $1 | sed -e 's/\$\(([^)]*)\)([        :\/])/$\1\2/g
	s/\$\(([^)]*)\)$/$\1/g
	s/\$\(([^)]*)\)/${\1}/g
	s/^     @/  /
	/^	-/,/[^\\]$/{
		/[^\\]\$/s/$/; set -e/
	}
	/^	-/s/	-/	set +e; /
	s/:\&/:/
	s/\$% /$stem /g
	s/\$%\./$stem\./g
	s/\$%/${stem}/g
	s/\$@([ 	]|$)/$target\1/g
	s/\$@/${target}/g
	s/\$\^/${prereq}/g
	s/\$\?/$newprereq/g'

if(grep -s 'cd[ 	]|make' < $x){
	{
		echo 'Warning: recipes containing cd or make need attention.'
		grep 'cd[ 	]|make' < $x
	} >[1=2]
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.