*.[0-9]
*.a
*.o
-host
-stage
+cross
bin/cc/cc
bin/ar/ar
bin/as/as
lib/ccom/cvopt
lib/cpp/cpp
lib/cpp/y.tab.c
+stage
usr.lib/libvmf/genlib
usr.lib/libvmf/genlib_p
+usr.bin/lorder
+usr.bin/mkdep
+usr.bin/nohup
#!/bin/sh
ROOT="`pwd |sed -e 's/\/bin\/ar$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-mkdir --parents "$DESTDIR/usr/man/cat1"
-mkdir --parents "$DESTDIR/usr/man/cat5"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+mkdir --parents "$CROSSDIR/usr/man/cat1"
+mkdir --parents "$CROSSDIR/usr/man/cat5"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install
/* a.tmp1: </tmp/atm1XX\0> */
+#ifdef pdp11
+char a_tmp1[] = "/tmp/atm1XX";
+#else
char a_tmp1[] = "/tmp/atm1XXXXXX"; /* linux requires 6 X's */
+#endif
/* Ncps: .byte 8. */
#!/bin/sh
ROOT="`pwd |sed -e 's/\/bin\/as$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install
#!/bin/sh
ROOT="`pwd |sed -e 's/\/bin\/cc$//'`"
-DESTDIR="$ROOT/host"
+CROSSDIR="$ROOT/cross"
STAGEDIR="$ROOT/stage"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install
# Version 2.2 January 24, 1998
-VPATH=../../lib/libc/pdp/gen
-SRCS=ld.c nsym.c
-OBJS=ld.o nsym.o
+# using VPATH to compile ./nsym.o from ../../lib/libc/pdp/gen/nsym.c does not
+# work if there is a ../../lib/libc.pdp/gen/nsym.o leftover from building libc
+#VPATH=../../lib/libc/pdp/gen
+SRCS=ld.c ../../lib/libc/pdp/gen/nsym.c
+OBJS=ld.o ../../lib/libc/pdp/gen/nsym.o
MAN=ld.0
MANSRC=ld.1
CFLAGS=-O
-CPPFLAGS=-Iinclude -I../ar -DNUM_VM_PAGES=20
+CPPFLAGS=-Iinclude -I../ar -DSTAGEDIR=\"${STAGEDIR}\" -DNUM_VM_PAGES=20
SEPFLAG=-i
all: ld ld.0
install: all
# install -c -s -o bin -g bin -m 755 ld ${DESTDIR}/bin/ld
# install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
- install -c -s -m 755 ld ${DESTDIR}/bin/ld
+ install -c -m 755 ld ${DESTDIR}/bin/ld
+#-s FIX THIS
install -c -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
lint:
#include "archive.h"
#include "krcompat.h"
+#ifdef pdp11
+#include <sys/types.h>
+#define OFF_T off_t
+#else
+#include <stdint.h>
+#define OFF_T int32_t
+#endif
+
/*
* Layout of standard part of a.out file header:
* u_int a_magic; magic number
char *ofilename = "l.out";
int infil; /* current input file descriptor */
char *filname; /* and its name */
- char tfname[] = "/tmp/ldaXXXXX";
+#if pdp11
+ char tfname[14]; /*[] = "/tmp/ldaXXXXX";*/
+#else
+ char tfname[15]; /*[] = "/tmp/ldaXXXXXX"; linux requires 6 X's */
+#endif
FILE *toutb, *doutb, *troutb, *droutb, *soutb, *voutb;
void endload PARAMS((int argc, char **argv));
VADDR sym2va PARAMS((int x));
void load1arg PARAMS((register char *cp, int flag));
-int step PARAMS((off_t nloc));
-int ldrand PARAMS((int totnum, off_t sloc));
+int step PARAMS((OFF_T nloc));
+int ldrand PARAMS((int totnum, OFF_T sloc));
void mgets PARAMS((register char *buf, int maxlen, int which));
-int load1 PARAMS((int libflg, off_t loc));
+int load1 PARAMS((int libflg, OFF_T loc));
void middle PARAMS((void));
void ldrsym PARAMS((int ix, u_int val, int type));
void setupout PARAMS((void));
long rnd8k PARAMS((u_int siz));
void mkfsym PARAMS((char *s));
void mget PARAMS((register int *loc, int an, int which));
-void dseek PARAMS((int which, off_t aloc, int s));
+void dseek PARAMS((int which, OFF_T aloc, int s));
int get PARAMS((int which));
int getfile PARAMS((char *acp, int flag, int phase));
int libopen PARAMS((char *name, int oflags));
short *slookup PARAMS((char *s));
int enter PARAMS((short *hp));
void error PARAMS((int n, char *s));
-void readhdr PARAMS((off_t loc));
+void readhdr PARAMS((OFF_T loc));
void tcreat PARAMS((FILE **fpp, int tempflg));
int adrof PARAMS((char *s));
void copy PARAMS((register FILE *fp));
void roundov PARAMS((void));
u_int add PARAMS((int a, int b, char *s));
int get_arobj PARAMS((int fd));
-off_t skip PARAMS((void));
+OFF_T skip PARAMS((void));
void inistr PARAMS((int which));
static void hreset PARAMS((void));
-
+#ifdef pdp11
+#define outw(n, fp) putw(n, fp)
+#define outd(n, fp) fwrite(&n, sizeof (OFF_T), 1, fp)
+/* dget not used as we usually read a whole structure at a time */
+#else
+void outw PARAMS((int n, FILE *fp));
+void outd PARAMS((OFF_T n, FILE *fp));
+OFF_T dget(int which);
+#endif
+
int main(argc, argv) int argc; char **argv; {
register int c, i;
int num;
}
}
/* add default search directories */
- dirs[ndir++] = "/lib";
- dirs[ndir++] = "/usr/lib";
- dirs[ndir++] = "/usr/local/lib";
+ dirs[ndir++] = STAGEDIR "/lib";
+ dirs[ndir++] = STAGEDIR "/usr/lib";
+ dirs[ndir++] = STAGEDIR "/usr/local/lib";
p = argv+1;
/*
case 'D':
for (dnum = atoi(*p);dorigin < dnum; dorigin += 2) {
- putw(0, doutb);
+ outw(0, doutb);
if (rflag)
- putw(0, droutb);
+ outw(0, droutb);
}
/* fall into ... */
case 'u':
* Scan file to find defined symbols.
*/
void load1arg(cp, flag) register char *cp; int flag; {
- off_t nloc;
+ OFF_T nloc;
int kind, tnum;
- long ltnum, strsize;
+ OFF_T ltnum, strsize;
+#ifndef pdp11
+ char temp[sizeof (OFF_T)];
+#endif
kind = getfile(cp, flag, 1);
if (Mflag)
/*
* Read the size of the ranlib structures (a long).
*/
- read(infil, <num, sizeof (ltnum));
+#ifdef pdp11
+ read(infil, <num, sizeof (OFF_T));
+#else
+ read(infil, temp, sizeof (OFF_T));
+ ltnum = ((temp[0] & 0377L) << 16) |
+ ((temp[1] & 0377L) << 24) |
+ (temp[2] & 0377L) |
+ ((temp[3] & 0377L) << 8);
+#endif
/*
* calculate string table position. Add in the ranlib size (4 bytes),
* the size of the ranlib structures (ltnum) from above.
rstrtab = NULL;
lseek(infil, nloc, L_SET);
- read(infil, &strsize, sizeof (long));
+#ifdef pdp11
+ read(infil, &strsize, sizeof (OFF_T));
+#else
+ read(infil, temp, sizeof (OFF_T));
+ strsize = ((temp[0] & 0377L) << 16) |
+ ((temp[1] & 0377L) << 24) |
+ (temp[2] & 0377L) |
+ ((temp[3] & 0377L) << 8);
+#endif
if (strsize <= 8192L)
{
rstrtab = (char *)malloc((int)strsize);
* is useful, record its location in the liblist structure
* for use in pass2. Mark the end of the archive in libilst with a -1.
*/
-int step(nloc) off_t nloc; {
+int step(nloc) OFF_T nloc; {
lseek(infil, nloc, L_SET);
if (get_arobj(infil) <= 0)
{
return (1);
}
-int ldrand(totnum, sloc) int totnum; off_t sloc; {
+int ldrand(totnum, sloc) int totnum; OFF_T sloc; {
register int ntab;
SYMBOL *sp;
short *hp;
VADDR vsym;
LIBLIST *oldp = libp;
int amt, tnum = totnum;
- off_t loc;
+ OFF_T loc;
/*
* 'ar' header + member header + SYMDEF table.of.contents + long filename
*/
- off_t opos = (off_t)SARMAG + sizeof (struct ar_hdr) + sizeof (long) +
+ OFF_T opos = (OFF_T)SARMAG + sizeof (struct ar_hdr) + sizeof (OFF_T) +
chdr.lname;
#define TABSZ 64
char localname[NNAMESIZE];
register struct ranlib *tp;
struct ranlib tab[TABSZ], *tplast;
+#ifndef pdp11
+ char buf[TABSZ * sizeof (struct ranlib)], *temp;
+#endif
while (tnum)
{
tplast = &tab[ntab - 1];
(void)lseek(infil, opos, L_SET);
amt = ntab * sizeof (struct ranlib);
+#ifdef pdp11
if (read(infil, tab, amt) != amt)
error(1, "EOF in ldrand");
+#else
+ if (read(infil, buf, amt) != amt)
+ error(1, "EOF in ldrand");
+ temp = buf;
+ for (tp = tab; tp <= tplast; tp++)
+ {
+ tp->ran_un.ran_strx = ((temp[0] & 0377L) << 16) |
+ ((temp[1] & 0377L) << 24) |
+ (temp[2] & 0377L) |
+ ((temp[3] & 0377L) << 8);
+ tp->ran_off = ((temp[4] & 0377L) << 16) |
+ ((temp[5] & 0377L) << 24) |
+ (temp[6] & 0377L) |
+ ((temp[7] & 0377L) << 8);
+ temp += sizeof (struct ranlib); /* must be 8 */
+ }
+#endif
tnum -= ntab;
opos += amt;
else
{
dseek(STRINGS2, tp->ran_un.ran_strx + sloc +
- sizeof (long), 07777);
+ sizeof (OFF_T), 07777);
mgets(localname, NNAMESIZE, STRINGS2);
}
hp = slookup(localname);
{
if (--sp->nibuf < 0)
{
- dseek(which, (off_t)(sp->bno + 1) * sp->bsize, 077777);
+ dseek(which, (OFF_T)(sp->bno + 1) * sp->bsize, 077777);
sp->nibuf--;
}
if ((*buf++ = *sp->Cptr++) == 0)
/*
* Examine a single file or archive member on pass 1.
*/
-int load1(libflg, loc) int libflg; off_t loc; {
+int load1(libflg, loc) int libflg; OFF_T loc; {
register SYMBOL *sp;
int savindex;
int ndef, type, mtype;
long nlocal;
VADDR vsym;
struct nlist objsym;
- off_t strloc;
- long strsize;
+ OFF_T strloc;
+ OFF_T strsize;
char *strtab;
register struct vseg *seg;
+#ifndef pdp11
+ char temp[sizeof (OFF_T)];
+#endif
readhdr(loc);
if (filhdr.e.a_syms == 0) {
strloc = loc + N_STROFF(filhdr);
lseek(infil, strloc, L_SET);
- read(infil, &strsize, sizeof (long));
+#ifdef pdp11
+ read(infil, &strsize, sizeof (OFF_T));
+#else
+ read(infil, temp, sizeof (OFF_T));
+ strsize = ((temp[0] & 0377L) << 16) | ((temp[1] & 0377L) << 24) |
+ (temp[2] & 0377L) | ((temp[3] & 0377L) << 8);
+#endif
strtab = NULL;
if (strsize <= 8192L)
{
inistr(STRINGS);
while (Input[SYMBOLS].nsize > 0) {
+#ifdef pdp11
mget((int *)&objsym, sizeof objsym, SYMBOLS);
type = objsym.n_type;
+#else
+ objsym.n_un.n_strx = dget(SYMBOLS);
+ type = get(SYMBOLS);
+ objsym.n_ovly = (type >> 8) & 0377;
+ type &= 0377;
+ objsym.n_type = type;
+ objsym.n_value = get(SYMBOLS);
+#endif
if (Sflag) {
mtype = type&037;
if (mtype==1 || mtype>4) {
*/
if (strtab)
strncpy(cursym.n_name, (int)objsym.n_un.n_strx +
- strtab - sizeof (long), NNAMESIZE);
+ strtab - sizeof (OFF_T), NNAMESIZE);
else
{
dseek(STRINGS, objsym.n_un.n_strx + strloc, 077777);
void setupout() {
VADDR vsym;
register SYMBOL *sp;
+#ifndef pdp11
+ int i;
+#endif
tcreat(&toutb, 0);
#if 0 /* see tcreat */
} else
filhdr.e.a_entry = 0;
filhdr.e.a_flag = (rflag==0);
+#ifdef pdp11
fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
if (numov)
fwrite(&filhdr.o, sizeof (filhdr.o), 1, toutb);
+#else
+ outw(filhdr.e.a_magic, toutb);
+ outw(filhdr.e.a_text, toutb);
+ outw(filhdr.e.a_data, toutb);
+ outw(filhdr.e.a_bss, toutb);
+ outw(filhdr.e.a_syms, toutb);
+ outw(filhdr.e.a_entry, toutb);
+ outw(0, toutb); /* filhdr.e.a_unused */
+ outw(filhdr.e.a_flag, toutb);
+ if (numov) {
+ outw(filhdr.o.max_ovl, toutb);
+ for (i = 0; i < NOVL; i++)
+ outw(filhdr.o.ov_siz[i], toutb);
+ }
+#endif
+}
+
+#ifndef pdp11
+void outw(n, fp) int n; FILE *fp; {
+ putc(n & 0377, fp);
+ putc((n >> 8) & 0377, fp);
}
+void outd(n, fp) OFF_T n; FILE *fp; {
+ /* note weirdness as files are stored in pdp11's native layout */
+ putc((int)(n >> 16) & 0377, fp);
+ putc((int)(n >> 24) & 0377, fp);
+ putc((int)n & 0377, fp);
+ putc((int)(n >> 8) & 0377, fp);
+}
+#endif
+
void load2arg(acp, flag) char *acp; int flag; {
register char *cp;
register LIBLIST *lp;
VADDR vsym;
short i;
struct nlist objsym;
- off_t stroff;
+ OFF_T stroff;
char *strtab;
- long strsize;
+ OFF_T strsize;
+#ifndef pdp11
+ char temp[sizeof (OFF_T)];
+#endif
readhdr(loc);
ctrel = torigin;
stroff = loc + N_STROFF(filhdr);
lseek(infil, stroff, L_SET);
- read(infil, &strsize, sizeof (long));
+#ifdef pdp11
+ read(infil, &strsize, sizeof (OFF_T));
+#else
+ read(infil, temp, sizeof (OFF_T));
+ strsize = ((temp[0] & 0377L) << 16) | ((temp[1] & 0377L) << 24) |
+ (temp[2] & 0377L) | ((temp[3] & 0377L) << 8);
+#endif
strtab = NULL;
if (strsize <= 8192L)
{
while (Input[SYMBOLS].nsize > 0) {
symno++;
+#ifdef pdp11
mget((int *)&objsym, sizeof objsym, SYMBOLS);
+#else
+ objsym.n_un.n_strx = dget(SYMBOLS);
+ type = get(SYMBOLS);
+ objsym.n_ovly = (type >> 8) & 0377;
+ type &= 0377;
+ objsym.n_type = type;
+ objsym.n_value = get(SYMBOLS);
+#endif
if (strtab)
strncpy(cursym.n_name, (int)objsym.n_un.n_strx +
- strtab - sizeof (long), NNAMESIZE);
+ strtab - sizeof (OFF_T), NNAMESIZE);
else
{
dseek(STRINGS, objsym.n_un.n_strx + stroff, 07777);
borigin += filhdr.e.a_bss;
}
-void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1; FILE *b2; {
+void load2td(lp, creloc, b1, b2) struct local *lp; u_int creloc; FILE *b1, *b2; {
register u_int r, t;
register SYMBOL *sp;
short i;
Input[TEXT].nibuf++;
Input[TEXT].nsize++;
t = get(TEXT);
- } else
+ } else {
+#ifdef pdp11
t = *Input[TEXT].Iptr++;
+#else
+ t = *Input[TEXT].Cptr++ & 0377;
+ t |= (*Input[TEXT].Cptr++ & 0377) << 8;
+#endif
+ }
/* next relocation word */
if (--Input[RELOC].nsize <= 0) {
Input[RELOC].nibuf++;
Input[RELOC].nsize++;
r = get(RELOC);
- } else
+ } else {
+#ifdef pdp11
r = *Input[RELOC].Iptr++;
+#else
+ r = *Input[RELOC].Cptr++ & 0377;
+ r |= (*Input[RELOC].Cptr++ & 0377) << 8;
+#endif
+ }
+#if 0
+ printf("t = 0%06o r = 0%06o\n", t, r);
+#endif
switch (r&016) {
t += sp->n_value;
r = (r&01) + ((sp->n_type-(N_EXT+N_ABS))<<1);
break;
-#ifndef pdp11
+#if 0 /*ndef pdp11*/
default:
error(1, "relocation format botch (symbol type))");
#endif
}
if (r&01)
t -= creloc;
- putw(t, b1);
+ outw(t, b1);
if (rflag)
- putw(r, b2);
+ outw(r, b2);
}
}
struct nlist objsym;
VADDR vsym;
int type, len;
- off_t stroff;
+ OFF_T stroff;
long dtotal, ovrnd;
int thunk[THUNKSIZ / sizeof (int)];
n = torigin;
while (n&077) {
n += 2;
- putw(0, toutb);
+ outw(0, toutb);
if (rflag)
- putw(0, troutb);
+ outw(0, troutb);
}
}
if (numov)
tcreat(&doutb, 1);
nsym = 0;
- stroff = sizeof (long); /* string table size */
+ stroff = sizeof (OFF_T); /* string table size */
if (xflag == 0)
{
fflush(soutb); /* flush local symbol file */
fwrite(cursym.n_name, 1, len, doutb);
fputc('\0', doutb);
stroff += (len + 1);
+#ifdef pdp11
fwrite(&objsym, sizeof (objsym), 1, toutb);
+#else
+ outd(objsym.n_un.n_strx, toutb);
+ putc(objsym.n_type, toutb);
+ putc(objsym.n_ovly, toutb);
+ outw(objsym.n_value, toutb);
+#endif
nsym++;
}
fclose(soutb);
fwrite(sp->n_name, 1, len, doutb);
fputc('\0', doutb);
stroff += (len + 1);
+#ifdef pdp11
fwrite(&objsym, sizeof (objsym), 1, toutb);
+#else
+ outd(objsym.n_un.n_strx, toutb);
+ putc(objsym.n_type, toutb);
+ putc(objsym.n_ovly, toutb);
+ outw(objsym.n_value, toutb);
+#endif
nsym++;
}
#ifdef whybother
* Now write the length of the string table out. Then copy the temp
* file containing the strings to the image being built.
*/
- fwrite(&stroff, sizeof (stroff), 1, toutb);
+ outd(stroff, toutb);
copy(doutb);
}
/*
* used earlier was only an estimate
*/
fflush(toutb);
+#if 0 /*def pdp11*/
rewind(toutb);
fread(&filhdr.e, sizeof (filhdr.e), 1, toutb);
filhdr.e.a_syms = nsym * sizeof (objsym);
rewind(toutb);
fwrite(&filhdr.e, sizeof (filhdr.e), 1, toutb);
+#else
+ fseek(toutb, (OFF_T)(4 * 2), SEEK_SET);
+ outw(nsym * sizeof (struct nlist), toutb);
+#endif
fclose(toutb);
if (!ofilfnd) {
fwrite(&cursym, sizeof (cursym), 1, soutb);
}
+/* THIS STUFF NEEDS TO BE REWRITTEN TO HANDLE BLOCK BOUNDARIES INTELLIGENTLY */
void mget(loc, an, which) register int *loc; int an; int which; {
register int n;
register STREAM *tp = &Input[which];
+#ifndef pdp11
+ int temp;
+#endif
n = an >> 1;
if ((tp->nibuf -= n) >= 0) {
if ((tp->nsize -= n) > 0) {
- bcopy(tp->ptr.cptr, loc, an);
+#ifdef pdp11
+ bcopy(tp->ptr, loc, an);
tp->Iptr += n;
+#else
+ bcopy(tp->Cptr, loc, an);
+ tp->Cptr += n << 1;
+#endif
return;
}
tp->nsize += n;
}
tp->nibuf += n;
do {
+#ifdef pdp11
*loc++ = get(which);
+#else
+ /* kludgey, as we are converting to host byte order in temp, */
+ /* then back to target byte order for caller to convert again */
+ /* (luckily it only occurs if request crosses block boundary) */
+ temp = get(which);
+ ((char *)loc)[0] = temp & 0377;
+ ((char *)loc++)[1] = (temp >> 8) & 0377;
+#endif
} while (--n);
}
-void dseek(which, aloc, s) int which; off_t aloc; int s; {
+#ifndef pdp11
+OFF_T dget(which) int which; {
+ OFF_T temp;
+
+ /* note weirdness as files are stored in pdp11 native layout */
+ temp = get(which) & 0177777L;
+ return (get(which) & 0177777L) | (temp << 16);
+}
+#endif
+
+void dseek(which, aloc, s) int which; OFF_T aloc; int s; {
register STREAM *sp = &Input[which];
register u_int b, o;
int n;
o = aloc & (sp->bsize - 1);
if (sp->bno != b)
{
- (void)lseek(infil, (off_t)sp->bsize * b, L_SET);
+ (void)lseek(infil, (OFF_T)sp->bsize * b, L_SET);
if ((n = read(infil, (char *)sp->buff, sp->bsize)) < 0)
n = 0;
sp->bno = b;
int get(which) int which; {
register STREAM *sp = &Input[which];
+#ifndef pdp11
+ register int temp;
+#endif
if (--sp->nibuf < 0) {
- dseek(which, (off_t)(sp->bno + 1) * sp->bsize, -1);
+ dseek(which, (OFF_T)(sp->bno + 1) * sp->bsize, -1);
--sp->nibuf;
}
if (--sp->nsize <= 0) {
if (sp->nsize < 0)
error(1, "premature EOF#1");
}
+#ifdef pdp11
return(*sp->Iptr++);
+#else
+ temp = *sp->Cptr++ & 0377;
+ return temp | ((*sp->Cptr++ & 0377) << 8);
+#endif
}
-int getfile(acp, flag, phase) char *acp; int flag; int phase; { /* flag 1 = fatal if file not found, -1 = not fatal */
+int getfile(acp, flag, phase) char *acp; int flag; int phase; { /* flag: 1 = fatal if file not found, -1 = not fatal */
char arcmag[SARMAG+1];
struct stat stb;
arcmag[SARMAG] = 0;
if (strcmp(arcmag, ARMAG))
return(0);
- lseek(infil, (off_t)SARMAG, L_SET);
+ lseek(infil, (OFF_T)SARMAG, L_SET);
if (get_arobj(infil) <= 0)
return(1);
if (strcmp(chdr.name, RANLIBMAG))
errlev = 2;
}
-void readhdr(loc) off_t loc; {
+void readhdr(loc) OFF_T loc; {
dseek(TEXT, loc, sizeof filhdr);
+#ifdef pdp11
mget((int *)&filhdr.e, sizeof filhdr.e, TEXT);
+#else
+ filhdr.e.a_magic = get(TEXT);
+ filhdr.e.a_text = get(TEXT);
+ filhdr.e.a_data = get(TEXT);
+ filhdr.e.a_bss = get(TEXT);
+ filhdr.e.a_syms = get(TEXT);
+ filhdr.e.a_entry = get(TEXT);
+ get(TEXT); /* filhdr.e.a_unused */
+ filhdr.e.a_flag = get(TEXT);
+#endif
if (filhdr.e.a_magic != A_MAGIC1)
error(1, "bad magic number");
if (filhdr.e.a_text&01)
#if 1
if (tempflg) {
+ /* note: we have to refresh the template each time, because
+ * linux actually checks that it ends with 6 X's, and worse,
+ * leaves it in an undefined state if something goes wrong
+ */
+#if pdp11
+ strcpy(tfname, "/tmp/ldaXXXXX");
+#else
+ strcpy(tfname, "/tmp/ldaXXXXXX"); /* linux requires 6 X's */
+#endif
if ((ufd = mkstemp(tfname)) < 0)
error(2, "cannot create temp");
unlink(tfname);
void roundov() {
while (torigin & 077)
{
- putw(0, voutb);
- torigin += sizeof (int);
+ outw(0, voutb);
+ torigin += 2;
}
}
/*
* skip - where to seek for next archive member.
*/
-off_t skip() {
- off_t len;
+OFF_T skip() {
+ OFF_T len;
len = chdr.size + (chdr.size + chdr.lname & 1);
len += sizeof (HDR);
#!/bin/sh
ROOT="`pwd |sed -e 's/\/bin\/ld$//'`"
-DESTDIR="$ROOT/host"
+CROSSDIR="$ROOT/cross"
STAGEDIR="$ROOT/stage"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-mkdir --parents "$DESTDIR/usr/man/cat1"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install
+CFLAGS="-g -Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+mkdir --parents "$CROSSDIR/usr/man/cat1"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$CROSSDIR/usr/lib" install
-VPATH=../../lib/libc/pdp/gen
-SRCS=nm.c nsym.c
-OBJS=nm.o nsym.o
+# using VPATH to compile ./nsym.o from ../../lib/libc/pdp/gen/nsym.c does not
+# work if there is a ../../lib/libc.pdp/gen/nsym.o leftover from building libc
+#VPATH=../../lib/libc/pdp/gen
+SRCS=nm.c ../../lib/libc/pdp/gen/nsym.c
+OBJS=nm.o ../../lib/libc/pdp/gen/nsym.o
CFLAGS=-O
CPPFLAGS=-Iinclude -I../ar
#!/bin/sh
ROOT="`pwd |sed -e 's/\/bin\/nm$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install
#define _AOUT_H_
#include <sys/exec.h>
+#ifdef pdp11
+#include <sys/types.h>
+#define OFF_T off_t
+#else
+#include <stdint.h>
+#define OFF_T int32_t
+#endif
#define N_BADMAG(x) \
(((x).a_magic)!=A_MAGIC1 && ((x).a_magic)!=A_MAGIC2 && \
* must pass an extended header ('xexec') as the argument.
*/
-#ifdef pdp11
-#include <sys/types.h>
-#else
-#define off_t long
-#endif
-
#undef PARAMS
#ifdef __STDC__
#define PARAMS(args) args
#define PARAMS(args) ()
#endif
-long n_stroff PARAMS((register struct xexec *ep));
-long n_datoff PARAMS((register struct xexec *ep));
-long n_dreloc PARAMS((register struct xexec *ep));
-long n_treloc PARAMS((register struct xexec *ep));
-long n_symoff PARAMS((register struct xexec *ep));
-
-#ifndef pdp11
-#undef off_t
-#endif
+OFF_T n_stroff PARAMS((register struct xexec *ep));
+OFF_T n_datoff PARAMS((register struct xexec *ep));
+OFF_T n_dreloc PARAMS((register struct xexec *ep));
+OFF_T n_treloc PARAMS((register struct xexec *ep));
+OFF_T n_symoff PARAMS((register struct xexec *ep));
#define N_STROFF(e) (n_stroff((struct xexec *)&e))
#define N_SYMOFF(e) (n_symoff((struct xexec *)&e))
#define N_DRELOC(e) (n_dreloc((struct xexec *)&e))
#define N_TRELOC(e) (n_treloc((struct xexec *)&e))
+#undef OFF_T
+
#define _AOUT_INCLUDE_
#include <nlist.h>
--- /dev/null
+#!/bin/sh
+ROOT="`pwd |sed -e 's/\/include$//'`"
+STAGEDIR="$ROOT/stage"
+mkdir --parents "$STAGEDIR/usr/include"
+make SHARED=copies DESTDIR="$STAGEDIR" install
#ifndef _NLIST_H_
#define _NLIST_H_
+
#include <sys/types.h>
+#ifdef pdp11
+#define OFF_T off_t
+#else
+#include <stdint.h>
+#define OFF_T int32_t
+#endif
/*
* Symbol table entry format. The #ifdef's are so that programs including
#define N_TYPE 0x1f /* mask for all the type bits */
#define N_FORMAT "%06o" /* namelist value format; XXX */
+
+#undef OFF_T
+
#endif /* !_NLIST_H_ */
#ifndef _RANLIB_H_
#define _RANLIB_H_
+#ifdef pdp11
+#include <sys/types.h>
+#define OFF_T off_t
+#else
+#include <stdint.h>
+#define OFF_T int32_t
+#endif
+
#define RANLIBMAG "__.SYMDEF" /* archive file name */
#define RANLIBSKEW 3 /* creation time offset */
struct ranlib {
union {
- off_t ran_strx; /* string table index */
+ OFF_T ran_strx; /* string table index */
char *ran_name; /* in memory symbol name */
} ran_un;
- off_t ran_off; /* archive file offset */
+ OFF_T ran_off; /* archive file offset */
};
+#undef OFF_T
+
#endif /* !_RANLIB_H_ */
#!/bin/sh
ROOT="`pwd |sed -e 's/\/lib\/c2$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/lib"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/lib"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install
#!/bin/sh
ROOT="`pwd |sed -e 's/\/lib\/ccom$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/lib"
-make clean && make LDC0FLAGS= LDC1FLAGS= PURFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/lib"
+make clean && make LDC0FLAGS= LDC1FLAGS= PURFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install
vp=acttxt; *vp++='\0';
sprintf(vp,"\"%s\"",fnames[ifno]); while (*vp++);
}
+ /*fprintf(stderr, "expand %s params %d\n", macnam, vp[-1] & 0xff);*/
if (0!=(params= *--vp&0xFF)) {/* definition calls for params */
register char **pa;
ca=acttxt; pa=actual;
maclin=lineno[ifno]; macfil=fnames[ifno];
for (plvl=1; plvl!=0; ) {
*ca++='\0';
+ /*fprintf(stderr, "param: ");*/
for (;;) {
outp=inp=p; p=cotoken(p);
if (*inp=='(') ++plvl;
if (*inp==')' && --plvl==0) {--params; break;}
if (plvl==1 && *inp==',') {--params; break;}
+ /*fwrite(inp, p - inp, 1, stderr);*/
while (inp<p) *ca++= *inp++;
if (ca> &acttxt[BUFSIZ])
pperror("%s: actuals too long",sp->name);
}
+ /*fputc('\n', stderr);*/
if (pa>= &actual[MAXFRM]) ppwarn(match,sp->name);
else { actused[pa-actual]=0; *pa++=ca; }
}
for (;;) {/* push definition onto front of input stack */
while (!iswarn(*--vp)) {
if (bob(p)) {outp=inp=p; p=unfill(p);}
+ /*fprintf(stderr, "char: %c\n", *vp);*/
*--p= *vp;
}
if (*vp==warnc) {/* insert actual param */
+ /*fprintf(stderr, "actual: %d\n", vp[-1] - 1);*/
ca=actual[*--vp-1];
while (*--ca) {
if (bob(p)) {outp=inp=p; p=unfill(p);}
/* some code depends on whether characters are sign or zero extended */
/* #if '\377' < 0 not used here, old cpp doesn't understand */
-#if pdp11 | vax | mc68000
+#if '\377' < 0 /*pdp11 | vax | mc68000*/
#define COFF 128
#else
#define COFF 0
#!/bin/sh
ROOT="`pwd |sed -e 's/\/lib\/cpp$//'`"
-DESTDIR="$ROOT/host"
+CROSSDIR="$ROOT/cross"
STAGEDIR="$ROOT/stage"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/lib"
-make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/lib"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install
#include <string.h>
#include "cpp.h"
-#define isid(a) ((fastab+COFF)[a]&IB)
-#define IB 1
-/* #if '\377' < 0 it would be nice if this worked properly!!!!! */
-#if pdp11 | vax | mc68000
-#define COFF 128
-#else
-#define COFF 0
-#endif
-
static int tobinary PARAMS((char *st, int b));
int yylex() {
HOSTLOOKUP= named
#HOSTLOOKUP= hosttable
#
-DESTDIR=
+AR=ar
INSTALL=install -m 644
+LORDER=lorder
+RANLIB=ranlib
DFLMON= mon.o
MACHINE=pdp
DEFS=
rm -rf tmp
mkdir tmp
cd tmp; \
- for i in ${ALL}; do ar x ../$$i/$${i}lib; done; \
- ar x ../net/${HOSTLOOKUP}/hostlib; \
- ar cr ../libc.a `lorder *.o | tsort` \
+ for i in ${ALL}; do ${AR} x ../$$i/$${i}lib; done; \
+ ${AR} x ../net/${HOSTLOOKUP}/hostlib; \
+ ${AR} cr ../libc.a `${LORDER} *.o | tsort` \
../${MACHINE}/csu/${DFLMON}
- ar ma findiop.o libc.a exit.o
- ar ma exit.o libc.a fakcu.o
- ar ma fltpr.o libc.a doprnt.o
- ar ma doprnt.o libc.a ffltpr.o
+ ${AR} ma findiop.o libc.a exit.o
+ ${AR} ma exit.o libc.a fakcu.o
+ ${AR} ma fltpr.o libc.a doprnt.o
+ ${AR} ma doprnt.o libc.a ffltpr.o
rm -rf tmp
mkdir tmp
cd tmp; \
- for i in ${ALL}; do ar x ../$$i/$${i}lib_p; done; \
- ar x ../net/${HOSTLOOKUP}/hostlib_p; \
- ar cr ../libc_p.a `lorder *.o | tsort` \
+ for i in ${ALL}; do ${AR} x ../$$i/$${i}lib_p; done; \
+ ${AR} x ../net/${HOSTLOOKUP}/hostlib_p; \
+ ${AR} cr ../libc_p.a `${LORDER} *.o | tsort` \
../${MACHINE}/csu/${DFLMON}
- ar ma findiop.o libc_p.a exit.o
- ar ma exit.o libc_p.a fakcu.o
- ar ma fltpr.o libc_p.a doprnt.o
- ar ma doprnt.o libc_p.a ffltpr.o
+ ${AR} ma findiop.o libc_p.a exit.o
+ ${AR} ma exit.o libc_p.a fakcu.o
+ ${AR} ma fltpr.o libc_p.a doprnt.o
+ ${AR} ma doprnt.o libc_p.a ffltpr.o
rm -rf tmp
${MACHINE}/csu ${ALL} net/${HOSTLOOKUP}: FRC
install: libc.a libc_p.a
${INSTALL} libc.a ${DESTDIR}/lib/libc.a
- ranlib ${DESTDIR}/lib/libc.a
+ ${RANLIB} ${DESTDIR}/lib/libc.a
${INSTALL} libc_p.a ${DESTDIR}/usr/lib/libc_p.a
- ranlib ${DESTDIR}/usr/lib/libc_p.a
+ ${RANLIB} ${DESTDIR}/usr/lib/libc_p.a
cd ${MACHINE}/csu; make DESTDIR=${DESTDIR} install
tags:
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-4.1lib compat-4.1lib_p: ${OBJS}
@echo "building profiled compat-4.1lib"
- @cd profiled; ar cru ../compat-4.1lib_p ${OBJS}
+ @cd profiled; ${AR} cru ../compat-4.1lib_p ${OBJS}
@echo "buiding normal compat-4.1lib"
- @ar cru compat-4.1lib ${OBJS}
+ @${AR} cru compat-4.1lib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
all: compat-43lib compat-43lib_p
compat-43lib compat-43lib_p: ${OBJS}
@echo "building profiled compat-43lib"
- @cd profiled; ar cru ../compat-43lib_p ${OBJS}
+ @cd profiled; ${AR} cru ../compat-43lib_p ${OBJS}
@echo "buiding normal compat-43lib"
- @ar cru compat-43lib ${OBJS}
+ @${AR} cru compat-43lib ${OBJS}
clean:
rm -f compat-43lib compat-43lib_p *.o profiled/*.o Makefile.bak tags
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-sys5lib compat-sys5lib_p: ${OBJS}
@echo "building profiled compat-sys5lib"
- @cd profiled; ar cru ../compat-sys5lib_p ${OBJS}
+ @cd profiled; ${AR} cru ../compat-sys5lib_p ${OBJS}
@echo "buiding normal compat-sys5lib"
- @ar cru compat-sys5lib ${OBJS}
+ @${AR} cru compat-sys5lib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out $*.o
genlib genlib_p: ${OBJS}
@echo "building profiled genlib"
- @cd profiled; ar cru ../genlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../genlib_p ${OBJS}
@echo "buiding normal genlib"
- @ar cru genlib ${OBJS}
+ @${AR} cru genlib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
inetlib inetlib_p: ${OBJS}
@echo "building profiled inetlib"
- @cd profiled; ar cru ../inetlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../inetlib_p ${OBJS}
@echo "building normal inetlib"
- @ar cru inetlib ${OBJS}
+ @${AR} cru inetlib ${OBJS}
tags:
cwd=`pwd`; \
--- /dev/null
+#!/bin/sh
+ROOT="`pwd |sed -e 's/\/lib\/libc$//'`"
+CROSSDIR="$ROOT/cross"
+STAGEDIR="$ROOT/stage"
+mkdir --parents "$STAGEDIR/lib"
+make clean && make AR="$CROSSDIR/bin/ar" AS="$CROSSDIR/bin/as" CC="$CROSSDIR/bin/cc" CPP="$CROSSDIR/lib/cpp" LD="$CROSSDIR/bin/ld" LORDER="$CROSSDIR/usr/bin/lorder" RANLIB="$CROSSDIR/usr/bin/ranlib" DESTDIR="$STAGEDIR" install
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
netlib netlib_p: ${OBJS}
@echo "building profiled netlib"
- @cd profiled; ar cru ../netlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../netlib_p ${OBJS}
@echo "building normal netlib"
- @ar cru netlib ${OBJS}
+ @${AR} cru netlib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
hostlib hostlib_p: ${OBJS}
@echo "building profiled hostlib"
- @cd profiled; ar cru ../hostlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../hostlib_p ${OBJS}
@echo "building normal netlib"
- @ar cru hostlib ${OBJS}
+ @${AR} cru hostlib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
hostlib hostlib_p: ${OBJS}
@echo "building profiled hostlib"
- @cd profiled; ar cru ../hostlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../hostlib_p ${OBJS}
@echo "building normal hostlib"
- @ar cru hostlib ${OBJS}
+ @${AR} cru hostlib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
nslib nslib_p: ${OBJS}
@echo "building profiled nslib"
- @cd profiled; ar cru ../nslib_p ${OBJS}
+ @cd profiled; ${AR} cru ../nslib_p ${OBJS}
@echo "building normal nslib"
- @ar cru nslib ${OBJS}
+ @${AR} cru nslib ${OBJS}
tags:
cwd=`pwd`; \
TAGSFILE=tags
.s.o:
- /lib/cpp -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -x -r $*.o
+ ${CPP} -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
- cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ ${CC} -p -c ${CFLAGS} $*.c
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ ${CC} -c ${CFLAGS} $*.c
+ -${LD} -x -r $*.o
mv a.out $*.o
compat-2.9lib compat-2.9lib_p: ${OBJS}
@echo "building profiled compat-2.9"
- @cd profiled; ar cru ../compat-2.9lib_p ${OBJS}
+ @cd profiled; ${AR} cru ../compat-2.9lib_p ${OBJS}
@echo "building normal compat-2.9"
- @ar cru compat-2.9lib ${OBJS}
+ @${AR} cru compat-2.9lib ${OBJS}
tags:
TAGSFILE=tags
.s.o:
- /lib/cpp -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -x -r $*.o
+ ${CPP} -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
- cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ ${CC} -p -c ${CFLAGS} $*.c
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ ${CC} -c ${CFLAGS} $*.c
+ -${LD} -x -r $*.o
mv a.out $*.o
crtlib crtlib_p: ${OBJS}
@echo "building profiled crtlib"
- @cd profiled; ar cru ../crtlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../crtlib_p ${OBJS}
@echo "building normal crtlib"
- @ar cru crtlib ${OBJS}
+ @${AR} cru crtlib ${OBJS}
tags:
# install -c -m 0644 gcrt0.o ${DESTDIR}/usr/lib/gcrt0.o
crt0.o: crt0.s
- /lib/cpp ${DEFS} ${DFLAGS} crt0.s | sed 's;^#;/;' | as -o x.o
- ld -x -r -o crt0.o x.o
+ ${CPP} ${DEFS} ${DFLAGS} crt0.s | sed 's;^#;/;' | ${AS} -o x.o
+ ${LD} -x -r -o crt0.o x.o
rm -f x.o
moncrt0.o: crt0.s
- /lib/cpp ${DEFS} ${DFLAGS} -DMCRT0 crt0.s | sed 's;^#;/;' | as -o x.o
- ld -x -r -o moncrt0.o x.o
+ ${CPP} ${DEFS} ${DFLAGS} -DMCRT0 crt0.s | sed 's;^#;/;' | ${AS} -o x.o
+ ${LD} -x -r -o moncrt0.o x.o
rm -f x.o
gcrt0.o: moncrt0.o gmon.o
- ld -x -r -o gcrt0.o moncrt0.o gmon.o
+ ${LD} -x -r -o gcrt0.o moncrt0.o gmon.o
mcrt0.o: moncrt0.o mon.o
- ld -x -r -o mcrt0.o moncrt0.o mon.o
+ ${LD} -x -r -o mcrt0.o moncrt0.o mon.o
mon.o: mon.c mcount.s mon.ex
- cc ${CFLAGS} -S ${DFLAGS} mon.c
+ ${CC} ${CFLAGS} -S ${DFLAGS} mon.c
ex - mon.s < mon.ex
cat mon.s mcount.s > x.s
- /lib/cpp ${DEFS} ${DFLAGS} x.s | sed 's;^#;/;' > xx.s
- as - -o x.o xx.s
- ld -x -r -o mon.o x.o
+ ${CPP} ${DEFS} ${DFLAGS} x.s | sed 's;^#;/;' > xx.s
+ ${AS} - -o x.o xx.s
+ ${LD} -x -r -o mon.o x.o
rm -f x.o x.s xx.s mon.s
gmon.o: gmon.c gmon.h gmon.ex
- cc ${CFLAGS} -S ${DFLAGS} gmon.c
+ ${CC} ${CFLAGS} -S ${DFLAGS} gmon.c
ex - gmon.s < gmon.ex
- as -o x.o gmon.s
- ld -x -r -o gmon.o x.o
+ ${AS} -o x.o gmon.s
+ ${LD} -x -r -o gmon.o x.o
rm -f x.o gmon.s
tags:
TAGSFILE=tags
.s.o:
- /lib/cpp -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -x -r $*.o
+ ${CPP} -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
- cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ ${CC} -p -c ${CFLAGS} $*.c
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ ${CC} -c ${CFLAGS} $*.c
+ -${LD} -x -r $*.o
mv a.out $*.o
genlib genlib_p: ${OBJS}
@echo "building profiled genlib"
- @cd profiled; ar cru ../genlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../genlib_p ${OBJS}
@echo "building normal genlib"
- @ar cru genlib ${OBJS}
+ @${AR} cru genlib ${OBJS}
tags:
cwd=`pwd`; \
#include <a.out.h>
-#ifndef pdp11
-#define off_t long
+#ifdef pdp11
+#define OFF_T off_t
+#else
+#define OFF_T int32_t
#endif
-off_t
+OFF_T
n_stroff(ep)
register struct xexec *ep;
{
- off_t l;
+ OFF_T l;
l = n_symoff(ep);
l += ep->e.a_syms;
return(l);
}
-off_t
+OFF_T
n_datoff(ep)
register struct xexec *ep;
{
- off_t l;
+ OFF_T l;
l = n_treloc(ep);
l -= ep->e.a_data;
* called.
*/
-off_t
+OFF_T
n_dreloc(ep)
register struct xexec *ep;
{
- off_t l;
+ OFF_T l;
register u_short *ov = ep->o.ov_siz;
register int i;
- l = (off_t)sizeof (struct exec) + ep->e.a_text + ep->e.a_data;
+ l = (OFF_T)sizeof (struct exec) + ep->e.a_text + ep->e.a_data;
if (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6)
{
for (i = 0; i < NOVL; i++)
return(l);
}
-off_t
+OFF_T
n_treloc(ep)
register struct xexec *ep;
{
- off_t l;
+ OFF_T l;
l = n_dreloc(ep);
l -= ep->e.a_text;
return(l);
}
-off_t
+OFF_T
n_symoff(ep)
register struct xexec *ep;
{
register int i;
register u_short *ov;
- off_t sum, l;
+ OFF_T sum, l;
- l = (off_t) N_TXTOFF(ep->e);
- sum = (off_t)ep->e.a_text + ep->e.a_data;
+ l = (OFF_T) N_TXTOFF(ep->e);
+ sum = (OFF_T)ep->e.a_text + ep->e.a_data;
if (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6)
{
for (ov = ep->o.ov_siz, i = 0; i < NOVL; i++)
TAGSFILE=tags
.s.o:
- /lib/cpp -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $*.o
- -ld -x -r $*.o
+ ${CPP} -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
- cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ ${CC} -p -c ${CFLAGS} $*.c
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ ${CC} -c ${CFLAGS} $*.c
+ -${LD} -x -r $*.o
mv a.out $*.o
netlib netlib_p: ${OBJS}
@echo "building profiled netlib"
- @cd profiled; ar cru ../netlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../netlib_p ${OBJS}
@echo "building normal netlib"
- @ar cru netlib ${OBJS}
+ @${AR} cru netlib ${OBJS}
tags:
TAGSFILE=tags
.s.o:
- /lib/cpp -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -E -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -x -r $*.o
+ ${CPP} -E ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -x -r $*.o
mv a.out $*.o
.c.o:
- cc -p -c ${CFLAGS} $*.c
- -ld -X -r $*.o
+ ${CC} -p -c ${CFLAGS} $*.c
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- cc -c ${CFLAGS} $*.c
- -ld -x -r $*.o
+ ${CC} -c ${CFLAGS} $*.c
+ -${LD} -x -r $*.o
mv a.out $*.o
stdiolib stdiolib_p: ${OBJS}
@echo "building profiled stdio"
- @cd profiled; ar cru ../stdiolib_p ${OBJS}
+ @cd profiled; ${AR} cru ../stdiolib_p ${OBJS}
@echo "building normal stdio"
- @ar cru stdiolib ${OBJS}
+ @${AR} cru stdiolib ${OBJS}
tags:
TAGSFILE=tags
.s.o:
- /lib/cpp -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} -DPROF ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
- /lib/cpp ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
- -ld -X -r $*.o
+ ${CPP} ${DEFS} $< | sed -e 's;^#;/;' | as -V -o $@
+ -${LD} -X -r $*.o
mv a.out $*.o
syslib syslib_p: ${OBJS}
@echo "building profiled syslib"
- @cd profiled; ar cru ../syslib_p ${OBJS}
+ @cd profiled; ${AR} cru ../syslib_p ${OBJS}
@echo "building normal syslib"
- @ar cru syslib ${OBJS}
+ @${AR} cru syslib ${OBJS}
${NORM1}: SYS.h /usr/include/syscall.h
@echo creating $*.o profiled/$*.o
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- -ld -X -r $*.o
+ -${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- -ld -x -r $*.o
+ -${LD} -x -r $*.o
mv a.out $*.o
stdiolib stdiolib_p: ${OBJS}
@echo "building profiled stdiolib"
- @cd profiled; ar cru ../stdiolib_p ${OBJS}
+ @cd profiled; ${AR} cru ../stdiolib_p ${OBJS}
@echo "building normal stdiolib"
- @ar cru stdiolib ${OBJS}
+ @${AR} cru stdiolib ${OBJS}
tags:
cwd=`pwd`; \
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- ld -X -r $*.o
+ ${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- ld -X -r $*.o
+ ${LD} -X -r $*.o
mv a.out $*.o
all: stdliblib stdliblib_p
stdliblib stdliblib_p: ${OBJS}
@echo "building profiled stdlib"
- @cd profiled; ar cru ../stdliblib_p ${OBJS}
+ @cd profiled; ${AR} cru ../stdliblib_p ${OBJS}
@echo "building normal stdlib"
- @ar cru stdliblib ${OBJS}
+ @${AR} cru stdliblib ${OBJS}
clean:
rm -f ${OBJS} profiled/*.o tags Makefile.bak stdliblib stdliblib_p
.c.o:
${CC} -p ${CFLAGS} -c $*.c
- ld -X -r $*.o
+ ${LD} -X -r $*.o
mv a.out profiled/$*.o
${CC} ${CFLAGS} -c $*.c
- ld -X -r $*.o
+ ${LD} -X -r $*.o
mv a.out $*.o
all: stringlib stringlib_p
stringlib stringlib_p: ${OBJS}
@echo "building profiled stringlib"
- @cd profiled; ar cru ../stringlib_p ${OBJS}
+ @cd profiled; ${AR} cru ../stringlib_p ${OBJS}
@echo "building normal stringlib"
- @ar cru stringlib ${OBJS}
+ @${AR} cru stringlib ${OBJS}
clean:
rm -f ${OBJS} profiled/*.o tags Makefile.bak stringlib stringlib_p
#!/bin/sh
ROOT="`pwd`"
-DESTDIR="$ROOT/host"
+CROSSDIR="$ROOT/cross"
STAGEDIR="$ROOT/stage"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/bin"
-mkdir --parents "$DESTDIR/lib"
-mkdir --parents "$DESTDIR/usr/lib"
-mkdir --parents "$DESTDIR/usr/man/cat1"
-mkdir --parents "$DESTDIR/usr/man/cat3"
-mkdir --parents "$DESTDIR/usr/man/cat5"
-(cd bin/ar && make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install)
-(cd bin/as && make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install)
-(cd bin/cc && make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install)
-(cd usr.lib/libvmf && make clean && make DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install)
-(cd bin/ld && make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install)
-(cd bin/nm && make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install)
-(cd lib/c2 && make clean && make SEPFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install)
-(cd lib/ccom && make clean && make LDC0FLAGS= LDC1FLAGS= PURFLAG= DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install)
-(cd lib/cpp && make clean && make SEPFLAG= DESTDIR="$DESTDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install)
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/bin"
+mkdir --parents "$CROSSDIR/lib"
+mkdir --parents "$CROSSDIR/usr/bin"
+mkdir --parents "$CROSSDIR/usr/lib"
+mkdir --parents "$CROSSDIR/usr/man/cat1"
+mkdir --parents "$CROSSDIR/usr/man/cat3"
+mkdir --parents "$CROSSDIR/usr/man/cat5"
+(cd bin/ar && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install)
+(cd bin/as && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install)
+(cd bin/cc && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install)
+(cd usr.lib/libvmf && make clean && make DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install)
+(cd bin/ld && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" LDFLAGS="-L$DESTDIR/usr/lib" install)
+(cd bin/nm && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install)
+(cd lib/c2 && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install)
+(cd lib/ccom && make clean && make LDC0FLAGS= LDC1FLAGS= PURFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install)
+(cd lib/cpp && make clean && make SEPFLAG= DESTDIR="$CROSSDIR" STAGEDIR="$STAGEDIR" CFLAGS="$CFLAGS" install)
# Makefile 1.9 (2.11BSD GTE) 1997/7/26
#
-DESTDIR=
-CFLAGS= -O
-SEPFLAG= -i
+NM=nm
+CFLAGS=-O
+SEPFLAG=-i
# Programs that live in subdirectories, and have makefiles of their own.
#
#
KMEM= iostat
-all: ${SUBDIR} ${STD} ${NSTD} ${KMEM}
+all: ${SUBDIR} ${STD} ${NSTD} ${KMEM} ${SCRIPT}
${SUBDIR}: FRC
cd $@; make ${MFLAGS} SEPFLAG=${SEPFLAG}
${STD} ${KMEM}:
${CC} ${CFLAGS} ${SEPFLAG} -o $@ $@.c
+${SCRIPT}:
+ sed -e "s@^nm @${NM} @" $@.sh >$@
+
install: ${STD} ${NSTD} ${KMEM}
-for i in ${SUBDIR}; do \
(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
-for i in ${SCRIPT}; do \
- (install -c -m 555 $$i.sh ${DESTDIR}/usr/bin/$$i); done
+ (install -c -m 555 $$i ${DESTDIR}/usr/bin/$$i); done
-for i in ${KMEM}; do \
(install -s -g kmem -m 2755 $$i ${DESTDIR}/usr/bin/$$i); done
install -s ${STD} ${NSTD} ${DESTDIR}/usr/bin
clean:
for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
- rm -f a.out core *.s *.o y.tab.c ${STD} ${NSTD} ${KMEM}
+ rm -f a.out core *.s *.o y.tab.c ${STD} ${NSTD} ${KMEM} ${SCRIPT}
depend:
for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
--- /dev/null
+#!/bin/sh
+ROOT="`pwd |sed -e 's/\/usr\.bin$//'`"
+CROSSDIR="$ROOT/cross"
+mkdir --parents "$CROSSDIR/usr/bin"
+make clean && make NM="$CROSSDIR/bin/nm" lorder && install lorder -m 755 "$DESTDIR/usr/bin"
-SRCS= ../../bin/ar/archive.c build.c misc.c ranlib.c touch.c
-OBJS= archive.o build.o ./misc.o ranlib.o touch.o
-CFLAGS= -O -I. -I../../bin/ar
-VPATH= ../../bin/ar
+# using VPATH to compile ./archive.o from ../../bin/ar/archive.c does not work
+# if there is ../../bin/ar/archive.o leftover from building ar, so we reuse it
+#VPATH=../../bin/ar
+SRCS=../../bin/ar/archive.c build.c misc.c ranlib.c touch.c
+OBJS=../../bin/ar/archive.o build.o misc.o ranlib.o touch.o
+
+CFLAGS=-O
+CPPFLAGS=-Iinclude -I../../bin/ar
+SEPFLAG=-i
all: ranlib.0 ranlib.5.0 ranlib
ranlib.0: ranlib.1
- /usr/man/manroff ranlib.1 > ranlib.0
+# /usr/man/manroff ranlib.1 > ranlib.0
+ nroff -man ranlib.1 > ranlib.0
ranlib.5.0: ranlib.5.5
- /usr/man/manroff ranlib.5.5 > ranlib.5.0
+# /usr/man/manroff ranlib.5.5 > ranlib.5.0
+ nroff -man ranlib.5.5 > ranlib.5.0
ranlib: ${OBJS}
- cc -z -o ranlib ${OBJS}
+ ${CC} ${SEPFLAG} -o ranlib ${OBJS}
-install:
- install -c -o bin -g bin -m 444 ranlib.5.0 \
+install: all
+# install -c -o bin -g bin -m 444 ranlib.5.0 \
+# ${DESTDIR}/usr/man/cat5/ranlib.0
+# install -c -o bin -g bin -m 444 ranlib.0 \
+# ${DESTDIR}/usr/man/cat1/ranlib.0
+# install -c -s -o bin -g bin -m 755 ranlib ${DESTDIR}/usr/bin/ranlib
+ install -c -m 444 ranlib.5.0 \
${DESTDIR}/usr/man/cat5/ranlib.0
- install -c -o bin -g bin -m 444 ranlib.0 \
+ install -c -m 444 ranlib.0 \
${DESTDIR}/usr/man/cat1/ranlib.0
- install -c -s -o bin -g bin -m 755 ranlib ${DESTDIR}/usr/bin/ranlib
+ install -c -s -m 755 ranlib ${DESTDIR}/usr/bin/ranlib
lint:
lint -havx -I. -I../../bin/ar ${SRCS}
--- /dev/null
+#ifndef __RANLIB_H
+#define __RANLIB_H 1
+
+#include <stdio.h>
+#include "krcompat.h"
+
+/* build.c */
+int build PARAMS((void));
+int sgets PARAMS((char *buf, int n, register FILE *fp));
+/* misc.c */
+int tmp PARAMS((void));
+void *emalloc PARAMS((int len));
+char *rname PARAMS((char *path));
+void badfmt PARAMS((void));
+void error PARAMS((char *name));
+/* touch.c */
+int touch PARAMS((void));
+void settime PARAMS((int afd));
+/* ranlib.c */
+int main PARAMS((int argc, char **argv));
+void usage PARAMS((void));
+
+#endif
#include <ar.h>
#include <ranlib.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <archive.h>
+#include "_ranlib.h"
-extern off_t lseek();
extern CHDR chdr; /* converted header */
extern char *archive; /* archive name */
extern char *tname; /* temporary file "name" */
RLIB *rhead, **pnext;
FILE *fp;
-static void rexec(), symobj();
-void error(), badfmt();
long symcnt; /* symbol count */
long tsymlen; /* total string length */
-build()
-{
+static void rexec PARAMS((int rfd, int wfd));
+static void symobj PARAMS((void));
+
+int build() {
CF cf;
int afd, tfd;
off_t size;
* Read the exec structure; ignore any files that don't look
* exactly right.
*/
-static void
-rexec(rfd, wfd)
- int rfd;
- int wfd;
-{
+static void rexec(rfd, wfd) int rfd; int wfd; {
register RLIB *rp;
RLIB **savnext;
long nsyms;
* Write the symbol table into the archive, computing offsets as
* writing.
*/
-static void
-symobj()
-{
+static void symobj() {
register RLIB *rp, *next;
struct ranlib rn;
char hb[sizeof(struct ar_hdr) + 1], pad;
(void)fflush(fp);
}
-sgets(buf, n, fp)
- char *buf;
- int n;
- register FILE *fp;
- {
+int sgets(buf, n, fp) char *buf; int n; register FILE *fp; {
register int i, c;
n--; /* room for null */
}
*buf = '\0';
return(i + 1);
- }
+}
--- /dev/null
+../../../include/ar.h
\ No newline at end of file
--- /dev/null
+../../../include/ranlib.h
\ No newline at end of file
--- /dev/null
+#ifndef _KRCOMPAT_H
+#define _KRCOMPAT_H 1
+
+#undef PARAMS
+#ifdef __STDC__
+#include <stdarg.h>
+#define PARAMS(args) args
+#else
+#include <varargs.h>
+#define PARAMS(args) ()
+#endif
+
+#ifdef __GNUC__
+#define NORETURN __attribute__ ((noreturn))
+#else
+#define NORETURN
+#endif
+
+#endif
#include <sys/signal.h>
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "pathnames.h"
+#include "_ranlib.h"
-extern int errno;
-extern char *archive, *malloc(); /* archive name */
-void error();
+extern char *archive; /* archive name */
char *tname = "temporary file"; /* temporary file "name" */
-tmp()
-{
+int tmp() {
long set, oset;
int fd;
char path[MAXPATHLEN];
return(fd);
}
-void *
-emalloc(len)
- int len;
-{
+void *emalloc(len) int len; {
char *p;
if (!(p = malloc((u_int)len)))
return((void *)p);
}
-char *
-rname(path)
- char *path;
-{
+char *rname(path) char *path; {
register char *ind;
return((ind = rindex(path, '/')) ? ind + 1 : path);
}
-void
-badfmt()
-{
+void badfmt() {
errno = EINVAL;
error(archive);
}
-void
-error(name)
- char *name;
-{
+void error(name) char *name; {
(void)fprintf(stderr, "ranlib: %s: %s\n", name, strerror(errno));
exit(1);
}
--- /dev/null
+#!/bin/sh
+ROOT="`pwd |sed -e 's/\/usr\.bin\/ranlib$//'`"
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/usr/bin"
+make clean && make SEPFLAG= DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install
static char sccsid[] = "@(#)ranlib.c 5.6 (Berkeley) 2/26/91";
#endif
+#include <getopt.h>
#include <sys/types.h>
#include <sys/dir.h>
#include <stdio.h>
+#include <stdlib.h>
#include <archive.h>
+#include "_ranlib.h"
CHDR chdr;
u_int options; /* UNUSED -- keep open_archive happy */
char *archive;
-main(argc, argv)
- int argc;
- char **argv;
-{
+int main(argc, argv) int argc; char **argv; {
extern int optind;
int ch, eval, tflag;
exit(eval);
}
-usage()
-{
+void usage() {
(void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
exit(1);
}
#include <time.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <archive.h>
+#include "_ranlib.h"
-extern time_t time();
-extern off_t lseek();
extern CHDR chdr; /* converted header */
extern char *archive; /* archive name */
-void error();
-touch()
-{
+int touch() {
int afd;
afd = open_archive(O_RDWR);
return(0);
}
-settime(afd)
- int afd;
-{
+void settime(afd) int afd; {
struct ar_hdr *hdr;
off_t size;
char buf[50];
#!/bin/sh
ROOT="`pwd |sed -e 's/\/usr\.lib\/libvmf$//'`"
-DESTDIR="$ROOT/host"
-CFLAGS="-Wall -Wno-char-subscripts -Wno-format -Wno-parentheses"
-mkdir --parents "$DESTDIR/usr/lib"
-mkdir --parents "$DESTDIR/usr/man/cat3"
-make clean && make DESTDIR="$DESTDIR" CFLAGS="$CFLAGS" install
+CROSSDIR="$ROOT/cross"
+CFLAGS="-Wall -Wno-char-subscripts -Wno-deprecated-declarations -Wno-format -Wno-parentheses"
+mkdir --parents "$CROSSDIR/usr/lib"
+mkdir --parents "$CROSSDIR/usr/man/cat3"
+make clean && make DESTDIR="$CROSSDIR" CFLAGS="$CFLAGS" install