-CFLAGS += -DUSE_WCHAR
-
-# If your system has manpath(1), uncomment this. This is most any
-# system that's not OpenBSD or NetBSD. If uncommented, manpage(1) and
-# mandocdb(8) will use manpath(1) to get the MANPATH variable.
-#CFLAGS += -DUSE_MANPATH
-
-# If your system does not support static binaries, comment this,
-# for example on Mac OS X.
-STATIC = -static
-# Linux requires -pthread to statically link with libdb.
-#STATIC += -pthread
-
-CFLAGS += -I/usr/local/include -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
-CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
-PREFIX = /usr/local
-WWWPREFIX = /var/www
-HTDOCDIR = $(WWWPREFIX)/htdocs
-CGIBINDIR = $(WWWPREFIX)/cgi-bin
-BINDIR = $(PREFIX)/bin
-INCLUDEDIR = $(PREFIX)/include/mandoc
-LIBDIR = $(PREFIX)/lib/mandoc
-MANDIR = $(PREFIX)/man
-EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
-INSTALL = install
-INSTALL_PROGRAM = $(INSTALL) -m 0755
-INSTALL_DATA = $(INSTALL) -m 0444
-INSTALL_LIB = $(INSTALL) -m 0644
-INSTALL_SOURCE = $(INSTALL) -m 0644
-INSTALL_MAN = $(INSTALL_DATA)
-
-DBLIB = -L/usr/local/lib -lsqlite3
-DBBIN = mandocdb manpage apropos
-
-all: mandoc preconv demandoc $(DBBIN)
-
-SRCS = Makefile \
- NEWS \
- TODO \
- apropos.1 \
- apropos.c \
- arch.c \
- arch.in \
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+BASEBIN = mandoc demandoc
+DBBIN = makewhatis
+CGIBIN = man.cgi
+
+TESTSRCS = test-dirent-namlen.c \
+ test-fgetln.c \
+ test-fts.c \
+ test-getsubopt.c \
+ test-mmap.c \
+ test-ohash.c \
+ test-reallocarray.c \
+ test-sqlite3.c \
+ test-sqlite3_errstr.c \
+ test-strcasestr.c \
+ test-strlcat.c \
+ test-strlcpy.c \
+ test-strptime.c \
+ test-strsep.c \
+ test-wchar.c
+
+SRCS = arch.c \