Address comments.
[openssl.git] / Configurations / unix-Makefile.tmpl
index d416c21495a883bdae5bd3bcdea638c73e6ad8b7..726784f2a8590812efe5817267592c795c1b3e4d 100644 (file)
@@ -82,8 +82,8 @@ LIBDIR={- #
 ENGINESDIR={- use File::Spec::Functions;
               catdir($prefix,$libdir,"engines") -}
 
-MANDIR=$(OPENSSLDIR)/man
-HTMLDIR=$(OPENSSLDIR)/html
+MANDIR=$(INSTALLTOP)/share/man
+HTMLDIR=$(INSTALLTOP)/share/doc/$(BASENAME)/html
 
 MANSUFFIX=ssl
 HTMLSUFFIX=html
@@ -112,6 +112,7 @@ SHARED_LDFLAGS={- $target{shared_ldflag}
                   # $prefix is not /usr.
                   . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
                      ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
+SHARED_RCFLAGS={- $target{shared_rcflag} -}
 
 PERL={- $config{perl} -}
 
@@ -142,9 +143,15 @@ PROCESSOR= {- $config{processor} -}
 
 # The main targets ###################################################
 
-all: Makefile libcrypto.pc libssl.pc openssl.pc $(ENGINES) $(PROGRAMS) $(SCRIPTS) $(TESTPROGS) link-utils
+all: build_libs build_engines build_apps link-utils
 
-test tests: $(TESTPROGS) rehash
+# The pkg-config files depend on the libraries as well as Makefile
+build_libs: libcrypto.pc libssl.pc openssl.pc
+build_engines: $(ENGINES)
+build_apps: $(PROGRAMS) $(SCRIPTS)
+build_tests: $(TESTPROGS)
+
+test tests: build_tests build_apps build_engines rehash
        ( cd test; \
          SRCTOP=../$(SRCDIR) \
          BLDTOP=../$(BLDDIR) \
@@ -156,7 +163,7 @@ list-tests:
 libclean:
        -rm -f `find $(BLDDIR) -name '*$(LIB_EXT)' -o -name '*$(SHLIB_EXT)'`
 
-install: install_sw install_docs
+install: install_sw install_ssldirs install_docs
 
 uninstall: uninstall_docs uninstall_sw
 
@@ -195,6 +202,10 @@ install_docs: install_man_docs install_html_docs
 
 uninstall_docs: uninstall_man_docs uninstall_html_docs
 
+install_ssldirs:
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
+
 install_dev:
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @echo "*** Installing development files"
@@ -406,7 +417,14 @@ PROCESS_PODS=\
                names=`cat $$p | $(EXTRACT_NAMES)`; \
                ( cd $$top/man$$SEC; \
                  for n in $$names; do \
-                     if [ "$$n" != "$$fn" ]; then \
+                     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; \
@@ -429,7 +447,14 @@ UNINSTALL_DOCS=\
                $(RM) $$top/man$$SEC/$$fn$$suf; \
                names=`cat $$p | $(EXTRACT_NAMES)`; \
                for n in $$names; do \
-                   if [ "$$n" != "$$fn" ]; then \
+                   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; \
@@ -550,7 +575,7 @@ dist:
 
 # Helper targets #####################################################
 
-rehash: link-utils copy-certs
+rehash: link-utils copy-certs build_apps
        @if [ -z "$(CROSS_COMPILE)" ]; then \
                (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \
                [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \
@@ -776,6 +801,7 @@ $shlibtarget : $lib\$(LIB_EXT) $deps $ordinalsfile
                CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
                CROSS_COMPILE="\$(CROSS_COMPILE)" \\
                SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\
+               SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\
                link_a.$shlib_target
 EOF
          . (windowsdll() ? <<"EOF" : "");
@@ -841,7 +867,7 @@ $bin\$(EXE_EXT) : $objs $deps
        \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
                PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
                APPNAME=$bin OBJECTS="$objs" \\
-               LIBDEPS="\$(PLIB_LDFLAGS) \$(LDFLAGS) $linklibs \$(EX_LIBS)" \\
+               LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
                CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
                LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
                link_app.$shlib_target
@@ -856,7 +882,8 @@ EOF
                            rel2abs($config{builddir}));
       return <<"EOF";
 $script : $sources
-       \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" $sources > "$script"
+       \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
+           "-o$target{build_file}" $sources > "$script"
        chmod a+x $script
 EOF
   }