Build Unix-friendly versions directly from library.
diff --git a/unix/make/Make.Darwin-PowerMacintosh b/unix/make/Make.Darwin-PowerMacintosh
new file mode 100644
index 0000000..14b8d4e
--- /dev/null
+++ b/unix/make/Make.Darwin-PowerMacintosh
@@ -0,0 +1,6 @@
+CC=gcc
+CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O
diff --git a/unix/make/Make.FreeBSD-386 b/unix/make/Make.FreeBSD-386
new file mode 100644
index 0000000..087ed3a
--- /dev/null
+++ b/unix/make/Make.FreeBSD-386
@@ -0,0 +1,7 @@
+CC=gcc
+CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O	# default, can be overriden by Make.$(SYSNAME)
+NAN=nan64.$O
diff --git a/unix/make/Make.HP-UX-9000 b/unix/make/Make.HP-UX-9000
new file mode 100644
index 0000000..edbdc11
--- /dev/null
+++ b/unix/make/Make.HP-UX-9000
@@ -0,0 +1,6 @@
+CC=cc
+CFLAGS=-O -c -Ae -I.
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O
diff --git a/unix/make/Make.Linux-386 b/unix/make/Make.Linux-386
new file mode 100644
index 0000000..74b0252
--- /dev/null
+++ b/unix/make/Make.Linux-386
@@ -0,0 +1,7 @@
+CC=gcc
+CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I.
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O	# default, can be overriden by Make.$(SYSNAME)
+NAN=nan64.$O
diff --git a/unix/make/Make.NetBSD-386 b/unix/make/Make.NetBSD-386
new file mode 100644
index 0000000..087ed3a
--- /dev/null
+++ b/unix/make/Make.NetBSD-386
@@ -0,0 +1,7 @@
+CC=gcc
+CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O	# default, can be overriden by Make.$(SYSNAME)
+NAN=nan64.$O
diff --git a/unix/make/Make.OSF1-alpha b/unix/make/Make.OSF1-alpha
new file mode 100644
index 0000000..3d45279
--- /dev/null
+++ b/unix/make/Make.OSF1-alpha
@@ -0,0 +1,6 @@
+CC=cc
+CFLAGS+=-g -c -I.
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O
diff --git a/unix/make/Make.SunOS-sun4u b/unix/make/Make.SunOS-sun4u
new file mode 100644
index 0000000..c5fe67b
--- /dev/null
+++ b/unix/make/Make.SunOS-sun4u
@@ -0,0 +1,2 @@
+include Make.SunOS-sun4u-$(CC)
+NAN=nan64.$O
diff --git a/unix/make/Make.SunOS-sun4u-cc b/unix/make/Make.SunOS-sun4u-cc
new file mode 100644
index 0000000..829301d
--- /dev/null
+++ b/unix/make/Make.SunOS-sun4u-cc
@@ -0,0 +1,6 @@
+CC=cc
+CFLAGS+=-g -c -I. -O
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O
diff --git a/unix/make/Make.SunOS-sun4u-gcc b/unix/make/Make.SunOS-sun4u-gcc
new file mode 100644
index 0000000..5c41594
--- /dev/null
+++ b/unix/make/Make.SunOS-sun4u-gcc
@@ -0,0 +1,6 @@
+CC=gcc
+CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c
+O=o
+AR=ar
+ARFLAGS=rvc
+NAN=nan64.$O
diff --git a/unix/make/Makefile.BOT b/unix/make/Makefile.BOT
new file mode 100644
index 0000000..ed00e30
--- /dev/null
+++ b/unix/make/Makefile.BOT
@@ -0,0 +1,47 @@
+.c.$O:
+	$(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -I$(PREFIX)/include $*.c
+
+%.$O: %.c
+	$(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -I$(PREFIX)/include $*.c
+
+
+$(OFILES): $(HFILES)
+
+tgz:
+	rm -rf $(NAME)-$(VERSION)
+	mkdir $(NAME)-$(VERSION)
+	cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION)
+	tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz
+	rm -rf $(NAME)-$(VERSION)
+
+clean:
+	rm -f $(OFILES) $(LIB)
+
+nuke:
+	rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES)
+
+rpm:
+	make tgz
+	cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES
+	rpm -ba rpm.spec
+	cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm .
+	cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm .
+	scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software
+
+PORTDIR=/usr/ports/$(PORTPLACE)
+
+ports:
+	make tgz
+	rm -rf $(PORTDIR)
+	mkdir $(PORTDIR)
+	cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles
+	cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}')
+	(cd $(PORTDIR); make makesum)
+	(cd $(PORTDIR); make)
+	(cd $(PORTDIR); /usr/local/bin/portlint)
+	rm -rf $(PORTDIR)/work
+	shar `find $(PORTDIR)` > ports.shar
+	(cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz
+	scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software
+
+.phony: all clean nuke install tgz rpm ports
diff --git a/unix/make/Makefile.CMD b/unix/make/Makefile.CMD
new file mode 100644
index 0000000..04cd160
--- /dev/null
+++ b/unix/make/Makefile.CMD
@@ -0,0 +1,5 @@
+
+$(TARG): $(OFILES)
+	$(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -L../libutf -L../libfmt -L../libbio -L../libregexp -lregexp9 -lbio -lfmt -lutf
+
+
diff --git a/unix/make/Makefile.LIB b/unix/make/Makefile.LIB
new file mode 100644
index 0000000..9ebf560
--- /dev/null
+++ b/unix/make/Makefile.LIB
@@ -0,0 +1,4 @@
+$(LIB): $(OFILES)
+	$(AR) $(ARFLAGS) $(LIB) $(OFILES)
+
+NUKEFILES+=$(LIB)
diff --git a/unix/make/Makefile.MID b/unix/make/Makefile.MID
new file mode 100644
index 0000000..9c142d4
--- /dev/null
+++ b/unix/make/Makefile.MID
@@ -0,0 +1,41 @@
+LIB=libutf.a
+VERSION=2.0
+PORTPLACE=devel/libutf
+NAME=libutf
+
+OFILES=\
+	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\
+
+HFILES=\
+	utf.h\
+
+all: $(LIB)
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
+	install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
+	install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
+	install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
+	install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
+	install -c -m 0644 utf.h $(PREFIX)/include/utf.h
+	install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
+
diff --git a/unix/make/Makefile.TOP b/unix/make/Makefile.TOP
new file mode 100644
index 0000000..f6abc8c
--- /dev/null
+++ b/unix/make/Makefile.TOP
@@ -0,0 +1,20 @@
+
+# this works in gnu make
+SYSNAME:=${shell uname}
+OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'}
+
+# this works in bsd make
+SYSNAME!=uname
+OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'
+
+# the gnu rules will mess up bsd but not vice versa,
+# hence the gnu rules come first.
+
+include Make.$(SYSNAME)-$(OBJTYPE)
+
+PREFIX=/usr/local
+
+NUKEFILES=
+
+TGZFILES=
+
diff --git a/unix/make/Makefile.bio b/unix/make/Makefile.bio
new file mode 100644
index 0000000..c27b741
--- /dev/null
+++ b/unix/make/Makefile.bio
@@ -0,0 +1,38 @@
+LIB=libbio.a
+VERSION=2.0
+PORTPLACE=devel/libbio
+NAME=libbio
+
+OFILES=\
+	bbuffered.$O\
+	bfildes.$O\
+	bflush.$O\
+	bfmt.$O\
+	bgetc.$O\
+	bgetd.$O\
+	bgetrune.$O\
+	binit.$O\
+	boffset.$O\
+	bprint.$O\
+	bputc.$O\
+	bputrune.$O\
+	brdline.$O\
+	brdstr.$O\
+	bread.$O\
+	bseek.$O\
+	bwrite.$O\
+
+HFILES=\
+	bio.h\
+
+all: $(LIB)
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
+	install -m 0644 bio.3 $(PREFIX)/man/man3/bio.3
+	install -m 0644 bio.h $(PREFIX)/include
+	install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
+
+bcat: bcat.$O $(LIB)
+	$(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf
+
diff --git a/unix/make/Makefile.fmt b/unix/make/Makefile.fmt
new file mode 100644
index 0000000..85e9455
--- /dev/null
+++ b/unix/make/Makefile.fmt
@@ -0,0 +1,64 @@
+LIB=libfmt.a
+VERSION=2.0
+PORTPLACE=devel/libfmt
+NAME=libfmt
+
+NUM=\
+	charstod.$O\
+	pow10.$O\
+
+OFILES=\
+	dofmt.$O\
+	dorfmt.$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\
+	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\
+	$(NUM)\
+	$(NAN)\
+
+HFILES=\
+	fmtdef.h\
+	fmt.h\
+
+all: $(LIB)
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
+	install -m 0644 print.3 $(PREFIX)/man/man3/print.3
+	install -m 0644 fmtinstall.3 $(PREFIX)/man/man3/fmtinstall.3
+	install -m 0644 fmt.h $(PREFIX)/include/fmt.h
+	install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
+
+$(NAN).$O: nan.h
+strtod.$O: nan.h
+
+test: $(LIB) test.$O
+	$(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lutf
+
diff --git a/unix/make/Makefile.mk b/unix/make/Makefile.mk
new file mode 100644
index 0000000..f840b18
--- /dev/null
+++ b/unix/make/Makefile.mk
@@ -0,0 +1,45 @@
+TARG=mk
+VERSION=2.0
+PORTPLACE=devel/mk
+NAME=mk
+
+OFILES=\
+	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\
+
+HFILES=\
+	mk.h\
+	fns.h\
+
+all: $(TARG)
+
+TGZFILES+=mk.pdf
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man1 || mkdir $(PREFIX)/man/man1
+	test -d $(PREFIX)/doc || mkdir $(PREFIX)/doc
+	install -m 0755 mk $(PREFIX)/bin/mk
+	cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a
+	install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1
+	install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf
+
diff --git a/unix/make/Makefile.regexp b/unix/make/Makefile.regexp
new file mode 100644
index 0000000..ec528bd
--- /dev/null
+++ b/unix/make/Makefile.regexp
@@ -0,0 +1,35 @@
+LIB=libregexp9.a
+VERSION=2.0
+PORTPLACE=devel/libregexp9
+NAME=libregexp9
+
+OFILES=\
+	regcomp.$O\
+	regerror.$O\
+	regexec.$O\
+	regsub.$O\
+	regaux.$O\
+	rregexec.$O\
+	rregsub.$O\
+	rregaux.$O\
+
+HFILES=\
+	regexp9.h\
+	regcomp.h\
+
+all: $(LIB)
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
+	test -d $(PREFIX)/man/man7 || mkdir $(PREFIX)/man/man7
+	install -m 0644 regexp9.3 $(PREFIX)/man/man3/regexp9.3
+	install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7
+	install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
+	install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h
+
+test: test.$O $(LIB)
+	$(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf
+
+test2: test2.$O $(LIB)
+	$(CC) -o test2 test2.$O $(LIB) -L/usr/local/lib -lfmt -lutf
+
diff --git a/unix/make/Makefile.utf b/unix/make/Makefile.utf
new file mode 100644
index 0000000..9c142d4
--- /dev/null
+++ b/unix/make/Makefile.utf
@@ -0,0 +1,41 @@
+LIB=libutf.a
+VERSION=2.0
+PORTPLACE=devel/libutf
+NAME=libutf
+
+OFILES=\
+	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\
+
+HFILES=\
+	utf.h\
+
+all: $(LIB)
+
+install: $(LIB)
+	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
+	install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
+	install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
+	install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
+	install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
+	install -c -m 0644 utf.h $(PREFIX)/include/utf.h
+	install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
+