Configurations/unix-Makefile.tmpl: fix HP-UX build.
[openssl.git] / Configurations / unix-Makefile.tmpl
index 16b84a6dbfde5392ed72a9d7f5b3f0acace35e96..dfd80c2071aca4de1900b20220a2137e60d0cc99 100644 (file)
@@ -14,9 +14,9 @@
 
      sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
 
-     our $sover = $config{target} =~ /^mingw/
-         ? $config{shlib_major}."_".$config{shlib_minor}
-         : $config{shlib_major}.".".$config{shlib_minor};
+     our $sover_dirname = $config{shlib_version_number};
+     $sover_dirname =~ s|\.|_|g
+         if $config{target} =~ /^mingw/;
 
      # shlib and shlib_simple both take a static library name and figure
      # out what the shlib name should be.
      sub shlib {
          my $lib = shift;
          return () if $disabled{shared} || $lib =~ /\.a$/;
-         return $unified_info{sharednames}->{$lib} . $shlibext;
+         return $unified_info{sharednames}->{$lib} . '$(SHLIB_EXT)';
      }
      sub shlib_simple {
          my $lib = shift;
          return () if $disabled{shared} || $lib =~ /\.a$/;
 
          if (windowsdll()) {
-             return $lib . $shlibextimport;
+             return $lib . '$(SHLIB_EXT_IMPORT)';
          }
-         return $lib .  $shlibextsimple;
+         return $lib .  '$(SHLIB_EXT_SIMPLE)';
      }
 
      # Easy fixing of static library names
@@ -89,6 +89,9 @@ SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
 SHLIB_MAJOR={- $config{shlib_major} -}
 SHLIB_MINOR={- $config{shlib_minor} -}
 SHLIB_TARGET={- $target{shared_target} -}
+SHLIB_EXT={- $shlibext -}
+SHLIB_EXT_SIMPLE={- $shlibextsimple -}
+SHLIB_EXT_IMPORT={- $shlibextimport -}
 
 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
@@ -160,7 +163,7 @@ LIBDIR={- #
           our $libdir = $config{libdir} || "lib$multilib";
           $libdir -}
 ENGINESDIR={- use File::Spec::Functions;
-              catdir($prefix,$libdir,"engines-$sover") -}
+              catdir($prefix,$libdir,"engines-$sover_dirname") -}
 
 # Convenience variable for those who want to set the rpath in shared
 # libraries and applications
@@ -260,11 +263,13 @@ test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
        @ : {- output_off() if $disabled{tests}; "" -}
        ( cd test; \
+         mkdir -p test-runs; \
          SRCTOP=../$(SRCDIR) \
          BLDTOP=../$(BLDDIR) \
+         RESULT_D=test-runs \
          PERL="$(PERL)" \
          EXE_EXT={- $exeext -} \
-         OPENSSL_ENGINES=../$(BLDDIR)/engines \
+         OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \
          OPENSSL_DEBUG_MEMORY=on \
            $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
        @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@@ -607,7 +612,7 @@ uninstall_html_docs:
 update: generate errors ordinals
 
 generate: generate_apps generate_crypto_bn generate_crypto_objects \
-          generate_crypto_conf generate_crypto_asn1
+          generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
 
 doc-nits:
        (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
@@ -648,6 +653,11 @@ generate_crypto_asn1:
        ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
                                > crypto/asn1/charmap.h )
 
+generate_fuzz_oids:
+       ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
+                               crypto/objects/obj_dat.h \
+                               > fuzz/oids.txt )
+
 # Set to -force to force a rebuild
 ERROR_REBUILD=
 errors:
@@ -676,31 +686,37 @@ tags TAGS: FORCE
 
 # Release targets (note: only available on Unix) #####################
 
+# If your tar command doesn't support --owner and --group, make sure to
+# use one that does, for example GNU tar
 TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
 PREPARE_CMD=:
 tar:
+       set -e; \
        TMPDIR=/var/tmp/openssl-copy.$$$$; \
        DISTDIR=$(NAME); \
        mkdir -p $$TMPDIR/$$DISTDIR; \
        (cd $(SRCDIR); \
+        excl_re=`git submodule status | sed -e 's/^.//' | cut -d' ' -f2`; \
+        excl_re="^(fuzz/corpora|`echo $$excl_re | sed -e 's/ /$$|/g'`\$$)"; \
+        echo "$$excl_re"; \
         git ls-tree -r --name-only --full-tree HEAD \
-         | grep -v '^fuzz/corpora' \
+        | egrep -v "$$excl_re" \
         | while read F; do \
               mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
               cp $$F $$TMPDIR/$$DISTDIR/$$F; \
           done); \
