commit f7012583e9a7594cbb5ebe8e974bb69061189262 from: rsc date: Tue Nov 25 01:40:27 2003 UTC Add the #goo to allow use in C++. Silence a few more warnings. Strip down the mkfiles more. Fix bug in X11 mouse handling, note groups. commit - dc13c29ed174fd15e0b025ca4fea8af71015067d commit + f7012583e9a7594cbb5ebe8e974bb69061189262 blob - 6b9f2bd422d97c72c1fc02ab385915e43b0aac01 blob + dc738f14ffac7ab90eea6050bac2fcd858e2b409 --- include/bin.h +++ include/bin.h @@ -1,3 +1,9 @@ +#ifndef _BIN_H_ +#define _BIN_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + /* #pragma lib "libbin.a" #pragma src "/sys/src/libbin" @@ -11,3 +17,8 @@ typedef struct Bin Bin; void *binalloc(Bin **, ulong size, int zero); void *bingrow(Bin **, void *op, ulong osize, ulong size, int zero); void binfree(Bin **); + +#if defined(__cplusplus) +} +#endif +#endif blob - 600f0948939a08905f275d40bebc91cb4db6a7f4 blob + 473389a750bee4963700659b89b3b5579270ef11 --- include/bio.h +++ include/bio.h @@ -1,5 +1,8 @@ -#ifndef _BIOH_ -#define _BIOH_ 1 +#ifndef _BIO_H_ +#define _BIO_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif #include /* for off_t */ #include /* for O_RDONLY, O_WRONLY */ @@ -78,4 +81,7 @@ char* Brdstr(Biobuf*, int, int); long Bgetrune(Biobuf*); int Bputrune(Biobuf*, long); +#if defined(__cplusplus) +} #endif +#endif blob - 105cd0eff35c958b0902dcb709204b40d9e85bc8 blob + d53baf81d840fdda6054baeb569183dfb8ba5113 --- include/cursor.h +++ include/cursor.h @@ -1,3 +1,9 @@ +#ifndef _CURSOR_H_ +#define _CURSOR_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Cursor Cursor; struct Cursor { @@ -5,3 +11,8 @@ struct Cursor uchar clr[2*16]; uchar set[2*16]; }; + +#if defined(__cplusplus) +} +#endif +#endif blob - 029f0aed6ed69f418900d5495e8e99cd31f6f57e blob + 54a566ac0e20202f8d9f840767eb4f2634520741 --- include/draw.h +++ include/draw.h @@ -1,3 +1,9 @@ +#ifndef _DRAW_H_ +#define _DRAW_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Cachefont Cachefont; typedef struct Cacheinfo Cacheinfo; typedef struct Cachesubf Cachesubf; @@ -531,3 +537,8 @@ void drawtopwindow(void); int _drawmsgread(Display*, void*, int); int _drawmsgwrite(Display*, void*, int); int _latin1(Rune*, int); + +#if defined(__cplusplus) +} +#endif +#endif blob - e74183d4efedcfd33146569a3ff2c28bf5523e66 blob + 56c1b1c3009a1fa48fa9e3bbcd60b3014867cf52 --- include/event.h +++ include/event.h @@ -1,3 +1,9 @@ +#ifndef _EVENT_H_ +#define _EVENT_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Event Event; typedef struct Menu Menu; @@ -61,3 +67,8 @@ extern Rectangle egetrect(int, Mouse*); extern void edrawgetrect(Rectangle, int); extern int ereadmouse(Mouse*); extern int eatomouse(Mouse*, char*, int); + +#if defined(__cplusplus) +} +#endif +#endif blob - 93f46d4cec7800e16040de8f6bf77531ba67075e blob + 20ffe3861d9174d0d3c00dbcb9ce9311e92e998e --- include/fcall.h +++ include/fcall.h @@ -1,3 +1,8 @@ +#ifndef _FCALL_H_ +#define _FCALL_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma src "/sys/src/libc/9sys" #pragma lib "libc.a" @@ -118,3 +123,7 @@ int read9pmsg(int, void*, uint); #pragma varargck type "M" ulong #pragma varargck type "D" Dir* */ +#if defined(__cplusplus) +} +#endif +#endif blob - 79c888c21dcf02a3f73bd8b009c6a65e0c297428 blob + bbd0b3d75a3c33c205d1be0bc5402dedd12916e3 --- include/flate.h +++ include/flate.h @@ -1,3 +1,8 @@ +#ifndef _FLATE_H_ +#define _FLATE_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma lib "libflate.a" #pragma src "/sys/src/libflate" @@ -39,3 +44,7 @@ ulong *mkcrctab(ulong); ulong blockcrc(ulong *tab, ulong crc, void *buf, int n); ulong adler32(ulong adler, void *buf, int n); +#if defined(__cplusplus) +} +#endif +#endif blob - c913e14a05887a86a8973cd7fff02f3cde9a100f blob + befea2e347dc0e8a5abfeafbfc5e904a4be5cefe --- include/fmt.h +++ include/fmt.h @@ -1,3 +1,8 @@ +#ifndef _FMT_H_ +#define _FMT_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* * The authors of this software are Rob Pike and Ken Thompson. @@ -13,14 +18,8 @@ * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. */ -#ifndef _FMTH_ -#define _FMTH_ 1 - #include - -#ifndef _UTFH_ #include -#endif typedef struct Fmt Fmt; struct Fmt{ @@ -97,4 +96,7 @@ extern int fmtstrcpy(Fmt*, char*); extern double fmtstrtod(const char *, char **); extern double fmtcharstod(int(*)(void*), void*); +#if defined(__cplusplus) +} #endif +#endif blob - 9b8194b726b72bc69995dffd0600cc342f41ccf5 blob + 47d808ca4b4081d0f5dc9951eb1c55258279de0e --- include/frame.h +++ include/frame.h @@ -1,3 +1,9 @@ +#ifndef _FRAME_H_ +#define _FRAME_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Frbox Frbox; typedef struct Frame Frame; @@ -83,3 +89,7 @@ void frinittick(Frame*); #define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune) #define NBYTE(b) strlen((char*)(b)->ptr) +#if defined(__cplusplus) +} +#endif +#endif blob - d75c580196f51eb7c0fe9d91a2b83bedb4e54abc blob + 03b48adc2444255c92e55b3bbd34a845c5b28737 --- include/httpd.h +++ include/httpd.h @@ -1,3 +1,8 @@ +#ifndef _HTTPD_H_ +#define _HTTPD_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma lib "libhttpd.a" #pragma src "/sys/src/libhttpd" @@ -278,3 +283,8 @@ int hxferenc(Hio*, int); #pragma varargck type "U" char* #pragma varargck type "H" char* */ + +#if defined(__cplusplus) +} +#endif +#endif blob - af82c9935f6485d5bf10c759a8d0fdb45a3f2644 blob + 6fbf3946df1ff54d45111da512463064c3e33c43 --- include/ip.h +++ include/ip.h @@ -1,3 +1,8 @@ +#ifndef _IP_H_ +#define _IP_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma src "/sys/src/libip" #pragma lib "libip.a" @@ -121,3 +126,7 @@ extern uchar IPallbits[IPaddrlen]; #define CLASS(p) ((*(uchar*)(p))>>6) +#if defined(__cplusplus) +} +#endif +#endif blob - a6d99bf6ae3e6493068236a86f34507074fbd9ea blob + 588600a7736e1fce001aab37ab7f7dcb7a7185e8 --- include/keyboard.h +++ include/keyboard.h @@ -1,3 +1,8 @@ +#ifndef _KEYBOARD_H_ +#define _KEYBOARD_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif typedef struct Keyboardctl Keyboardctl; struct Keyboardctl @@ -34,3 +39,8 @@ enum { Kshift= KF|0x16, Kctl= KF|0x17, }; + +#if defined(__cplusplus) +} +#endif +#endif blob - 8f15ce6ed8e47c76d83f54b204b3a22584aa891d blob + 21490e6518f49c0e75f69beee64accae4af1e6b4 --- include/lib9.h +++ include/lib9.h @@ -3,9 +3,8 @@ * fit into libutf or into libfmt, but is still missing from traditional * Unix C libraries. */ -#ifndef _LIB9H_ -#define _LIB9H_ 1 - +#ifndef _LIB9_H_ +#define _LIB9_H_ 1 #if defined(__cplusplus) extern "C" { #endif @@ -861,5 +860,4 @@ extern void __fixargv0(void); #if defined(__cplusplus) } #endif - -#endif /* _LIB9H_ */ +#endif /* _LIB9_H_ */ blob - 17b2b651b912b77e40e48a7b42b0b4b68469344c blob + e65b7f976d05d317a06b155e6f56f38078bf9732 --- include/libsec.h +++ include/libsec.h @@ -1,3 +1,8 @@ +#ifndef _LIBSEC_H_ +#define _LIBSEC_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma lib "libsec.a" #pragma src "/sys/src/libsec" @@ -338,3 +343,8 @@ extern int okThumbprint(uchar *sha1, Thumbprint *ok); // readcert.c extern uchar *readcert(char *filename, int *pcertlen); + +#if defined(__cplusplus) +} +#endif +#endif blob - 2d4f54f5aba0a3c2f1f93aeb8ed607b9cb35a678 blob + 93f34a0a0d206f414f9577cba36e6236ffb34bee --- include/memdraw.h +++ include/memdraw.h @@ -1,3 +1,8 @@ +#ifndef _MEMDRAW_H_ +#define _MEMDRAW_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif typedef struct Memimage Memimage; typedef struct Memdata Memdata; typedef struct Memsubfont Memsubfont; @@ -208,3 +213,8 @@ extern Memdrawparam* _memimagedrawsetup(Memimage*, Point, int); extern void _memimagedraw(Memdrawparam*); extern void _drawreplacescreenimage(Memimage*); + +#if defined(__cplusplus) +} +#endif +#endif blob - 36d87767db6a4a0d1294cdb813854f5d866cafa0 blob + f0b01d051c4758fb179d5c1246dc6d99bc284f83 --- include/memlayer.h +++ include/memlayer.h @@ -1,3 +1,9 @@ +#ifndef _MEMLAYER_H_ +#define _MEMLAYER_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct Memscreen Memscreen; typedef void (*Refreshfn)(Memimage*, Rectangle, void*); @@ -46,3 +52,9 @@ void memlexpose(Memimage*, Rectangle); void _memlsetclear(Memscreen*); int memlorigin(Memimage*, Point, Point); void memlnorefresh(Memimage*, Rectangle, void*); + + +#if defined(__cplusplus) +} +#endif +#endif blob - f0a0f697523863e3910a405bf6528a9f06aab175 blob + 2c190b23d99c61343572d180ba396e5ec9921d27 --- include/mouse.h +++ include/mouse.h @@ -1,3 +1,8 @@ +#ifndef _MOUSE_H_ +#define _MOUSE_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif typedef struct Menu Menu; typedef struct Mousectl Mousectl; @@ -42,3 +47,9 @@ extern void setcursor(Mousectl*, struct Cursor*); extern void drawgetrect(Rectangle, int); extern Rectangle getrect(int, Mousectl*); extern int menuhit(int, Mousectl*, Menu*, Screen*); + + +#if defined(__cplusplus) +} +#endif +#endif blob - e0b1132f08d54f270b4506816cd639f35d39dda5 blob + 4a315467444a574feb36f24eca3885459ff47119 --- include/plumb.h +++ include/plumb.h @@ -1,3 +1,8 @@ +#ifndef _LIBPLUMB_H_ +#define _LIBPLUMB_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* #pragma lib "libplumb.a" #pragma src "/sys/src/libplumb" @@ -48,3 +53,8 @@ void plumbfree(Plumbmsg*); char* plumblookup(Plumbattr*, char*); int plumbopen(char*, int); int eplumb(int, char*); + +#if defined(__cplusplus) +} +#endif +#endif blob - 745a6d77747fb80b6cc3b91e559185e12ccdf047 blob + 382d246f67feea498c576982ae986147d4ea896d --- include/regexp9.h +++ include/regexp9.h @@ -1,6 +1,9 @@ -#ifndef _REGEXP9H_ +#ifndef _REGEXP9_H_ +#define _REGEXP9_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif -#define _REGEXP9H_ 1 #include typedef struct Resub Resub; @@ -83,4 +86,7 @@ extern void rregsub9(Rune*, Rune*, Resub*, int); #define rregsub rregsub9 #endif +#if defined(__cplusplus) +} #endif +#endif blob - 10aac284824e67af1bff25a3ed7d25090769550d blob + 9c5d2d0925978dc58da2b480dc6ffd3779ad7875 --- include/thread.h +++ include/thread.h @@ -1,5 +1,8 @@ -#ifndef _THREADH_ -#define _THREADH_ 1 +#ifndef _THREAD_H_ +#define _THREAD_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* avoid conflicts with socket library */ #undef send @@ -129,4 +132,7 @@ int iosleep(Ioproc*, long); long iocall(Ioproc*, long (*)(va_list*), ...); void ioret(Ioproc*, int); +#if defined(__cplusplus) +} +#endif #endif /* _THREADH_ */ blob - 623bfda949c012d56e415408716a85fa0ad55004 blob + 11b016d70ce09ecbb1d4bf1ea4e5c44e3f272cd2 --- include/utf.h +++ include/utf.h @@ -1,5 +1,8 @@ -#ifndef _UTFH_ -#define _UTFH_ 1 +#ifndef _UTF_H_ +#define _UTF_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif typedef unsigned short Rune; /* 16 bits */ @@ -48,4 +51,7 @@ extern int isspacerune(Rune); extern int istitlerune(Rune); extern int isupperrune(Rune); +#if defined(__cplusplus) +} #endif +#endif blob - 5f8ef0a8b2b761712d607371ed38370c5ef6173b blob + a828101a3e1d1d6033158eb6762c925715dbc177 --- include/venti.h +++ include/venti.h @@ -1,3 +1,8 @@ +#ifndef _VENTI_H_ +#define _VENTI_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif /* XXX should be own library? */ /* * Packets @@ -413,3 +418,7 @@ int vtfilelock(VtFile*, int); int vtfilelock2(VtFile*, VtFile*, int); int vtfileflushbefore(VtFile*, u64int); +#if defined(__cplusplus) +} +#endif +#endif blob - c3f207fe1b1ccd6034c534bd3c3bc1442afdb509 blob + 1dc49cff07fc91eec3380e9de2e0bba4fd7b5cc7 --- src/cmd/idiff.c +++ src/cmd/idiff.c @@ -82,11 +82,14 @@ int opentemp(char *template, int mode, long perm) { int fd; + Dir d; fd = mkstemp(template); if(fd < 0) sysfatal("could not create temporary file"); - fchmod(fd, perm); + nulldir(&d); + d.mode = perm; + dirfwstat(fd, &d); return fd; } blob - b34a61b360021e87dec64473ec70c44f0223be20 blob + 0f0ab11201024e491ebef601843f6c325b2148ab --- src/cmd/mkfile +++ src/cmd/mkfile @@ -6,7 +6,7 @@ LDFLAGS=$LDFLAGS -lsec -lregexp9 -l9 -lbio -lfmt -lutf <$PLAN9/src/mkmany -BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term' +BUGGERED='CVS|oplumb|plumb|plumb2|mk|vac|9term|venti' DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "$BUGGERED"` <$PLAN9/src/mkdirs blob - 4f774a9ea11f194438d161de56b1cf93441fa2ad blob + 078d943932485187b2176ce7c44d32f1a7779cbd --- src/cmd/sam/sam.c +++ src/cmd/sam/sam.c @@ -141,6 +141,7 @@ rescue(void) File *f; char *c; char buf[256]; + char *root; if(rescuing++) return; @@ -162,7 +163,10 @@ rescue(void) free(c); }else sprint(buf, "nameless.%d", nblank++); - fprint(io, "#!%s '%s' $* <<'---%s'\n", SAMSAVECMD, buf, buf); + root = getenv("PLAN9"); + if(root == nil) + root = "/usr/local/plan9"; + fprint(io, "#!/bin/sh\n%s/bin/samsave '%s' $* <<'---%s'\n", root, buf, buf); addr.r.p1 = 0, addr.r.p2 = f->b.nc; writeio(f); fprint(io, "\n---%s\n", (char *)buf); blob - 7e824da17e7b67f44de620d9c7d19ee15429462a blob + 1e92c73ecf5a30b347393048d084b7ef4461fe7f --- src/cmd/sam/sam.h +++ src/cmd/sam/sam.h @@ -345,7 +345,6 @@ extern char SH[]; extern char SHPATH[]; extern char RX[]; extern char RXPATH[]; -extern char SAMSAVECMD[]; /* * acme globals blob - 024d30812be452642a39e7c1c626a0035c568939 blob + 45cfc3bcaf7d66e6f6414137653ab58e04ef26ca --- src/cmd/sam/unix.c +++ src/cmd/sam/unix.c @@ -37,9 +37,6 @@ Rune *right[]= { r1, r2, r3, 0}; #endif #ifndef RXPATHNAME #define RXPATHNAME "ssh" -#endif -#ifndef SAMSAVECMDNAME -#define SAMSAVECMDNAME "/bin/sh\n/usr/local/plan9/bin/samsave" #endif char RSAM[] = "sam"; @@ -50,7 +47,6 @@ char SH[] = SHNAME; char SHPATH[] = SHPATHNAME; char RX[] = RXNAME; char RXPATH[] = RXPATHNAME; -char SAMSAVECMD[] = SAMSAVECMDNAME; void blob - c161731562d7c9f6b7686ee244b52ccfd4b25a2e blob + 0be7aa8ead04aef4ce56aa048fe08012a5ff5906 --- src/cmd/unutf.c +++ src/cmd/unutf.c @@ -1,3 +1,7 @@ +/* + * stupid little program to pipe unicode chars through + * when converting to non-utf compilers. + */ #include #include #include blob - 9f0d485c849395ee6e7b07b8587390156839ce02 blob + c7cf64d662aa2746640661560354344ddbeb6004 --- src/lib9/dirfwstat.c +++ src/lib9/dirfwstat.c @@ -22,16 +22,21 @@ futimes(int fd, struct timeval *tv) int dirfwstat(int fd, Dir *dir) { + int ret; struct timeval tv[2]; - /* BUG handle more */ - if(dir->mtime == ~0ULL) - return 0; - - tv[0].tv_sec = dir->mtime; - tv[0].tv_usec = 0; - tv[1].tv_sec = dir->mtime; - tv[1].tv_usec = 0; - return futimes(fd, tv); + if(~dir->mode != 0){ + if(fchmod(fd, dir->mode) < 0) + ret = -1; + } + if(~dir->mtime != 0){ + tv[0].tv_sec = dir->mtime; + tv[0].tv_usec = 0; + tv[1].tv_sec = dir->mtime; + tv[1].tv_usec = 0; + if(futimes(fd, tv) < 0) + ret = -1; + } + return ret; } blob - 2e1ce886e41d1b863ffc13822460d326c3c85dac blob + ab9ec7f598de288e9e0bb7fb30dec0dbe7772ee0 --- src/lib9/dirread.c +++ src/lib9/dirread.c @@ -1,31 +1,22 @@ #include +#define NOPLAN9DEFINES #include - -#undef asctime -#undef ctime -#undef gmtime -#undef localtime - #include #include extern int _p9dir(struct stat*, char*, Dir*, char**, char*); -/* everyone has getdirentries, just use that */ +/* almost everyone has getdirentries, just use that */ static int mygetdents(int fd, char *buf, int n) { ssize_t nn; -#if _GETDIRENTRIES_TAKES_LONG long off; -#else - off_t off; -#endif - off = seek(fd, 0, 1); + off = p9seek(fd, 0, 1); nn = getdirentries(fd, buf, n, &off); if(nn > 0) - seek(fd, off, 0); + p9seek(fd, off, 0); return nn; } blob - e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (mode 644) blob + /dev/null blob - e402dee28d0b8ae9ee607fd255b692ed00698c56 blob + 73df170f1a89dd8e6a8693e628e6df2a860a52ae --- src/libdraw/x11-init.c +++ src/libdraw/x11-init.c @@ -26,6 +26,15 @@ _initdisplay(void (*error)(Display*, char*), char *lab Display *d; Memimage *m; + /* + * This rfork(RFNOTEG) isn't exactly right, + * but we need some way to signal window + * closes. Right now we post a hangup + * note to the note group, which kills a whole + * lot more than just the current program + * if we don't do this. + */ + rfork(RFNOTEG); memimageinit(); d = mallocz(sizeof(Display), 1); blob - b4d9e6899a00ab0d7298d53d4e2589c9143ce72d blob + 337bf5b6f56a87c9d1d7fa4e3d9be27ac521a027 --- src/libdraw/x11-itrans.c +++ src/libdraw/x11-itrans.c @@ -190,8 +190,15 @@ xtoplan9mouse(XDisplay *xd, XEvent *e, Mouse *m) switch(e->type){ case ButtonPress: be = (XButtonEvent*)e; - /* Fake message, just sent to make us announce snarf. */ - if(be->send_event && be->state==~0 && be->button==~0) + /* + * Fake message, just sent to make us announce snarf. + * Apparently state and button are 16 and 8 bits on + * the wire, since they are truncated by the time they + * get to us. + */ + if(be->send_event + && (~be->state&0xFFFF)==0 + && (~be->button&0xFF)==0) return -1; /* BUG? on mac need to inherit these from elsewhere? */ m->xy.x = be->x; blob - 19f031724912a90b1502699d8b2373b1bba12911 blob + 7ef634139a9e9c3e5632cb3ed78bedea458ac5b3 --- src/libhttpd/parsereq.c +++ src/libhttpd/parsereq.c @@ -15,7 +15,6 @@ static char* abspath(HConnect *cc, char *origpath, ch static int getc(HConnect*); static char* getword(HConnect*); static Strings parseuri(HConnect *c, char*); -static Strings stripmagic(char*); static Strings stripsearch(char*); /* blob - d33587fcd26b761f8c650c98599861e1e04802fc blob + b9e646e3c2e82dd7649b90f5d236892955fc4b98 --- src/libthread/sched.c +++ src/libthread/sched.c @@ -3,12 +3,14 @@ //static Thread *runthread(Proc*); +#if 0 static char *_psstate[] = { "Dead", "Running", "Ready", "Rendezvous", }; +#endif static char* psstate(int s) blob - 506cd43869f5c2e7b81f08e6fa86462f038f05f0 blob + 90131bce91dc6ed43682fa1a760481b297ff6da1 --- src/mkcommon +++ src/mkcommon @@ -6,16 +6,20 @@ %.$O: %.s $AS $AFLAGS $stem.s -clean:V: +y.tab.h y.tab.c: $YFILES + $YACC $YFLAGS $prereq + +nuke:V: nuke-common +clean:V: clean-common +%.clean:V: %.clean-common + +nuke-common:V: + rm -f *.[$OS] [$OS].out $CLEANFILES $NUKEFILES + +clean-common: rm -f *.[$OS] [$OS].out $CLEANFILES -%.clean:V: +%.clean-common: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 blob - cbb0569fb3a395adaaef0cad7e0c301360edb329 blob + 8172845ddac70a72e6da75b9fd5c282b31ee5b33 --- src/mkhdr +++ src/mkhdr @@ -1,26 +1,25 @@ SYSNAME=`uname` OBJTYPE=`uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'` +BIN=$PLAN9/bin +LIBDIR=$PLAN9/lib + +# BUG - figure this out automatically X11=/usr/X11R6 + +O=o +OS=$O + CC=9c LD=9l AS=9a AR=9ar +INSTALL=install -c CFLAGS= LDFLAGS= AFLAGS= -O=o +CLEANFILES= +NUKEFILES= -BIN=$PLAN9/bin -LIBDIR=$PLAN9/lib - <|cat $PLAN9/src/mk.$SYSNAME-$OBJTYPE 2>/dev/null || true -OS=$O -LD=9l -LDFLAGS=$LDFLAGS -L$LIBDIR - -CLEANFILES=*.$O -NUKEFILES= - -INSTALL=install -c blob - 5b254dbf2bb63b7d0527a8d6f2eac4b42d248d0a blob + b648e88143615c2f54a3105e09d3b3efdc4d814d --- src/mkmany +++ src/mkmany @@ -1,73 +1,26 @@ -PROGS=${TARG:%=$O.%} - none:VQ: echo usage: mk all, install, installall, '$O'.cmd, cmd.install, or cmd.installall +PROGS=${TARG:%=$O.%} + 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 +CLEANFILES=$CLEANFILES $PROGS +NUKEFILES=$NUKEFILES ${TARG:%=$BIN/%} -%.safeinstall:V: - mk $O.$stem - test -e $BIN/$stem && mv $BIN/$stem $BIN/_$stem - mk $stem.install +<$PLAN9/src/mkcommon -%.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 blob - a52fb4af19612346087d02f139e552e73a3a1118 blob + 196a10d7402d3028cada5f7ff5b7bb7a49d6ebd5 --- src/mkmk.sh +++ src/mkmk.sh @@ -19,7 +19,7 @@ cd libutf 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 +9ar 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 @@ -56,7 +56,7 @@ cd libfmt 9c vsnprint.c 9c charstod.c 9c pow10.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 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 +9ar 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 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 cd .. cd libbio 9c bbuffered.c @@ -75,7 +75,7 @@ cd libbio 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 +9ar 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 @@ -86,7 +86,7 @@ cd libregexp 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 +9ar 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 @@ -111,6 +111,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 -L../../../lib -lregexp9 -lbio -lfmt -lutf +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 -lfmt -lutf install -c o.mk ../../../bin/mk cd .. blob - 316bca937e6d1f194917dcb9de7adfd5bbc8c506 blob + 8885b1eb83631d1ccbc5a6e890c0da6157bf75a8 --- src/mkone +++ src/mkone @@ -2,43 +2,16 @@ PROG=$O.$TARG all:V: $PROG -$O.$TARG: $OFILES $LIB +$PROG: $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: $TARG.install %.install:V: $BIN/% $BIN/%: $O.% $INSTALL $O.$stem $BIN/$stem -%.installall:V: - for (objtype in $CPUS) - mk $stem.install +NUKEFILES=$NUKEFILES $BIN/$TARG -install:V: $TARG.install +<$PLAN9/src/mkcommon -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 blob - fab443d31a80d1ae6b8a56272f656f5dfb50580c blob + fe412abd74172304f13c4a5da010d167fb47af04 --- src/mksyslib +++ src/mksyslib @@ -8,4 +8,6 @@ $PLAN9/lib/$LIB:V: $OFILES # force archive even when all install:V: $PLAN9/lib/$LIB +NUKEFILES=$NUKEFILES $PLAN9/lib/$LIB + <$PLAN9/src/mkcommon