-# $Id: Makefile,v 1.451 2014/12/09 06:31:03 schwarze Exp $
+# $Id: Makefile,v 1.452 2014/12/09 07:29:42 schwarze Exp $
#
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2011, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
term_ps.o \
tbl_term.o
-MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
+BASE_OBJS = $(MANDOC_HTML_OBJS) \
$(MANDOC_MAN_OBJS) \
$(MANDOC_TERM_OBJS) \
main.o \
out.o \
tree.o
-MAN_OBJS = $(MANDOC_OBJS)
+MAIN_OBJS = $(BASE_OBJS)
-MAKEWHATIS_OBJS = mandocdb.o mansearch_const.o manpath.o
-
-APROPOS_OBJS = mansearch.o mansearch_const.o manpath.o
+DB_OBJS = mandocdb.o \
+ mansearch.o \
+ mansearch_const.o \
+ manpath.o
CGI_OBJS = $(MANDOC_HTML_OBJS) \
cgi.o \
include Makefile.local
-INSTALL_TARGETS = $(BUILD_TARGETS:-build=-install)
-
# === DEPENDENCY HANDLING ==============================================
all: base-build $(BUILD_TARGETS) Makefile.local
base-build: mandoc demandoc
-db-build: makewhatis
-
cgi-build: man.cgi
install: base-install $(INSTALL_TARGETS)
clean:
rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS)
- rm -f mandoc $(MANDOC_OBJS) $(APROPOS_OBJS)
- rm -f makewhatis $(MAKEWHATIS_OBJS)
+ rm -f mandoc $(BASE_OBJS) $(DB_OBJS)
rm -f man.cgi $(CGI_OBJS)
rm -f manpage $(MANPAGE_OBJS)
rm -f demandoc $(DEMANDOC_OBJS)
$(DESTDIR)$(MANDIR)/man7
$(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
-db-install: db-build
+db-install: base-build
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(SBINDIR)
mkdir -p $(DESTDIR)$(MANDIR)/man1
ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/apropos
ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/man
ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/whatis
- $(INSTALL_PROGRAM) makewhatis $(DESTDIR)$(SBINDIR)
+ ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(SBINDIR)/makewhatis
$(INSTALL_MAN) apropos.1 man.1 $(DESTDIR)$(MANDIR)/man1
ln -f $(DESTDIR)$(MANDIR)/man1/apropos.1 \
$(DESTDIR)$(MANDIR)/man1/whatis.1
libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
$(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
-mandoc: $(MAN_OBJS) libmandoc.a
- $(CC) $(LDFLAGS) -o $@ $(MAN_OBJS) libmandoc.a $(DBLIB)
-
-makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
- $(CC) $(LDFLAGS) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a $(DBLIB)
+mandoc: $(MAIN_OBJS) libmandoc.a
+ $(CC) $(LDFLAGS) -o $@ $(MAIN_OBJS) libmandoc.a $(DBLIB)
manpage: $(MANPAGE_OBJS) libmandoc.a
$(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB)
fi
BUILD_TARGETS="base-build"
-[ ${BUILD_DB} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} db-build"
[ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} cgi-build"
+INSTALL_TARGETS="base-install"
+[ ${BUILD_DB} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} db-install"
+[ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
cat << __HEREDOC__
VERSION = ${VERSION}
BUILD_TARGETS = ${BUILD_TARGETS}
+INSTALL_TARGETS = ${INSTALL_TARGETS}
CFLAGS = ${CFLAGS}
DBLIB = ${DBLIB}
STATIC = ${STATIC}
__HEREDOC__
[ ${BUILD_DB} -gt 0 ] && \
- echo "MAN_OBJS = \$(MANDOC_OBJS) \$(APROPOS_OBJS)"
+ echo "MAIN_OBJS = \$(BASE_OBJS) \$(DB_OBJS)"
echo "Makefile.local: written" 1>&2
echo "Makefile.local: written" 1>&3
-/* $Id: main.c,v 1.202 2014/12/05 21:55:04 schwarze Exp $ */
+/* $Id: main.c,v 1.203 2014/12/09 07:29:42 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
};
static int koptions(int *, char *);
+#if HAVE_SQLITE3
+int mandocdb(int, char**);
+#endif
static int moptions(int *, char *);
static void mmsg(enum mandocerr, enum mandoclevel,
const char *, int, int, const char *);
else
++progname;
+#if HAVE_SQLITE3
+ if (0 == strncmp(progname, "mandocdb", 8) ||
+ 0 == strncmp(progname, "makewhatis", 10))
+ return(mandocdb(argc, argv));
+#endif
+
/* Search options. */
memset(&paths, 0, sizeof(struct manpaths));
-/* $Id: mandocdb.c,v 1.178 2014/12/05 16:18:14 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.179 2014/12/09 07:29:42 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
int
-main(int argc, char *argv[])
+mandocdb(int argc, char *argv[])
{
int ch, i;
size_t j, sz;