1CC = @CC@
2CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes
3OBJECTS = man2html.o cgibase.o abbrev.o strdefs.o
4bindir = $(DESTDIR)$(PREFIX)/usr/bin
5mandir = $(DESTDIR)$(PREFIX)@mandir@
6vardir = $(DESTDIR)$(PREFIX)/var
7httpdir = $(DESTDIR)$(PREFIX)/home/httpd
8cgiowner = nobody
9cgigroup = nobody
10
11all: man2html hman
12
13man2html:	$(OBJECTS)
14	$(CC) $(LDFLAGS) -o man2html $(OBJECTS)
15
16# man2html:	../src/version.h
17
18# This installs the man2html utility
19install:	man2html
20	install -m 755 man2html $(bindir)
21	mkdir -p $(mandir)/man1
22	install -m 644 man2html.1 $(mandir)/man1/man2html.@man1ext@
23
24install-scripts: install-man-scripts install-glimpse-stuff install-hman
25
26# These are the scripts that allow pointing a browser at
27#   http://localhost/cgi-bin/man/man2html
28# to work.
29install-man-scripts:
30	mkdir -p $(httpdir)/cgi-bin/man
31	mkdir -p $(httpdir)/cgi-aux/man
32	install -m 755 scripts/cgi-bin/man/* $(httpdir)/cgi-bin/man
33	install -m 644 scripts/cgi-aux/man/* $(httpdir)/cgi-aux/man
34	install -d -o $(cgiowner) -g $(cgigroup) -m 775 $(vardir)/man2html
35# (aux was renamed to cgi-aux since aux causes problems under DOS)
36
37# If you have installed glimpse, and have compressed man pages,
38# then perhaps you also want these filters.
39install-glimpse-stuff:
40	install -m 644 glimpse_filters $(vardir)/man2html/.glimpse_filters
41
42# In order not to have to type a long command like
43#   netscape http://localhost/cgi-bin/man/man2html?section+topic
44# or
45#   lynx lynxcgi:/home/httpd/cgi-bin/man/man2html?section+topic
46# it is convenient to have some shell script as a wrapper.
47# The script hman can be aliased to man. It uses an environment
48# variable MANHTMLPAGER to find out which browser you use, and
49# you can set MANHTMLHOST if the pages are not on localhost.
50hman: hman.sh
51	rm -f hman
52	sed -e 's,%version%,@version@,' hman.sh > hman
53
54install-hman: hman
55	install -m 555 hman $(bindir)/hman
56	install -m 644 hman.1 $(mandir)/man1/hman.@man1ext@
57
58clean:
59	rm -f core hman man2html $(OBJECTS) *~
60
61spotless:	clean
62	rm -f Makefile
63
64$(OBJECTS): defs.h
65