Make ca command silently use default if .attr file does not exist
[openssl.git] / Configurations / unix-Makefile.tmpl
index 590f18d6c898a1002e23b240d739302ee0f1ad19..11fecc259b2f2c50be81a3ab7a88355ca1b68ef1 100644 (file)
@@ -21,7 +21,7 @@
      # libcrypto.a and use libcrypto_a.a as static one.
      sub sharedaix  { !$disabled{shared} && $config{target} =~ /^aix/ }
 
-     our $sover_dirname = $config{shlib_version_number};
+     our $sover_dirname = $config{shlib_version};
      $sover_dirname =~ s|\.|_|g
          if $config{target} =~ /^mingw/;
 
@@ -88,13 +88,10 @@ CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
 SRCDIR={- $config{sourcedir} -}
 BLDDIR={- $config{builddir} -}
 
-VERSION={- $config{version} -}
+VERSION={- "$config{full_version}" -}
 MAJOR={- $config{major} -}
 MINOR={- $config{minor} -}
-SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
-SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
-SHLIB_MAJOR={- $config{shlib_major} -}
-SHLIB_MINOR={- $config{shlib_minor} -}
+SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
 SHLIB_TARGET={- $target{shared_target} -}
 SHLIB_EXT={- $shlibext -}
 SHLIB_EXT_SIMPLE={- $shlibextsimple -}
@@ -231,6 +228,7 @@ TARFLAGS= {- $target{TARFLAGS} -}
 
 BASENAME=       openssl
 NAME=           $(BASENAME)-$(VERSION)
+# Relative to $(SRCDIR)
 TARFILE=        ../$(NAME).tar
 
 ##### Project flags ##################################################
@@ -441,7 +439,7 @@ depend:
 
 # Install helper targets #############################################
 
-install_sw: all install_dev install_engines install_runtime
+install_sw: install_dev install_engines install_runtime
 
 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
 
@@ -495,7 +493,7 @@ install_ssldirs:
                chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
        fi
 
-install_dev:
+install_dev: install_runtime_libs
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @$(ECHO) "*** Installing development files"
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
@@ -528,11 +526,6 @@ install_dev:
                fn1=`basename $$s1`; \
                fn2=`basename $$s2`; \
                : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
-               $(ECHO) "install $$s1 -> $(DESTDIR)$(libdir)/$$fn1"; \
-               cp $$s1 $(DESTDIR)$(libdir)/$$fn1.new; \
-               chmod 755 $(DESTDIR)$(libdir)/$$fn1.new; \
-               mv -f $(DESTDIR)$(libdir)/$$fn1.new \
-                     $(DESTDIR)$(libdir)/$$fn1; \
                if [ "$$fn1" != "$$fn2" ]; then \
                        $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
                        ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
@@ -572,7 +565,7 @@ install_dev:
        @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
        @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
 
-uninstall_dev:
+uninstall_dev: uninstall_runtime_libs
        @$(ECHO) "*** Uninstalling development files"
        @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
        @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
@@ -616,7 +609,7 @@ uninstall_dev:
        -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
        -$(RMDIR) $(DESTDIR)$(libdir)
 
-install_engines:
+install_engines: install_runtime_libs build_engines
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
        @$(ECHO) "*** Installing engines"
@@ -643,13 +636,16 @@ uninstall_engines:
        done
        -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
 
-install_runtime:
+install_runtime: install_programs
+
+install_runtime_libs: build_libs
        @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
-       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
        @ : {- output_off() if windowsdll(); "" -}
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
-       @ : {- output_on() if windowsdll(); "" -}
-       @$(ECHO) "*** Installing runtime files"
+       @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
+       @ : {- output_on() unless windowsdll(); "" -}
+       @$(ECHO) "*** Installing runtime libraries"
        @set -e; for s in dummy $(INSTALL_SHLIBS); do \
                if [ "$$s" = "dummy" ]; then continue; fi; \
                fn=`basename $$s`; \
@@ -667,6 +663,11 @@ install_runtime:
                      $(DESTDIR)$(libdir)/$$fn; \
                : {- output_on() if windowsdll(); "" -}; \
        done
+
+install_programs: install_runtime_libs build_programs
+       @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+       @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
+       @$(ECHO) "*** Installing runtime programs"
        @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
                if [ "$$x" = "dummy" ]; then continue; fi; \
                fn=`basename $$x`; \
@@ -686,8 +687,10 @@ install_runtime:
                      $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
        done
 
-uninstall_runtime:
-       @$(ECHO) "*** Uninstalling runtime files"
+uninstall_runtime: uninstall_programs uninstall_runtime_libs
+
+uninstall_programs:
+       @$(ECHO) "*** Uninstalling runtime programs"
        @set -e; for x in dummy $(INSTALL_PROGRAMS); \
        do  \
                if [ "$$x" = "dummy" ]; then continue; fi; \
@@ -702,6 +705,10 @@ uninstall_runtime:
                $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
                $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
        done
+       -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
+
+uninstall_runtime_libs:
+       @$(ECHO) "*** Uninstalling runtime libraries"
        @ : {- output_off() unless windowsdll(); "" -}
        @set -e; for s in dummy $(INSTALL_SHLIBS); do \
                if [ "$$s" = "dummy" ]; then continue; fi; \
@@ -710,7 +717,6 @@ uninstall_runtime:
                $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
        done
        @ : {- output_on() unless windowsdll(); "" -}
