Adapt *.tmpl to generate docs at build time
authorRichard Levitte <levitte@openssl.org>
Wed, 31 Aug 2016 20:57:25 +0000 (22:57 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 29 Nov 2019 08:51:17 +0000 (09:51 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6236)

Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
INSTALL

index 28e7663a54f5ed2462e09fcf7c8e1a1f65c1a020..cb1fd9c5b573635ce35d69ad85ccb5db3fa970ed 100644 (file)
@@ -143,6 +143,10 @@ INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
+HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
+HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
+HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
+HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 catfile("apps","openssl") -}
@@ -405,7 +409,7 @@ NODEBUG=@
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
+{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
 {- dependmagic('build_libs'); -} : build_libs_nodep
 {- dependmagic('build_modules'); -} : build_modules_nodep
 {- dependmagic('build_programs'); -} : build_programs_nodep
@@ -415,18 +419,23 @@ build_libs_nodep : $(LIBS), $(SHLIBS)
 build_modules_nodep : $(MODULES)
 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
 
+build_docs: build_html_docs
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 # Kept around for backward compatibility
 build_apps build_tests : build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
        @ ! {- output_off() if $disabled{makedepend}; "" -}
        @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
        @ WRITE SYS$OUTPUT "         target system doesn't have $(PERL),"
        @ WRITE SYS$OUTPUT "         then make will fail..."
        @ ! {- output_on() if $disabled{makedepend}; "" -}
 
+all : build_sw build_docs
+
 test : tests
 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
         @ ! {- output_off() if $disabled{tests}; "" -}
@@ -459,7 +468,9 @@ list-tests :
         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
         @ ! {- output_on() if !$disabled{tests}; "" -}
 
-install : install_sw install_ssldirs install_docs
+install : install_sw install_ssldirs install_docs install_final
+
+install_final :
         @ WRITE SYS$OUTPUT ""
         @ WRITE SYS$OUTPUT "######################################################################"
         @ WRITE SYS$OUTPUT ""
@@ -496,6 +507,10 @@ libclean :
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
 
 clean : libclean
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
         {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
@@ -659,11 +674,21 @@ vmsconfig.pm : configdata.pm
         WRITE CONFIG "1;"
         CLOSE CONFIG
 
-install_html_docs : check_INSTALLTOP
-        sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
-        $(PERL) {- sourcefile("util", "process_docs.pl") -} -
-                --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
-                --type=html
+install_html_docs : check_INSTALLTOP build_html_docs
+        @ WRITE SYS$OUTPUT "*** Installing HTML docs"
+        - CREATE/DIR ossl_installroot:[HTML.MAN1]
+        - CREATE/DIR ossl_installroot:[HTML.MAN3]
+        - CREATE/DIR ossl_installroot:[HTML.MAN5]
+        - CREATE/DIR ossl_installroot:[HTML.MAN7]
+        {- join("\n        ",
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
+                  @{$unified_info{htmldocs}->{man1}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
+                  @{$unified_info{htmldocs}->{man3}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
+                  @{$unified_info{htmldocs}->{man5}} ),
+                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
+                  @{$unified_info{htmldocs}->{man7}} )) -}
 
 check_INSTALLTOP :
         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
@@ -756,7 +781,17 @@ reconfigure reconf :
       my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
       my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+         my $title = basename($args{src}, ".html");
+         return <<"EOF";
+$args{src}: $args{generator}->[0]
+       pipe pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. -
+                      --podpath=man1:man3:man5:man7 "--infile=\$<" -
+                     "--title=$title" -
+       | \$(PERL) -pe "s|href=""http://man\\.he\\.net/(man\d/[^""]+)(?:\\.html)?""|href=""../\$1.html|g;" -
+       > \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           my $mkdef = sourcefile('util', 'mkdef.pl');
           my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
index 6113ab4a34ea9c7957fbcee1040a99fd487463c1..c3c83f95cd0ba4e68d09130747b62b5b405f70c4 100644 (file)
@@ -162,6 +162,38 @@ MISC_SCRIPTS={-
                                && $unified_info{attributes}->{scripts}->{$_}->{misc} }
                         @{$unified_info{scripts}}))
 -}
