make -> mk

This commit is contained in:
rsc 2003-11-23 18:10:54 +00:00
parent bc7cb1a15a
commit 5c34ff9e1c
10 changed files with 365 additions and 0 deletions

8
src/make2mk Normal file
View file

@ -0,0 +1,8 @@
#!/bin/sh
sed -E '
s/\$\(([^)]+)\)/$\1/g
s/^(.*)\+=/\1=$\1 /g
s/^include /</g
/^</ s/Make/mk/g
' "$@"

7
src/mk2make Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh
sed -E '
s/\$([a-zA-Z0-9_][a-zA-Z0-9_]+)/$(\1)/g
s/^</include /
/^include / s/mk/Make/g
' "$@"

21
src/mkcommon Normal file
View file

@ -0,0 +1,21 @@
%.$O: $HFILES # don't combine with following %.$O rules
%.$O: %.c
$CC $CFLAGS $stem.c
%.$O: %.s
$AS $AFLAGS $stem.s
clean:V:
rm -f *.[$OS] [$OS].out $CLEANFILES
%.clean:V:
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
nuke:V:
rm -f *.[$OS] [$OS].out $CLEANFILES
Makefile:D: mkfile
rm -f Makefile
sh $PLAN9/src/mk2make mkfile >Makefile
chmod 444 Makefile

11
src/mkdirs Normal file
View file

@ -0,0 +1,11 @@
dir-%:V:
for i in $DIRS
do
(cd $i; mk $stem)
done
all:V: dir-all
clean:V: dir-clean
install:V: dir-install
nuke:V: dir-nuke

53
src/mkfile Normal file
View file