-       -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
 
 
 install_man_docs:
@@ -864,37 +870,8 @@ 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 -cf -
-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|Configurations/.*\.norelease\.conf|`echo $$excl_re | sed -e 's/ /$$|/g'`\$$)"; \
-        echo "$$excl_re"; \
-        git ls-tree -r --name-only --full-tree HEAD \
-        | egrep -v "$$excl_re" \
-        | while read F; do \
-              mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
-              cp $$F $$TMPDIR/$$DISTDIR/$$F; \
-          done); \
-       (cd $$TMPDIR/$$DISTDIR; \
-        $(PREPARE_CMD); \
-        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' TARFILE="$(TARFILE)" NAME="$(NAME)" tar
+       (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
 
 # Helper targets #####################################################
 
@@ -996,6 +973,7 @@ reconfigure reconf:
       my $generator = join(" ", @{$args{generator}});
       my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
+      my $defs = join("", map { " -D".$_ } @{$args{defs}});
       my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
 
       if ($args{src} =~ /\.ld$/) {
@@ -1049,7 +1027,7 @@ EOF
           }
           return <<"EOF";
 $args{src}: $args{generator}->[0] $deps
-       \$(CC) $incs $cppflags -E $args{generator}->[0] | \\
+       \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
        \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
 EOF
       }
@@ -1065,6 +1043,7 @@ EOF
       my $srcs = join(" ",  @srcs);
       my $deps = join(" ", @srcs, @{$args{deps}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
+      my $defs = join("", map { " -D".$_ } @{$args{defs}});
       my $cmd;
       my $cmdflags;
       my $cmdcompile;
@@ -1106,13 +1085,13 @@ EOF
           # hardly a point to drag it along...
           $recipe .= <<"EOF";
 $obj$objext: $deps
-       $cmd $incs $cmdflags -c -o \$\@ $srcs
+       $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
 EOF
       } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
                && !grep /\.rc$/, @srcs) {
           $recipe .= <<"EOF";
 $obj$objext: $deps
-       $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
+       $cmd $incs $defs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
        \@touch $obj$depext.tmp
        \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
                rm -f $obj$depext.tmp; \\
@@ -1123,7 +1102,7 @@ EOF
       } else {
           $recipe .= <<"EOF";
 $obj$objext: $deps
-       $cmd $incs $cmdflags $cmdcompile -o \$\@ $srcs
+       $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
 EOF
           if (defined $makedepprog  && $makedepprog =~ /\/makedepend/) {
               $recipe .= <<"EOF";
@@ -1134,9 +1113,7 @@ EOF
       }
       return $recipe;
   }
-  # On Unix, we build shlibs from static libs, so we're ignoring the
-  # object file array.  We *know* this routine is only called when we've
-  # configure 'shared'.
+  # We *know* this routine is only called when we've configure 'shared'.
   sub obj2shlib {
       my %args = @_;
       my $lib = $args{lib};
@@ -1163,26 +1140,20 @@ EOF
       die "More than one exported symbol map" if scalar @defs > 1;
       my $objs = join(" ", @objs);
       my $deps = join(" ", @objs, @defs, @deps);
-      my $target = shlib_simple($lib);
-      my $target_full = shlib($lib);
+      my $simple = shlib_simple($lib);
+      my $full = shlib($lib);
+      my $target = "$simple $full";
       my $shared_soname = "";
-      $shared_soname .= ' '.$target{shared_sonameflag}.basename($target_full)
+      $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
           if defined $target{shared_sonameflag};
       my $shared_imp = "";
-      $shared_imp .= ' '.$target{shared_impflag}.basename($target)
+      $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
           if defined $target{shared_impflag};
       my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
       my $recipe = <<"EOF";
-# When building 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}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
-# {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
 $target: $deps
        \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
-               -o $target_full$shared_def $objs \\
+               -o $full$shared_def $objs \\
                 $linklibs \$(LIB_EX_LIBS)
 EOF
       if (windowsdll()) {
@@ -1196,14 +1167,14 @@ EOF
 EOF
       } elsif (sharedaix()) {
           $recipe .= <<"EOF";
-       rm -f $target && \\
-       \$(AR) r $target $target_full
+       rm -f $simple && \\
+       \$(AR) r $simple $full
 EOF
       } else {
           $recipe .= <<"EOF";
-       if [ '$target' != '$target_full' ]; then \\
-               rm -f $target; \\
-               ln -s $target_full $target; \\
+       if [ '$simple' != '$full' ]; then \\
+               rm -f $simple; \\
+               ln -s $full $simple; \\
        fi
 EOF
       }
@@ -1311,6 +1282,10 @@ EOF
                       lib => $libext,
                       bin => $exeext );
 
+      # We already have a 'test' target, and the top directory is just plain
+      # silly
+      return if $dir eq "test" || $dir eq ".";
+
       foreach my $type (("dso", "lib", "bin", "script")) {
           next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
           # For lib object files, we could update the library.  However, it
@@ -1331,7 +1306,7 @@ EOF
       my $deps = join(" ", @deps);
       my $actions = join("\n", "", @actions);
       return <<"EOF";
-$args{dir} $args{dir}/: $deps$actions
+$dir $dir/: $deps$actions
 EOF
   }
   ""    # Important!  This becomes part of the template result.