2011-03-30 12:46:40 +00:00
|
|
|
</$objtype/mkfile
|
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
YTARG=`{ls | sed -n '/\.y$/s/\.y$//p'}
|
|
|
|
TARG=$YTARG `{ls | sed -n '/^cp\.c$/d; /^yacc\.c$/d; /\.c$/s/\.c$//p'}
|
2011-03-30 12:46:40 +00:00
|
|
|
HFILES=/$objtype/include/u.h /sys/include/libc.h /sys/include/bio.h
|
2021-08-28 13:15:02 +00:00
|
|
|
|
2011-03-30 12:46:40 +00:00
|
|
|
BIN=/$objtype/bin
|
|
|
|
LDFLAGS=
|
|
|
|
YFLAGS=-d
|
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
PCONLY=vmx
|
|
|
|
POWERLESS=dtracy # until someone fixes the build for power
|
|
|
|
NOMK=`{~ $objtype (386 amd64) || echo $PCONLY} `{~ $objtype power && echo $POWERLESS}
|
|
|
|
DIRS=`{echo */mkfile | sed 's,/mkfile *,\n,g' | grep -v '-e^'^('' $NOMK)^'$'}
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
usage:VQ:
|
|
|
|
echo 'usage: mk all, all.cpus, cmds, $O.$cmd'
|
|
|
|
echo ' install, install.cpus, $cmd.install, $cmd.install.cpus'
|
|
|
|
echo ' clean, nuke'
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.c %.tab.h:D: %.y
|
|
|
|
yacc $YFLAGS -o $stem.c -s $stem $stem.y
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.$O: $HFILES
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.$O: %.c
|
|
|
|
$CC $CFLAGS $stem.c
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
$O.%: %.$O
|
|
|
|
$LD $LDFLAGS -o $target $stem.$O
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
$BIN/%: $O.%
|
|
|
|
cp $O.$stem $target
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
$BIN/cp: $O.cp
|
|
|
|
`{if(~ $objtype $cputype) echo ./$O.cp; if not echo cp} $prereq $target
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
$BIN/init: $O.init # hack, install location is not target
|
|
|
|
cp $O.init /$objtype/init
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.acid: %.c $HFILES
|
|
|
|
$CC $CFLAGS -a $stem.c >$target
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.cpus:V:
|
|
|
|
for(objtype in $CPUS) mk $MKFLAGS $stem
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.dirs:V:
|
2011-03-30 12:46:40 +00:00
|
|
|
for(i in $DIRS) @{
|
|
|
|
cd $i
|
|
|
|
echo mk $i
|
|
|
|
mk $MKFLAGS $stem
|
|
|
|
}
|
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
cmds:V: $O.cp $O.yacc ${TARG:%=$O.%}
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
all:V: cmds
|
|
|
|
mk $MKFLAGS all.dirs
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
%.install:V: $BIN/%
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
install:V: cp.install
|
|
|
|
mk $MKFLAGS yacc.install
|
2011-03-30 12:46:40 +00:00
|
|
|
mk $MKFLAGS $TARG.install
|
2021-08-28 13:15:02 +00:00
|
|
|
mk $MKFLAGS install.dirs
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
installall:V: install.cpus
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
cleancmds:V:
|
|
|
|
rm -f *.[$OS] [$OS].* y.tab.? y.debug y.output $YTARG.c *.tab.h
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
clean:V: cleancmds clean.dirs
|
2011-03-30 12:46:40 +00:00
|
|
|
|
2021-08-28 13:15:02 +00:00
|
|
|
nuke:V: cleancmds nuke.dirs
|
|
|
|
rm -f *.acid
|