@ -0,0 +1,53 @@
DIRS=\
lib9\
libbin\
libbio\
libdraw\
libflate\
libfmt\
libframe\
libhttpd\
libip\
libregexp\
libsec\
libthread\
libutf\
libventi\
# cmd\
<mkdirs
MKDIRS=\
libutf\
libfmt\
libbio\
libregexp\
cmd/mk\
mkmk.sh:VD:
(
for i in $MKDIRS
do
echo cd $i
(cd $i; mk -n -a install)
echo cd ..
done
) >$target
testmkmk:V:
mk mkmk.sh
rm -f ../lib/lib*.a
mv ../bin/mk ../bin/_mk
sh -ex mkmk.sh
ls -l ../bin/mk
testcvs:V:
cvs up -dAP
cp ../bin/_mk ../bin/mk
mk clean
rm ../lib/*.a
mv ../bin/mk ../bin/_mk
rm ../bin/*
PLAN9="`pwd`/.." export PLAN9
PATH=$PLAN9/bin:$PATH export PATH

21
src/mkhdr Normal file
View file

@ -0,0 +1,21 @@
SYSNAME=`uname`
OBJTYPE=`uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'`
X11=/usr/X11R6
LDFLAGS=
CFLAGS=
AFLAGS=
BIN=$PLAN9/bin
LIBDIR=$PLAN9/lib
<|sed -E '"s/(.*)\+=/\1=$\1 /g"' $PLAN9/src/Make.$SYSNAME-$OBJTYPE
OS=$O
LD=9l
LDFLAGS=$LDFLAGS -L$LIBDIR
CLEANFILES=*.$O
NUKEFILES=
INSTALL=install -c

73
src/mkmany Normal file
View file

@ -0,0 +1,73 @@
PROGS=${TARG:%=$O.%}
none:VQ:
echo usage: mk all, install, installall, '$O'.cmd, cmd.install, or cmd.installall
all:V: $PROGS
$O.%: %.$O $OFILES $LIB
$LD -o $target $prereq $LDFLAGS
%.$O: $HFILES # don't combine with following %.$O rules
%.$O: %.c
$CC $CFLAGS $stem.c
%.$O: %.s
$AS $AFLAGS $stem.s
y.tab.h y.tab.c: $YFILES
$YACC $YFLAGS $prereq
%.install:V: $BIN/%
$BIN/%: $O.%
$INSTALL $O.$stem $BIN/$stem
%.installall:V:
for (objtype in $CPUS)
mk $stem.install
install:V:
# for (i in $TARG)
# mk $MKFLAGS $i.install
for i in $TARG
do
mk $MKFLAGS $i.install
done
installall:V:
for(objtype in $CPUS)
mk $MKFLAGS install
%.safeinstall:V:
mk $O.$stem
test -e $BIN/$stem && mv $BIN/$stem $BIN/_$stem
mk $stem.install
%.safeinstallall:V:
for(objtype in $CPUS)
mk $MKFLAGS $stem.safeinstall
safeinstall:V:
for(i in $TARG)
mk $MKFLAGS $i.safeinstall
safeinstallall:V:
for (objtype in $CPUS)
mk safeinstall
update:V:
update $UPDATEFLAGS $UPDATE
nuke:V:
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* *.acid $TARG $NUKEFILES
clean:V:
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* $TARG $CLEANFILES
%.clean:V:
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
%.acid: %.$O $HFILES
$CC $CFLAGS -a $stem.c >$target

116
src/mkmk.sh Normal file
View file

@ -0,0 +1,116 @@
cd libutf
9c rune.c
9c runestrcat.c
9c runestrchr.c
9c runestrcmp.c
9c runestrcpy.c
9c runestrdup.c
9c runestrlen.c
9c runestrecpy.c
9c runestrncat.c
9c runestrncmp.c
9c runestrncpy.c
9c runestrrchr.c
9c runestrstr.c
9c runetype.c
9c utfecpy.c
9c utflen.c
9c utfnlen.c
9c utfrrune.c
9c utfrune.c
9c utfutf.c
ar rvc ../../lib/libutf.a rune.o runestrcat.o runestrchr.o runestrcmp.o runestrcpy.o runestrdup.o runestrlen.o runestrecpy.o runestrncat.o runestrncmp.o runestrncpy.o runestrrchr.o runestrstr.o runetype.o utfecpy.o utflen.o utfnlen.o utfrrune.o utfrune.o utfutf.o
cd ..
cd libfmt
9c dofmt.c
9c errfmt.c
9c fltfmt.c
9c fmt.c
9c fmtfd.c
9c fmtfdflush.c
9c fmtlock.c
9c fmtprint.c
9c fmtquote.c
9c fmtrune.c
9c fmtstr.c
9c fmtvprint.c
9c fprint.c
9c print.c
9c runefmtstr.c
9c runeseprint.c
9c runesmprint.c
9c runesnprint.c
9c runesprint.c
9c runevseprint.c
9c runevsmprint.c
9c runevsnprint.c
9c seprint.c
9c smprint.c
9c snprint.c
9c sprint.c
9c strtod.c
9c vfprint.c
9c vseprint.c
9c vsmprint.c
9c vsnprint.c
9c charstod.c
9c pow10.c
9c nan64.c
ar rvc ../../lib/libfmt.a dofmt.o errfmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o print.o runefmtstr.o runeseprint.o runesmprint.o runesnprint.o runesprint.o runevseprint.o runevsmprint.o runevsnprint.o seprint.o smprint.o snprint.o sprint.o strtod.o vfprint.o vseprint.o vsmprint.o vsnprint.o charstod.o pow10.o nan64.o
cd ..
cd libbio
9c bbuffered.c
9c bfildes.c
9c bflush.c
9c bgetc.c
9c bgetd.c
9c binit.c
9c boffset.c
9c bprint.c
9c bputc.c
9c brdline.c
9c brdstr.c
9c bread.c
9c bseek.c
9c bwrite.c
9c bgetrune.c
9c bputrune.c
ar rvc ../../lib/libbio.a bbuffered.o bfildes.o bflush.o bgetc.o bgetd.o binit.o boffset.o bprint.o bputc.o brdline.o brdstr.o bread.o bseek.o bwrite.o bgetrune.o bputrune.o
cd ..
cd libregexp
9c regcomp.c
9c regerror.c
9c regexec.c
9c regsub.c
9c regaux.c
9c rregaux.c
9c rregexec.c
9c rregsub.c
ar rvc ../../lib/libregexp9.a regcomp.o regerror.o regexec.o regsub.o regaux.o rregaux.o rregexec.o rregsub.o
cd ..
cd cmd/mk
9c arc.c
9c archive.c
9c bufblock.c
9c env.c
9c file.c
9c graph.c
9c job.c
9c lex.c
9c main.c
9c match.c
9c mk.c
9c parse.c
9c recipe.c
9c rule.c
9c run.c
9c sh.c
9c shprint.c
9c symtab.c
9c var.c
9c varsub.c
9c word.c
9c unix.c
9l -o o.mk arc.o archive.o bufblock.o env.o file.o graph.o job.o lex.o main.o match.o mk.o parse.o recipe.o rule.o run.o sh.o shprint.o symtab.o var.o varsub.o word.o unix.o -L../../../lib -lregexp9 -lbio -lfmt -lutf
install -c o.mk ../../../bin/mk
cd ..

44
src/mkone Normal file
View file

@ -0,0 +1,44 @@
PROG=$O.$TARG
all:V: $PROG
$O.$TARG: $OFILES $LIB
$LD -o $target $prereq $LDFLAGS
%.$O: $HFILES # don't combine with following %.$O rules
%.$O: %.c
$CC $CFLAGS $stem.c
%.$O: %.s
$AS $AFLAGS $stem.s
y.tab.h y.tab.c: $YFILES
$YACC $YFLAGS $prereq
%.install:V: $BIN/%
$BIN/%: $O.%
$INSTALL $O.$stem $BIN/$stem
%.installall:V:
for (objtype in $CPUS)
mk $stem.install
install:V: $TARG.install
installall:V:
for(objtype in $CPUS)
mk $MKFLAGS install
nuke:V:
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* *.acid $TARG $NUKEFILES
clean:V:
rm -f *.[$OS] y.tab.? y.debug y.output [$OS].* $TARG $CLEANFILES
%.clean:V:
rm -f $stem.[$OS] [$OS].$stem $stem.acid $stem
%.acid: %.$O $HFILES
$CC $CFLAGS -a $stem.c >$target

11
src/mksyslib Normal file
View file

@ -0,0 +1,11 @@
default:V: $PLAN9/lib/$LIB
$PLAN9/lib/$LIB:V: $OFILES # force archive even when not needed
ar rvc $PLAN9/lib/$LIB $newprereq
&:n: &.$O
ar rvc $LIB $stem.$O
all install:V: $PLAN9/lib/$LIB
<$PLAN9/src/mkcommon