Unix Makefile: Have manual generation use the same perl script as Windows and VMS
[openssl.git] / Configurations / unix-Makefile.tmpl
index eefb50a8ea0874fe27c1d987f866def9a1f083f6..01f566569f63c939b3852178f90cfb67b9c2be69 100644 (file)
@@ -290,6 +290,7 @@ clean: libclean
        -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
        $(RM) core
        $(RM) tags TAGS
+       $(RM) test/.rnd
        $(RM) openssl.pc libcrypto.pc libssl.pc
        -$(RM) `find . -type l -a \! -path "./.git/*"`
        $(RM) $(TARFILE)
@@ -323,9 +324,6 @@ install_sw: all install_dev install_engines install_runtime
 
 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
 
-doc-nits:
-       $(PERL) util/find-doc-nits.pl -n
-
 install_docs: install_man_docs install_html_docs
 
 uninstall_docs: uninstall_man_docs uninstall_html_docs
@@ -565,109 +563,29 @@ uninstall_runtime:
        @ : {- output_on() unless windowsdll(); "" -}
        -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
 
-# A method to extract all names from a .pod file
-# The first sed extracts everything between "=head1 NAME" and the next =head1
-# The perl command joins all the lines into one
-# The second sed removes the description and turns all commas into spaces
-# VoilĂ , you have a space separated list of names!
-EXTRACT_NAMES=sed -e '1,/^=head1  *NAME *$$/d;/^=head1/,$$d' | \
-              $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \
-              sed -e 's/ - .*$$//;s/,/ /g'
-PROCESS_PODS=\
-       set -e; \
-       here=`cd $(SRCDIR); pwd`; \
-       point=$$here/util/point.sh; \
-       for ds in man1 man3 man5 man7 ; do \
-           SEC=`echo $$ds | sed -e s/man//`; \
-           for p in $(SRCDIR)/doc/$$ds/*.pod; do \
-               fn=`basename $$p .pod`; \
-               Name=$$fn; \
-               NAME=`echo $$fn | tr '[a-z]' '[A-Z]'`; \
-               suf=`eval "echo $$OUTSUFFIX"`; \
-               top=`eval "echo $$OUTTOP"`; \
-               $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \
-               echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \
-               cat $$p | eval "$$GENERATE" \
-                       >  $$top/man$$SEC/$$fn$$suf; \
-               names=`cat $$p | $(EXTRACT_NAMES)`; \
-               ( cd $$top/man$$SEC; \
-                 for n in $$names; do \
-                     comp_n="$$n"; \
-                     comp_fn="$$fn"; \
-                     case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
-                         comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
-                         comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
-                         ;; \
-                     esac; \
-                     if [ "$$comp_n" != "$$comp_fn" ]; then \
-                         echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \
-                         PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \
-                     fi; \
-                 done ); \
-           done; \
-       done
-UNINSTALL_DOCS=\
-       set -e; \
-       here=`cd $(SRCDIR); pwd`; \
-       for ds in man1 man3 man5 man7 ; do \
-           SEC=`echo $$ds | sed -e s/man//`; \
-           for p in $(SRCDIR)/doc/$$ds/*.pod; do \
-               fn=`basename $$p .pod`; \
-               suf=`eval "echo $$OUTSUFFIX"`; \
-               top=`eval "echo $$OUTTOP"`; \
-               echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \
-               $(RM) $$top/man$$SEC/$$fn$$suf; \
-               names=`cat $$p | $(EXTRACT_NAMES)`; \
-               for n in $$names; do \
-                   comp_n="$$n"; \
-                   comp_fn="$$fn"; \
-                   case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
-                       comp_n=`echo "$$n" | tr '[A-Z]' '[a-z]'`; \
-                       comp_fn=`echo "$$fn" | tr '[A-Z]' '[a-z]'`; \
-                       ;; \
-                   esac; \
-                   if [ "$$comp_n" != "$$comp_fn" ]; then \
-                       echo "$(RM) $$top/man$$SEC/$$n$$suf"; \
-                       $(RM) $$top/man$$SEC/$$n$$suf; \
-                   fi; \
-               done; \
-               ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \
-           done; \
-       done
 
 install_man_docs:
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @echo "*** Installing manpages"
-       @\
-       OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
-       OUTTOP="$(DESTDIR)$(MANDIR)"; \
-       GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \
-       $(PROCESS_PODS)
+       $(PERL) $(SRCDIR)/util/process_docs.pl \
+               --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
 
 uninstall_man_docs:
        @echo "*** Uninstalling manpages"
-       @\
-       OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \
-       OUTTOP="$(DESTDIR)$(MANDIR)"; \
-       $(UNINSTALL_DOCS)
+       $(PERL) $(SRCDIR)/util/process_docs.pl \
+               --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
+               --remove
 
 install_html_docs:
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @echo "*** Installing HTML manpages"
-       @\
-       OUTSUFFIX='.$(HTMLSUFFIX)'; \
-       OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
-       GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \
-                          --podpath=apps:crypto:ssl --title=\$$Name \
-                 | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \
-       $(PROCESS_PODS)
+       $(PERL) $(SRCDIR)/util/process_docs.pl \
+               --destdir=$(DESTDIR)$(HTMLDIR) --type=html
 
 uninstall_html_docs:
        @echo "*** Uninstalling manpages"
-       @\
-       OUTSUFFIX='.$(HTMLSUFFIX)'; \
-       OUTTOP="$(DESTDIR)$(HTMLDIR)"; \
-       $(UNINSTALL_DOCS)
+       $(PERL) $(SRCDIR)/util/process_docs.pl \
+               --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
 
 
 # Developer targets (note: these are only available on Unix) #########
@@ -677,6 +595,10 @@ update: generate errors ordinals
 generate: generate_apps generate_crypto_bn generate_crypto_objects \
           generate_crypto_conf generate_crypto_asn1
 
+doc-nits:
+       (cd $(SRCDIR); $(PERL) util/find-doc-nits.pl -n ) >doc-nits
+       if [ -s doc-nits ] ; then cat doc-nits; exit 1; fi
+
 # Test coverage is a good idea for the future
 #coverage: $(PROGRAMS) $(TESTPROGRAMS)
 #      ...