+HTMLDOCS1={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man1}})) -}
+HTMLDOCS3={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man3}})) -}
+HTMLDOCS5={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man5}})) -}
+HTMLDOCS7={-
+        join(" \\\n" . ' ' x 10,
+             fill_lines(" ", $COLUMNS - 10, map { platform->bin($_) }
+                        @{$unified_info{htmldocs}->{man7}})) -}
+MANDOCS1={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man1}})) -}
+MANDOCS3={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man3}})) -}
+MANDOCS5={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man5}})) -}
+MANDOCS7={-
+        join(" \\\n" . ' ' x 9,
+             fill_lines(" ", $COLUMNS - 9, map { platform->bin($_) }
+                        @{$unified_info{mandocs}->{man7}})) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 catfile("apps","openssl") -}
@@ -387,11 +419,15 @@ LANG=C
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
+{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
 {- dependmagic('build_libs'); -}: build_libs_nodep
 {- dependmagic('build_modules'); -}: build_modules_nodep
 {- dependmagic('build_programs'); -}: build_programs_nodep
 
+build_docs: build_man_docs build_html_docs
+build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 build_generated: $(GENERATED_MANDATORY)
 build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
 build_modules_nodep: $(MODULES)
@@ -402,13 +438,15 @@ build_apps build_tests: build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
        @ : {- output_off() if $disabled{makedepend}; "" -}
        @echo "Warning: consider configuring with no-makedepend, because if"
        @echo "         target system doesn't have $(PERL),"
        @echo "         then make will fail..."
        @ : {- output_on() if $disabled{makedepend}; "" -}
 
+all: build_sw build_docs
+
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
        @ : {- output_off() if $disabled{tests}; "" -}
@@ -458,6 +496,8 @@ libclean:
        $(RM) *{- platform->defext() -}
 
 clean: libclean
+       $(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+       $(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7)
        $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
        $(RM) $(GENERATED_MANDATORY) $(GENERATED)
        -$(RM) `find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -print`
@@ -764,29 +804,131 @@ uninstall_runtime_libs:
        @ : {- output_on() unless windowsdll(); "" -}
 
 
-install_man_docs:
+install_man_docs: build_man_docs
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7
        @$(ECHO) "*** Installing manpages"
-       $(PERL) $(SRCDIR)/util/process_docs.pl \
-               --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
+       @set -e; for x in dummy $(MANDOCS1); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$$fn"; \
+               cp $$x $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+               chmod 755 $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS3); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$$fn"; \
+               cp $$x $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+               chmod 755 $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS5); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$$fn"; \
+               cp $$x $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+               chmod 755 $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS7); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$$fn"; \
+               cp $$x $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+               chmod 755 $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+       done
 
 uninstall_man_docs:
        @$(ECHO) "*** Uninstalling manpages"
-       $(PERL) $(SRCDIR)/util/process_docs.pl \
-               --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
-               --remove
+       @set -e; for x in dummy $(MANDOCS1); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$$fn"; \
+               $(RM) $(DESTDIR)$(MANDIR)/man1/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS3); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$$fn"; \
+               $(RM) $(DESTDIR)$(MANDIR)/man3/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS5); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$$fn"; \
+               $(RM) $(DESTDIR)$(MANDIR)/man5/$$fn$(MANSUFFIX); \
+       done
+       @set -e; for x in dummy $(MANDOCS7); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$$fn"; \
+               $(RM) $(DESTDIR)$(MANDIR)/man7/$$fn$(MANSUFFIX); \
+       done
 
-install_html_docs:
+install_html_docs: build_html_docs
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7
        @$(ECHO) "*** Installing HTML manpages"
-       $(PERL) $(SRCDIR)/util/process_docs.pl \
-               --destdir=$(DESTDIR)$(HTMLDIR) --type=html
+       @set -e; for x in dummy $(HTMLDOCS1); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
+               cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+               chmod 755 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS3); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
+               cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+               chmod 755 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS5); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
+               cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+               chmod 755 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS7); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
+               cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+               chmod 755 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+       done
 
 uninstall_html_docs:
-       @$(ECHO) "*** Uninstalling manpages"
-       $(PERL) $(SRCDIR)/util/process_docs.pl \
-               --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
-
+       @$(ECHO) "*** Uninstalling HTML manpages"
+       @set -e; for x in dummy $(HTMLDOCS1); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
+               $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS3); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
+               $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS5); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
+               $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \
+       done
+       @set -e; for x in dummy $(HTMLDOCS7); do \
+               if [ "$$x" = "dummy" ]; then continue; fi; \
+               fn=`basename $$x`; \
+               $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
+               $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \
+       done
 
 # Developer targets (note: these are only available on Unix) #########
 
@@ -1027,7 +1169,25 @@ reconfigure reconf:
       my $defs = join("", map { " -D".$_ } @{$args{defs}});
       my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+         my $title = basename($args{src}, ".html");
