Commit Diff


commit - 53dbac948575b07e95d184bbfbe4d8953c5ccc4c
commit + 8f314994dbcc11b2d8397535ce8b0cf9d84150d0
blob - 5032c80998e5b6059ba52b45ae37fceb47e05ff8
blob + 787920bcf6d8da4f81a7f47f07c137263ba4baae
--- INSTALL
+++ INSTALL
@@ -9,5 +9,5 @@ mk clean
 mk install
 
 echo "Set PLAN9=$PLAN9 in your profile environment."
-echo 'Add $PLAN9/bin to your profile PATH.'
+echo 'Add $PLAN9/bin to your PATH.'
 
blob - 871e6f66332b53d5a5c732f0393c9e6459d91ed0
blob + beba6064e5de103e04311a19c7ff8b633d49944e
--- bin/9c
+++ bin/9c
@@ -3,10 +3,9 @@
 usegcc()
 {
 	cc=gcc
-	cflags=" \
+	ngflags=" \
 		-O2 \
 		-c \
-		-ggdb \
 		-Wall \
 		-Wno-parentheses \
 		-Wno-missing-braces \
@@ -14,14 +13,14 @@ usegcc()
 		-Wno-comment \
 		-Wno-sign-compare \
 	"
+	cflags="$cflags -ggdb"
 }
 
-tag="`uname`-`uname -m`-${CC9:-cc}"
+tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
 case "$tag" in
 *BSD*)		usegcc ;;
 *Darwin*)	usegcc 
-	cflags=`echo $cflags|sed 's/-ggdb/-g3 -no-cpp-precomp/'`
-	;;
+		cflags="$ngflags -g3 -no-cpp-precomp" ;;
 *HP-UX*)	cc=cc; cflags="-g -O -c -Ae" ;;
 *Linux*)	usegcc ;;
 *OSF1*)		cc=cc; cflags="-g -O -c" ;;
blob - 19be47ed7f77408d25c9233b6359266ffd4eba14
blob + e510e4d649d747e0c1b92f08c3b8f26b37afcae5
--- bin/9l
+++ bin/9l
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 extralibs=-lm
-tag="`uname`-`uname -m`"
+tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
 case "$tag" in
 *FreeBSD*)	ld=gcc ;;
 *BSD*)		ld=gcc ;;
blob - 1c8010d4551db9862d509c1122c3d3a21de123d5
blob + 7fe300ba20af67fe6a064cd0a6e401d3f7986655
--- src/Makefile
+++ src/Makefile
@@ -1,4 +1,6 @@
 ../bin/mk: mkmk.sh
+	SYSNAME=`uname` export SYSNAME; \
+	OBJTYPE=`uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'` export OBJTYPE; \
 	PATH=`pwd`/../bin:$$PATH export PATH; \
 	PLAN9=`pwd`/.. export PLAN9; \
 	sh -x mkmk.sh
blob - 267ed73fba323edbebfc7e5d20581f253c84baac
blob + fdd947772d3a4f91b2d8fa9dda9eb40b3ae53c81
--- src/cmd/mk/main.c
+++ src/cmd/mk/main.c
@@ -226,6 +226,7 @@ main(int argc, char **argv)
 	if(uflag)
 		prusage();
 	exits(0);
+	return 0;
 }
 
 void
blob - 9b3f627d80ad310963b1d42d006bebabd3dccd45
blob + 33402de0a0c44a3fd027ea5f50d1ba22f65c4e29
--- src/cmd/mk/mk.h
+++ src/cmd/mk/mk.h
@@ -1,39 +1,5 @@
-#include <utf.h>
-#include <fmt.h>
-#include <setjmp.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include	<bio.h>
-#include	<regexp9.h>
-#include <time.h>
+#include "sys.h"
 
-#define uchar _mkuchar
-#define ushort _mkushort
-#define uint _mkuint
-#define ulong _mkulong
-#define vlong _mkvlong
-#define uvlong _mkuvlong
-
-#define nil ((void*)0)
-
-typedef unsigned char		uchar;
-typedef unsigned short		ushort;
-typedef unsigned int		uint;
-typedef unsigned long		ulong;
-
-#define nelem(x) (sizeof(x)/sizeof((x)[0]))
-
-#define OREAD O_RDONLY
-#define OWRITE O_WRONLY
-#define ORDWR O_RDWR
-#define USED(x) if(x);else
-#define remove unlink
-#define seek lseek
-#define exits(s) exit((s) && ((char*)s)[0] ? 1 : 0)
-#define create(name, mode, perm) creat(name, perm)
-#define ERRMAX 256
-
 #undef assert
 #define	assert	mkassert
 extern Biobuf bout;
