aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-23 18:10:54 +0000
committerrsc <devnull@localhost>2003-11-23 18:10:54 +0000
commit5c34ff9e1c19fd73ccc79c0f702f7c4b964840d1 (patch)
tree808a906913b9b82866dd9c9bf62434ecca5fe55d
parentbc7cb1a15a67c859c8c71c4b52bb35fe9425a63d (diff)
downloadplan9port-5c34ff9e1c19fd73ccc79c0f702f7c4b964840d1.tar.gz
plan9port-5c34ff9e1c19fd73ccc79c0f702f7c4b964840d1.tar.bz2
plan9port-5c34ff9e1c19fd73ccc79c0f702f7c4b964840d1.zip
make -> mk
-rw-r--r--src/make2mk8
-rw-r--r--src/mk2make7
-rw-r--r--src/mkcommon21
-rw-r--r--src/mkdirs11
-rw-r--r--src/mkfile53
-rw-r--r--src/mkhdr21
-rw-r--r--src/mkmany73
-rw-r--r--src/mkmk.sh116
-rw-r--r--src/mkone44
-rw-r--r--src/mksyslib11
10 files changed, 365 insertions, 0 deletions
diff --git a/src/make2mk b/src/make2mk
new file mode 100644
index 00000000..213cd085
--- /dev/null
+++ b/src/make2mk
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+sed -E '
+ s/\$\(([^)]+)\)/$\1/g
+ s/^(.*)\+=/\1=$\1 /g
+ s/^include /</g
+ /^</ s/Make/mk/g
+' "$@"
diff --git a/src/mk2make b/src/mk2make
new file mode 100644
index 00000000..3ae1ab46
--- /dev/null
+++ b/src/mk2make
@@ -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
+' "$@"
diff --git a/src/mkcommon b/src/mkcommon
new file mode 100644
index 00000000..506cd438
--- /dev/null
+++ b/src/mkcommon
@@ -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
diff --git a/src/mkdirs b/src/mkdirs
new file mode 100644
index 00000000..f1be2ed9
--- /dev/null
+++ b/src/mkdirs
@@ -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
+
diff --git a/src/mkfile b/src/mkfile
new file mode 100644
index 00000000..6740a002
--- /dev/null
+++ b/src/mkfile
@@ -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
+
diff --git a/src/mkhdr b/src/mkhdr
new file mode 100644
index 00000000..2cc8d973
--- /dev/null
+++ b/src/mkhdr
@@ -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
diff --git a/src/mkmany b/src/mkmany
new file mode 100644
index 00000000..5b254dbf
--- /dev/null
+++ b/src/mkmany
@@ -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
diff --git a/src/mkmk.sh b/src/mkmk.sh
new file mode 100644
index 00000000..4cf96921
--- /dev/null
+++ b/src/mkmk.sh
@@ -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 ..
diff --git a/src/mkone b/src/mkone
new file mode 100644
index 00000000..316bca93
--- /dev/null
+++ b/src/mkone
@@ -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
diff --git a/src/mksyslib b/src/mksyslib
new file mode 100644
index 00000000..9f0b5df6
--- /dev/null
+++ b/src/mksyslib
@@ -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