-       (cd $$TMPDIR; \
+       (cd $$TMPDIR/$$DISTDIR; \
         $(PREPARE_CMD); \
-        find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \
-        find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \
-        find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \
-        $(TAR_COMMAND) $$DISTDIR) \
+        find . -type d -print | xargs chmod 755; \
+        find . -type f -print | xargs chmod a+r; \
+        find . -type f -perm -0100 -print | xargs chmod a+x); \
+       (cd $$TMPDIR; $(TAR_COMMAND) $$DISTDIR) \
        | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \
        rm -rf $$TMPDIR
        cd $(SRCDIR); ls -l $(TARFILE).gz
 
 dist:
-       @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar
+       @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' TARFILE="$(TARFILE)" NAME="$(NAME)" tar
 
 # Helper targets #####################################################
 
@@ -722,7 +738,7 @@ libcrypto.pc:
            echo 'exec_prefix=$${prefix}'; \
            echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
            echo 'includedir=$${prefix}/include'; \
-           echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
+           echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
            echo ''; \
            echo 'Name: OpenSSL-libcrypto'; \
            echo 'Description: OpenSSL cryptography library'; \
@@ -840,7 +856,7 @@ EOF
           }
           return <<"EOF";
 $args{src}: $args{generator}->[0] $deps
-       \$(CC) $incs \$(CFLAGS) -E \$< | \\
+       \$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\
        \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
 EOF
       }
@@ -930,14 +946,15 @@ EOF
       my $shlib_target = $target{shared_target};
       my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
       my $target = shlib_simple($lib);
+      my $target_full = shlib($lib);
       return <<"EOF"
 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
 # With all other Unix platforms, we often build a shared library with the
 # SO version built into the file name and a symlink without the SO version
 # It's not necessary to have both as targets.  The choice falls on the
-# simplest, {libname}$shlibextimport for Windows POSIX layers and
-# {libname}$shlibextsimple for the Unix platforms.
+# simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
+# {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
 $target: $lib$libext $deps $ordinalsfile
        \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
                ECHO=\$(ECHO) \\
@@ -945,27 +962,26 @@ $target: $lib$libext $deps $ordinalsfile
                PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
                INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
                LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
-               LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
-               LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
+               LIBNAME=$libname SHLIBVERSION=\$(SHLIB_VERSION_NUMBER) \\
+               STLIBNAME=$lib$libext \\
+               SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
                CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
-               LDFLAGS='\$(LDFLAGS)' \\
-               SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
+               LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
                RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
                link_shlib.$shlib_target
 EOF
          . (windowsdll() ? <<"EOF" : "");
-       rm -f apps/$shlib$shlibext
-       rm -f test/$shlib$shlibext
-       cp -p $shlib$shlibext apps/
-       cp -p $shlib$shlibext test/
+       rm -f apps/$shlib'\$(SHLIB_EXT)'
+       rm -f test/$shlib'\$(SHLIB_EXT)'
+       cp -p $shlib'\$(SHLIB_EXT)' apps/
+       cp -p $shlib'\$(SHLIB_EXT)' test/
 EOF
   }
   sub obj2dso {
       my %args = @_;
-      my $lib = $args{lib};
-      my $libd = dirname($lib);
-      my $libn = basename($lib);
-      (my $libname = $libn) =~ s/^lib//;
+      my $dso = $args{lib};
+      my $dsod = dirname($dso);
+      my $dson = basename($dso);
       my $shlibdeps = join("", map { my $d = dirname($_);
                                      my $f = basename($_);
                                      (my $l = $f) =~ s/^lib//;
@@ -973,17 +989,16 @@ EOF
       my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
       my $shlib_target = $target{shared_target};
       my $objs = join(" ", map { $_.$objext } @{$args{objs}});
-      my $target = dso($lib);
+      my $target = dso($dso);
       return <<"EOF";
 $target: $objs $deps
        \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
                PLATFORM=\$(PLATFORM) \\
-               PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
+               PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
                LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
-               LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\
+               SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
                CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
                SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
-               SHLIB_EXT=$dsoext \\
                LIBEXTRAS="$objs" \\
                link_dso.$shlib_target
 EOF