blob - 9e15bcefb493b7d258493011878064b66200515e
blob + 7cfa5f4c17c229805c4d0f28743fa5a4a61ecad6
--- src/cmd/mk/shprint.c
+++ src/cmd/mk/shprint.c
@@ -2,6 +2,8 @@
 
 static char *vexpand(char*, Envy*, Bufblock*);
 
+#define getfields mkgetfields
+
 static int
 getfields(char *str, char **args, int max, int mflag, char *set)
 {
blob - 602227881a8993068fc2028e21ad29bdc29eed17
blob + 8b7e9cb860a077e58dd43e066b29fe7e3737741a
--- src/cmd/mk/unix.c
+++ src/cmd/mk/unix.c
@@ -1,3 +1,4 @@
+#define NOPLAN9DEFINES
 #include	"mk.h"
 #include	<sys/wait.h>
 #include	<signal.h>
blob - b3a2448ff895e19894227093fd5685d641f1a47a
blob + 4c4aa7f0f2c4d143b395a54dd037ebb4de5e9080
--- src/lib9/sendfd.c
+++ src/lib9/sendfd.c
@@ -34,7 +34,7 @@ sendfd(int s, int fd)
 	sfd.cmsg.cmsg_type = SCM_RIGHTS;
 	sfd.fd = fd;
 
-	msg.msg_control = &sfd;
+	msg.msg_control = (caddr_t)&sfd;
 	msg.msg_controllen = sizeof sfd;
 
 	if((n=sendmsg(s, &msg, 0)) != iov.iov_len)
@@ -66,7 +66,7 @@ recvfd(int s)
 	sfd.cmsg.cmsg_level = SOL_SOCKET;
 	sfd.cmsg.cmsg_type = SCM_RIGHTS;
 
-	msg.msg_control = &sfd;
+	msg.msg_control = (caddr_t)&sfd;
 	msg.msg_controllen = sizeof sfd;
 
 	if((n=recvmsg(s, &msg, 0)) < 0)
blob - 18577d6aba73520b22087bb7de9fae42d98d6c85
blob + 296978c017d110470d0b78dd07b88aa15f4b90b8
--- src/mkfile
+++ src/mkfile
@@ -1,3 +1,5 @@
+<mkhdr
+
 DIRS=\
 	lib9\
 	libbin\
@@ -27,7 +29,7 @@ MKDIRS=\
 mkmk.sh:VD:
 	(
 		echo cd lib9
-		(cd lib9; mk -n -a 'LIB9OFILES=' install)
+		(cd lib9; mk -n -a install)
 		echo cd ..
 		for i in libbio libregexp cmd/mk
 		do	
@@ -35,7 +37,7 @@ mkmk.sh:VD:
 			(cd $i; mk -n -a install)
 			echo cd ..
 		done
-	) >$target
+	) | sed 's/'$SYSNAME'/$SYSNAME/; s/'$OBJTYPE'/$OBJTYPE/' >$target
 
 testmkmk:V:
 	mk mkmk.sh
blob - 7710f69b030c3010879bbc5df108cf34456470ee
blob + f1126c8da7668315fe494bd7cbe6f0f03eb870d0
--- src/mkmk.sh
+++ src/mkmk.sh
@@ -1,6 +1,81 @@
 cd lib9
