aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xINSTALL2
-rwxr-xr-xbin/9c9
-rwxr-xr-xbin/9l2
-rw-r--r--src/Makefile2
-rw-r--r--src/cmd/mk/main.c1
-rw-r--r--src/cmd/mk/mk.h36
-rw-r--r--src/cmd/mk/shprint.c2
-rw-r--r--src/cmd/mk/unix.c1
-rw-r--r--src/lib9/sendfd.c4
-rw-r--r--src/mkfile6
-rw-r--r--src/mkmk.sh81
-rw-r--r--unix/mkfile.mk4
12 files changed, 101 insertions, 49 deletions
diff --git a/INSTALL b/INSTALL
index 5032c809..787920bc 100755
--- a/INSTALL
+++ b/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.'
diff --git a/bin/9c b/bin/9c
index 871e6f66..beba6064 100755
--- a/bin/9c
+++ b/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" ;;
diff --git a/bin/9l b/bin/9l
index 19be47ed..e510e4d6 100755
--- a/bin/9l
+++ b/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 ;;
diff --git a/src/Makefile b/src/Makefile
index 1c8010d4..7fe300ba 100644
--- a/src/Makefile
+++ b/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
diff --git a/src/cmd/mk/main.c b/src/cmd/mk/main.c
index 267ed73f..fdd94777 100644
--- a/src/cmd/mk/main.c
+++ b/src/cmd/mk/main.c
@@ -226,6 +226,7 @@ main(int argc, char **argv)
if(uflag)
prusage();
exits(0);
+ return 0;
}
void
diff --git a/src/cmd/mk/mk.h b/src/cmd/mk/mk.h
index 9b3f627d..33402de0 100644
--- a/src/cmd/mk/mk.h
+++ b/src/cmd/mk/mk.h
@@ -1,38 +1,4 @@
-#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>
-
-#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
+#include "sys.h"
#undef assert
#define assert mkassert
diff --git a/src/cmd/mk/shprint.c b/src/cmd/mk/shprint.c
index 9e15bcef..7cfa5f4c 100644
--- a/src/cmd/mk/shprint.c
+++ b/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)
{
diff --git a/src/cmd/mk/unix.c b/src/cmd/mk/unix.c
index 60222788..8b7e9cb8 100644
--- a/src/cmd/mk/unix.c
+++ b/src/cmd/mk/unix.c
@@ -1,3 +1,4 @@
+#define NOPLAN9DEFINES
#include "mk.h"
#include <sys/wait.h>
#include <signal.h>
diff --git a/src/lib9/sendfd.c b/src/lib9/sendfd.c
index b3a2448f..4c4aa7f0 100644
--- a/src/lib9/sendfd.c
+++ b/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)
diff --git a/src/mkfile b/src/mkfile
index 18577d6a..296978c0 100644
--- a/src/mkfile
+++ b/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
diff --git a/src/mkmk.sh b/src/mkmk.sh
index 7710f69b..f1126c8d 100644
--- a/src/mkmk.sh
+++ b/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 ..
diff --git a/unix/mkfile.mk b/unix/mkfile.mk
index 6d650fe1..09d064d7 100644
--- a/unix/mkfile.mk
+++ b/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