+         return <<"EOF";
+$args{src}: $args{generator}->[0]
+       pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
+                --podpath=man1:man3:man5:man7 "--infile=\$<" "--title=$title" \\
+       | \$(PERL) -pe 's|href="http://man\\.he\\.net/(man\\d/[^"]+)(?:\\.html)?"|href="../\$1.html|g;' \\
+       > \$\@
+EOF
+      } elsif ($args{src} =~ /\.(\d)$/) {
+         my $section = $1;
+         my $name = uc basename($args{src}, ".$section");
+         return <<"EOF";
+$args{src}: $args{generator}->[0]
+       pod2man --name=$name --section=$section --center=OpenSSL \\
+               --release=\$(VERSION) \$< \\
+       > \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
           my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
index d0bce736647a8ca270bdd1e21b6784e407e6fbdf..7bc09df78d551b0bfbb9133fb9c677e08ceb3684 100644 (file)
@@ -111,6 +111,10 @@ MISC_SCRIPTS={-
                          && $unified_info{attributes}->{scripts}->{$_}->{misc} }
                   @{$unified_info{scripts}})
 -}
+HTMLDOCS1={- join(" ", @{$unified_info{htmldocs}->{man1}}) -}
+HTMLDOCS3={- join(" ", @{$unified_info{htmldocs}->{man3}}) -}
+HTMLDOCS5={- join(" ", @{$unified_info{htmldocs}->{man5}}) -}
+HTMLDOCS7={- join(" ", @{$unified_info{htmldocs}->{man7}}) -}
 
 APPS_OPENSSL={- use File::Spec::Functions;
                 "\"".catfile("apps","openssl")."\"" -}
@@ -338,11 +342,14 @@ PROCESSOR= {- $config{processor} -}
 
 # The main targets ###################################################
 
-{- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
+{- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
 {- dependmagic('build_libs'); -}: build_libs_nodep
 {- dependmagic('build_modules'); -}: build_modules_nodep
 {- dependmagic('build_programs'); -}: build_programs_nodep
 
+build_docs: build_html_docs
+build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
+
 build_generated: $(GENERATED_MANDATORY)
 build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
 build_modules_nodep: $(MODULES)
@@ -353,13 +360,15 @@ build_apps build_tests: build_programs
 
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
-build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
+build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
        @{- output_off() if $disabled{makedepend}; "" -}
        @$(ECHO) "Warning: consider configuring with no-makedepend, because if"
        @$(ECHO) "         target system doesn't have $(PERL),"
        @$(ECHO) "         then make will fail..."
        @{- output_on() if $disabled{makedepend}; "" -}
 
+all: build_sw build_docs
+
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep
        @{- output_off() if $disabled{tests}; "" -}
@@ -393,6 +402,10 @@ libclean:
        -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
 
 clean: libclean
+       -rmdir /Q /S $(HTMLDOCS1)
+       -rmdir /Q /S $(HTMLDOCS3)
+       -rmdir /Q /S $(HTMLDOCS5)
+       -rmdir /Q /S $(HTMLDOCS7)
        {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
        -del /Q /F $(MODULES)
        -del /Q /F $(SCRIPTS)
@@ -496,9 +509,21 @@ install_programs: install_runtime_libs build_programs
 
 uninstall_runtime:
 
-install_html_docs:
-        "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
-                "--destdir=$(INSTALLTOP)\html" --type=html
+install_html_docs: build_html_docs
+       @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
+       @echo *** Installing HTML docs
+       @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1"
+       @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3"
+       @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5"
+       @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7"
+       @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \
+                                        "$(INSTALLTOP)\html\man1"
+       @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \
+                                        "$(INSTALLTOP)\html\man3"
+       @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \
+                                        "$(INSTALLTOP)\html\man5"
+       @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \
+                                        "$(INSTALLTOP)\html\man7"
 
 uninstall_html_docs:
 
@@ -540,7 +565,16 @@ reconfigure reconf:
       my $deps = @{$args{deps}} ?
           '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
 
-      if (platform->isdef($args{src})) {
+      if ($args{src} =~ /\.html$/) {
+         my $title = basename($args{src}, ".html");
+         return <<"EOF";
+$args{src}: $args{generator}->[0]
+       pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
+                --podpath=man1:man3:man5:man7 "--infile=\$<" "--title=$title" \\
+       | \$(PERL) -pe "s|href=\\"http://man\\.he\\.net/(man\d/[^\\"]+)(?:\\.html)?\\"|href=\\"../\$1.html|g;" \\
+       > \$\@
+EOF
+      } elsif (platform->isdef($args{src})) {
           my $target = platform->def($args{src});
           my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
                                               "util", "mkdef.pl")),
diff --git a/INSTALL b/INSTALL
index 0bddf761a187dc0c1a2b16e794456accac81bab4..1c8b5801142dccff79ad788d852387aabbc0beca 100644 (file)
--- a/INSTALL
+++ b/INSTALL
  described here. Examine the Makefiles themselves for the full list.
 
  all
-                The default target to build all the software components.
+                The target to build all the software components and
+                documentation.
+
+ build_sw
+                Build all the software components.
+                THIS IS THE DEFAULT TARGET.
+
+ build_docs
+                Build all documentation components.
 
  clean
                 Remove all build artefacts and return the directory to a "clean"