More Mac tweaks.

This commit is contained in:
rsc 2004-03-02 17:34:15 +00:00
parent 53dbac9485
commit 8f314994db
12 changed files with 101 additions and 49 deletions

View file

@ -9,5 +9,5 @@ mk clean
mk install mk install
echo "Set PLAN9=$PLAN9 in your profile environment." echo "Set PLAN9=$PLAN9 in your profile environment."
echo 'Add $PLAN9/bin to your profile PATH.' echo 'Add $PLAN9/bin to your PATH.'

9
bin/9c
View file

@ -3,10 +3,9 @@
usegcc() usegcc()
{ {
cc=gcc cc=gcc
cflags=" \ ngflags=" \
-O2 \ -O2 \
-c \ -c \
-ggdb \
-Wall \ -Wall \
-Wno-parentheses \ -Wno-parentheses \
-Wno-missing-braces \ -Wno-missing-braces \
@ -14,14 +13,14 @@ usegcc()
-Wno-comment \ -Wno-comment \
-Wno-sign-compare \ -Wno-sign-compare \
" "
cflags="$cflags -ggdb"
} }
tag="`uname`-`uname -m`-${CC9:-cc}" tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
case "$tag" in case "$tag" in
*BSD*) usegcc ;; *BSD*) usegcc ;;
*Darwin*) 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" ;; *HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
*Linux*) usegcc ;; *Linux*) usegcc ;;
*OSF1*) cc=cc; cflags="-g -O -c" ;; *OSF1*) cc=cc; cflags="-g -O -c" ;;

2
bin/9l
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
extralibs=-lm extralibs=-lm
tag="`uname`-`uname -m`" tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
case "$tag" in case "$tag" in
*FreeBSD*) ld=gcc ;; *FreeBSD*) ld=gcc ;;
*BSD*) ld=gcc ;; *BSD*) ld=gcc ;;

View file

@ -1,4 +1,6 @@
../bin/mk: mkmk.sh ../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; \ PATH=`pwd`/../bin:$$PATH export PATH; \
PLAN9=`pwd`/.. export PLAN9; \ PLAN9=`pwd`/.. export PLAN9; \
sh -x mkmk.sh sh -x mkmk.sh

View file

@ -226,6 +226,7 @@ main(int argc, char **argv)
if(uflag) if(uflag)
prusage(); prusage();
exits(0); exits(0);
return 0;
} }
void void

View file

@ -1,38 +1,4 @@
#include <utf.h> #include "sys.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
#undef assert #undef assert
#define assert mkassert #define assert mkassert

View file

@ -2,6 +2,8 @@
static char *vexpand(char*, Envy*, Bufblock*); static char *vexpand(char*, Envy*, Bufblock*);
#define getfields mkgetfields
static int static int
getfields(char *str, char **args, int max, int mflag, char *set) getfields(char *str, char **args, int max, int mflag, char *set)
{ {

View file

@ -1,3 +1,4 @@
#define NOPLAN9DEFINES
#include "mk.h" #include "mk.h"
#include <sys/wait.h> #include <sys/wait.h>
#include <signal.h> #include <signal.h>

View file

@ -34,7 +34,7 @@ sendfd(int s, int fd)
sfd.cmsg.cmsg_type = SCM_RIGHTS; sfd.cmsg.cmsg_type = SCM_RIGHTS;
sfd.fd = fd; sfd.fd = fd;
msg.msg_control = &sfd; msg.msg_control = (caddr_t)&sfd;
msg.msg_controllen = sizeof sfd; msg.msg_controllen = sizeof sfd;
if((n=sendmsg(s, &msg, 0)) != iov.iov_len) 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_level = SOL_SOCKET;
sfd.cmsg.cmsg_type = SCM_RIGHTS; sfd.cmsg.cmsg_type = SCM_RIGHTS;
msg.msg_control = &sfd; msg.msg_control = (caddr_t)&sfd;
msg.msg_controllen = sizeof sfd; msg.msg_controllen = sizeof sfd;
if((n=recvmsg(s, &msg, 0)) < 0) if((n=recvmsg(s, &msg, 0)) < 0)

View file

@ -1,3 +1,5 @@
<mkhdr
DIRS=\ DIRS=\
lib9\ lib9\
libbin\ libbin\
@ -27,7 +29,7 @@ MKDIRS=\
mkmk.sh:VD: mkmk.sh:VD:
( (
echo cd lib9 echo cd lib9
(cd lib9; mk -n -a 'LIB9OFILES=' install) (cd lib9; mk -n -a install)
echo cd .. echo cd ..
for i in libbio libregexp cmd/mk for i in libbio libregexp cmd/mk
do do
@ -35,7 +37,7 @@ mkmk.sh:VD:
(cd $i; mk -n -a install) (cd $i; mk -n -a install)
echo cd .. echo cd ..
done done
) >$target ) | sed 's/'$SYSNAME'/$SYSNAME/; s/'$OBJTYPE'/$OBJTYPE/' >$target
testmkmk:V: testmkmk:V:
mk mkmk.sh mk mkmk.sh

View file

@ -1,6 +1,81 @@
cd lib9 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/dofmt.c
9c -Ifmt fmt/errfmt.c
9c -Ifmt fmt/fltfmt.c 9c -Ifmt fmt/fltfmt.c
9c -Ifmt fmt/fmt.c 9c -Ifmt fmt/fmt.c
9c -Ifmt fmt/fmtfd.c 9c -Ifmt fmt/fmtfd.c
@ -53,7 +128,7 @@ cd lib9
9c utf/utfrrune.c 9c utf/utfrrune.c
9c utf/utfrune.c 9c utf/utfrune.c
9c utf/utfutf.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 ..
cd libbio cd libbio
9c bbuffered.c 9c bbuffered.c
@ -109,6 +184,6 @@ cd cmd/mk
9c varsub.c 9c varsub.c
9c word.c 9c word.c
9c unix.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 install -c o.mk ../../../bin/mk
cd .. cd ..

View file

@ -6,6 +6,7 @@ TARG=\
Makefile\ Makefile\
mk.1\ mk.1\
mk.h\ mk.h\
sys.h\
fns.h\ fns.h\
`{ls -p $PLAN9/src/cmd/mk/*.c}\ `{ls -p $PLAN9/src/cmd/mk/*.c}\
@ -37,3 +38,6 @@ README: ../README
NOTICE: ../NOTICE.mk NOTICE: ../NOTICE.mk
cp $prereq $target cp $prereq $target
sys.h: $PLAN9/src/cmd/mk/sys.h.std
cp $prereq $target