+9c  _exits.c
+9c  _p9dialparse.c
+9c  _p9dir.c
+9c  _p9proc.c
+9c  _p9translate.c
+9c  access.c
+9c  announce.c
+9c  argv0.c
+9c  atexit.c
+9c  atnotify.c
+9c  await.c
+9c  cistrcmp.c
+9c  cistrncmp.c
+9c  cistrstr.c
+9c  cleanname.c
+9c  convD2M.c
+9c  convM2D.c
+9c  convM2S.c
+9c  convS2M.c
+9c  create.c
+9c  ctime.c
+9c  date.c
+9c  dial.c
+9c  dirfstat.c
+9c  dirfwstat.c
+9c  dirmodefmt.c
+9c  dirread.c
+9c  dirstat.c
+9c  dirwstat.c
+9c  dup.c
+9c  encodefmt.c
+9c  errstr.c
+9c  exec.c
+9c  fcallfmt.c
+9c  ffork-$SYSNAME.c
+9a  getcallerpc-$OBJTYPE.s
+9c  getenv.c
+9c  getfields.c
+9c  getns.c
+9c  getuser.c
+9c  getwd.c
+9c  jmp.c
+9c  lock.c
+9c  main.c
+9c  malloc.c
+9c  malloctag.c
+9c  mallocz.c
+9c  nan.c
+9c  needsrcquote.c
+9c  netmkaddr.c
+9c  notify.c
+9c  nrand.c
+9c  nulldir.c
+9c  open.c
+9c  pipe.c
+9c  post9p.c
+9c  postnote.c
+9c  qlock.c
+9c  quote.c
+9c  read9pmsg.c
+9c  readn.c
+9c  rendez-$SYSNAME.c
+9c  rfork.c
+9c  seek.c
+9c  sendfd.c
+9c  sleep.c
+9c  strecpy.c
+9c  sysfatal.c
+9c  tas-$OBJTYPE.c
+9c  time.c
+9c  tokenize.c
+9c  u16.c
+9c  u32.c
+9c  u64.c
+9c  wait.c
+9c  waitpid.c
 9c  -Ifmt fmt/dofmt.c
-9c  -Ifmt fmt/errfmt.c
 9c  -Ifmt fmt/fltfmt.c
 9c  -Ifmt fmt/fmt.c
 9c  -Ifmt fmt/fmtfd.c
@@ -53,7 +128,7 @@ cd lib9
 9c  utf/utfrrune.c
 9c  utf/utfrune.c
 9c  utf/utfutf.c
-9ar rvc ../../lib/lib9.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 nan64.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 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
+9ar rvc ../../lib/lib9.a _exits.o _p9dialparse.o _p9dir.o _p9proc.o _p9translate.o access.o announce.o argv0.o atexit.o atnotify.o await.o cistrcmp.o cistrncmp.o cistrstr.o cleanname.o convD2M.o convM2D.o convM2S.o convS2M.o create.o ctime.o date.o dial.o dirfstat.o dirfwstat.o dirmodefmt.o dirread.o dirstat.o dirwstat.o dup.o encodefmt.o errstr.o exec.o fcallfmt.o ffork-$SYSNAME.o getcallerpc-$OBJTYPE.o getenv.o getfields.o getns.o getuser.o getwd.o jmp.o lock.o main.o malloc.o malloctag.o mallocz.o nan.o needsrcquote.o netmkaddr.o notify.o nrand.o nulldir.o open.o pipe.o post9p.o postnote.o qlock.o quote.o read9pmsg.o readn.o rendez-Darwin.o rfork.o seek.o sendfd.o sleep.o strecpy.o sysfatal.o tas-PowerMacintosh.o time.o tokenize.o u16.o u32.o u64.o wait.o waitpid.o dofmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o nan64.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 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 libbio
 9c  bbuffered.c
@@ -109,6 +184,6 @@ cd cmd/mk
 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 -lregexp9 -lbio -l9
+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 ../../../lib/libregexp9.a ../../../lib/libbio.a ../../../lib/lib9.a 
 install -c o.mk ../../../bin/mk
 cd ..
blob - 6d650fe1801d5035ed363caa8433abd8dccadbb4
blob + 09d064d7aaa7d75a7e513a0a5f76edcaf91c28e0
--- unix/mkfile.mk
+++ unix/mkfile.mk
@@ -6,6 +6,7 @@ TARG=\
 	Makefile\
 	mk.1\
 	mk.h\
+	sys.h\
 	fns.h\
 	`{ls -p $PLAN9/src/cmd/mk/*.c}\
 
@@ -37,3 +38,6 @@ README: ../README
 
 NOTICE: ../NOTICE.mk
 	cp $prereq $target
+
+sys.h: $PLAN9/src/cmd/mk/sys.h.std
+	cp $prereq $target