source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Integrate the makewhatis binary into the mandoc binary just like
@ 2014-12-09  7:29 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-09  7:29 UTC (permalink / raw)
  To: source

Log Message:
-----------
Integrate the makewhatis binary into the mandoc binary
just like we do it on OpenBSD.  Smaller and neater.
While here, let ./configure set INSTALL_TARGETS.

Modified Files:
--------------
    mdocml:
        Makefile
        configure
        main.c
        mandocdb.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -Lmain.c -Lmain.c -u -p -r1.202 -r1.203
--- main.c
+++ main.c
@@ -83,6 +83,9 @@ struct	curparse {
 };
 
 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 *);
@@ -129,6 +132,12 @@ main(int argc, char *argv[])
 		progname = argv[0];
 	else
 		++progname;
+
+#if HAVE_SQLITE3
+	if (0 == strncmp(progname, "mandocdb", 8) ||
+	    0 == strncmp(progname, "makewhatis", 10))
+		return(mandocdb(argc, argv));
+#endif
 
 	/* Search options. */
 
Index: configure
===================================================================
RCS file: /home/cvs/mdocml/mdocml/configure,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lconfigure -Lconfigure -u -p -r1.14 -r1.15
--- configure
+++ configure
@@ -358,12 +358,15 @@ if [ ${BUILD_DB} -eq 0 -a ${BUILD_CGI} -
 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}
@@ -385,7 +388,7 @@ INSTALL_DATA	= ${INSTALL_DATA}
 __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
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/Makefile,v
retrieving revision 1.451
retrieving revision 1.452
diff -LMakefile -LMakefile -u -p -r1.451 -r1.452
--- Makefile
+++ Makefile
@@ -207,18 +207,19 @@ MANDOC_TERM_OBJS = eqn_term.o \
 		   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 \
@@ -265,16 +266,12 @@ WWW_OBJS	 = mdocml.tar.gz \
 
 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)
@@ -295,8 +292,7 @@ distclean: clean
 
 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)
@@ -322,7 +318,7 @@ base-install: base-build
 		$(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
@@ -332,7 +328,7 @@ db-install: db-build
 	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
@@ -358,11 +354,8 @@ Makefile.local config.h: configure ${TES
 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)
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.178 -r1.179
--- mandocdb.c
+++ mandocdb.c
@@ -336,7 +336,7 @@ static	const struct mdoc_handler mdocs[M
 
 
 int
-main(int argc, char *argv[])
+mandocdb(int argc, char *argv[])
 {
 	int		  ch, i;
 	size_t		  j, sz;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-09  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09  7:29 mdocml: Integrate the makewhatis binary into the mandoc binary just like schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).