=================================================================== RCS file: /cvs/mandoc/Makefile,v retrieving revision 1.421 retrieving revision 1.428 diff -u -p -r1.421 -r1.428 --- mandoc/Makefile 2014/07/09 07:30:47 1.421 +++ mandoc/Makefile 2014/08/05 03:02:40 1.428 @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.421 2014/07/09 07:30:47 schwarze Exp $ +# $Id: Makefile,v 1.428 2014/08/05 03:02:40 schwarze Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons # Copyright (c) 2011, 2013, 2014 Ingo Schwarze @@ -19,6 +19,8 @@ VERSION = 1.13.0 # === USER SETTINGS ==================================================== +# --- user settings relevant for all builds ---------------------------- + # Specify this if you want to hard-code the operating system to appear # in the lower-left hand corner of -mdoc manuals. # @@ -32,60 +34,98 @@ VERSION = 1.13.0 # 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 -# makewhatis(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 +CFLAGS += -g -DHAVE_CONFIG_H 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_PROGRAM = $(INSTALL) -m 0555 INSTALL_DATA = $(INSTALL) -m 0444 -INSTALL_LIB = $(INSTALL) -m 0644 +INSTALL_LIB = $(INSTALL) -m 0444 INSTALL_SOURCE = $(INSTALL) -m 0644 INSTALL_MAN = $(INSTALL_DATA) +# --- user settings related to database support ------------------------ + # If you want to build without database support, for example to avoid -# the dependency on SQLite3, comment the following two lines. -DBLIB = -L/usr/local/lib -lsqlite3 -DBBIN = makewhatis manpage apropos -DBBIN += man.cgi +# the dependency on SQLite3, comment the following line. +# However, you won't get apropos(1) and makewhatis(8) in that case. +# +BUILD_TARGETS += db-build +# The remaining settings in this section +# are only relevant if db-build is enabled. +# Otherwise, they have no effect either way. + +# If your system has manpath(1), uncomment this. This is most any +# system that's not OpenBSD or NetBSD. If uncommented, apropos(1) +# and makewhatis(8) will use manpath(1) to get the MANPATH variable. +# +#CFLAGS += -DUSE_MANPATH + +# On some systems, SQLite3 may be installed below /usr/local. +# In that case, uncomment the following two lines. +# +#CFLAGS += -I/usr/local/include +#DBLIB += -L/usr/local/lib + # OpenBSD has the ohash functions in libutil. # Comment the following line if your system doesn't. +# DBLIB += -lutil +SBINDIR = $(PREFIX)/sbin + +# --- user settings related to man.cgi --------------------------------- + +# To build man.cgi, copy cgi.h.example to cgi.h, edit it, +# and enable the following line. +# Obviously, this requires that db-build is enabled, too. +# +#BUILD_TARGETS += cgi-build + +# The remaining settings in this section +# are only relevant if cgi-build is enabled. +# Otherwise, they have no effect either way. + +# If your system does not support static binaries, comment this, +# for example on Mac OS X. +# +STATIC = -static + +# Linux requires -pthread for statical linking. +# +#STATIC += -pthread + +WWWPREFIX = /var/www +HTDOCDIR = $(WWWPREFIX)/htdocs +CGIBINDIR = $(WWWPREFIX)/cgi-bin + # === END OF USER SETTINGS ============================================= -ALLBIN = mandoc preconv demandoc $(DBBIN) +INSTALL_TARGETS = $(BUILD_TARGETS:-build=-install) -all: $(ALLBIN) +BASEBIN = mandoc preconv demandoc +DBBIN = apropos makewhatis +CGIBIN = man.cgi +DBLIB += -lsqlite3 + TESTSRCS = test-fgetln.c \ test-getsubopt.c \ test-mmap.c \ test-ohash.c \ test-reallocarray.c \ + test-strcasestr.c \ test-strlcat.c \ test-strlcpy.c \ - test-strnlen.c \ - test-strptime.c + test-strptime.c \ + test-strsep.c SRCS = LICENSE \ Makefile \ @@ -98,6 +138,7 @@ SRCS = LICENSE \ att.c \ att.in \ cgi.c \ + cgi.h.example \ chars.c \ chars.in \ compat_fgetln.c \ @@ -108,7 +149,6 @@ SRCS = LICENSE \ compat_strcasestr.c \ compat_strlcat.c \ compat_strlcpy.c \ - compat_strnlen.c \ compat_strsep.c \ config.h.post \ config.h.pre \ @@ -134,7 +174,7 @@ SRCS = LICENSE \ makewhatis.8 \ man.7 \ man.c \ - man.cgi.7 \ + man.cgi.8 \ man-cgi.css \ man.h \ man_hash.c \ @@ -150,6 +190,7 @@ SRCS = LICENSE \ mandoc_aux.c \ mandoc_aux.h \ mandoc_char.7 \ + mandoc_html.3 \ mandocdb.c \ manpage.c \ manpath.c \ @@ -237,11 +278,20 @@ COMPAT_OBJS = compat_fgetln.o \ compat_strcasestr.o \ compat_strlcat.o \ compat_strlcpy.o \ - compat_strnlen.o \ compat_strsep.o # === DEPENDENCY HANDLING ============================================== +all: base-build $(BUILD_TARGETS) + +base-build: $(BASEBIN) + +db-build: $(DBBIN) + +cgi-build: $(CGIBIN) + +install: base-install $(INSTALL_TARGETS) + arch.o: arch.in att.o: att.in chars.o: chars.in @@ -250,6 +300,7 @@ msec.o: msec.in roff.o: predefs.in st.o: st.in vol.o: vol.in +cgi.o: cgi.h $(LIBMAN_OBJS): libman.h $(LIBMDOC_OBJS): libmdoc.h @@ -312,17 +363,18 @@ WWW_MANS = apropos.1.html \ mandoc.1.html \ preconv.1.html \ mandoc.3.html \ + mandoc_html.3.html \ mansearch.3.html \ tbl.3.html \ mandoc.db.5.html \ eqn.7.html \ man.7.html \ - man.cgi.7.html \ mandoc_char.7.html \ mdoc.7.html \ roff.7.html \ tbl.7.html \ makewhatis.8.html \ + man.cgi.8.html \ man.h.html \ mandoc.h.html \ mandoc_aux.h.html \ @@ -350,33 +402,53 @@ clean: rm -f $(WWW_MANS) $(WWW_OBJS) rm -rf *.dSYM -install: all +base-install: base-build mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(EXAMPLEDIR) mkdir -p $(DESTDIR)$(LIBDIR) mkdir -p $(DESTDIR)$(INCLUDEDIR) mkdir -p $(DESTDIR)$(MANDIR)/man1 mkdir -p $(DESTDIR)$(MANDIR)/man3 - mkdir -p $(DESTDIR)$(MANDIR)/man5 mkdir -p $(DESTDIR)$(MANDIR)/man7 - $(INSTALL_PROGRAM) $(ALLBIN) $(DESTDIR)$(BINDIR) + $(INSTALL_PROGRAM) $(BASEBIN) $(DESTDIR)$(BINDIR) $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR) - $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_LIB) man.h mandoc.h mandoc_aux.h mdoc.h \ + $(DESTDIR)$(INCLUDEDIR) $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 - $(INSTALL_MAN) mandoc.3 mansearch.3 tbl.3 $(DESTDIR)$(MANDIR)/man3 - $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5 + $(INSTALL_MAN) mandoc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 \ $(DESTDIR)$(MANDIR)/man7 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) -installcgi: all +db-install: db-build + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(SBINDIR) + mkdir -p $(DESTDIR)$(MANDIR)/man1 + mkdir -p $(DESTDIR)$(MANDIR)/man3 + mkdir -p $(DESTDIR)$(MANDIR)/man5 + mkdir -p $(DESTDIR)$(MANDIR)/man8 + $(INSTALL_PROGRAM) apropos $(DESTDIR)$(BINDIR) + ln -f $(DESTDIR)$(BINDIR)/apropos $(DESTDIR)$(BINDIR)/whatis + $(INSTALL_PROGRAM) makewhatis $(DESTDIR)$(SBINDIR) + $(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1 + ln -f $(DESTDIR)$(MANDIR)/man1/apropos.1 \ + $(DESTDIR)$(MANDIR)/man1/whatis.1 + $(INSTALL_MAN) mansearch.3 $(DESTDIR)$(MANDIR)/man3 + $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5 + $(INSTALL_MAN) makewhatis.8 $(DESTDIR)$(MANDIR)/man8 + +cgi-install: cgi-build mkdir -p $(DESTDIR)$(CGIBINDIR) mkdir -p $(DESTDIR)$(HTDOCDIR) + mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1 + mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR) + $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/ + $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/ -installwww: www +www-install: www mkdir -p $(DESTDIR)$(HTDOCDIR)/snapshots $(INSTALL_DATA) $(WWW_MANS) style.css $(DESTDIR)$(HTDOCDIR) $(INSTALL_DATA) $(WWW_OBJS) $(DESTDIR)$(HTDOCDIR)/snapshots @@ -423,7 +495,7 @@ config.h: configure config.h.pre config.h.post $(TESTS rm -f config.log CC="$(CC)" CFLAGS="$(CFLAGS)" VERSION="$(VERSION)" ./configure -.PHONY: clean install installcgi installwww +.PHONY: base-install clean cgi-install db-install install www-install .SUFFIXES: .1 .3 .5 .7 .8 .h .SUFFIXES: .1.html .3.html .5.html .7.html .8.html .h.html