X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configurations%2Funix-Makefile.tmpl;h=b5c6991a48b7055a921afcab23f9839cf41d6880;hp=f67eae59e342d3f804d9d07686b6aa7a7b287b11;hb=8d9535ec3e317641b8e551973c8cfe2ee1c89296;hpb=ef2dfc9902e015de91f015177bdf235c9000839e diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index f67eae59e3..b5c6991a48 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -441,7 +441,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,15 +495,15 @@ 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 - @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} + @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c - @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} + @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @set -e; for i in $(SRCDIR)/include/openssl/*.h \ $(BLDDIR)/include/openssl/*.h; do \ fn=`basename $$i`; \ @@ -528,11 +528,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,12 +567,12 @@ 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}}; "" -} + @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c - @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} + @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} @set -e; for i in $(SRCDIR)/include/openssl/*.h \ $(BLDDIR)/include/openssl/*.h; do \ fn=`basename $$i`; \ @@ -616,7 +611,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 +638,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 +665,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 +689,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 +707,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 +719,6 @@ uninstall_runtime: $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ done @ : {- output_on() unless windowsdll(); "" -} - -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin install_man_docs: @@ -809,9 +817,47 @@ errors: -conf $$E `basename $$E .ec`.c ; \ done ) +{- use File::Basename; + + our @sslheaders = + qw( include/openssl/ssl.h + include/openssl/ssl2.h + include/openssl/ssl3.h + include/openssl/sslerr.h + include/openssl/tls1.h + include/openssl/dtls1.h + include/openssl/srtp.h ); + our @cryptoheaders = + qw( include/internal/dso.h + include/internal/o_dir.h + include/internal/o_str.h + include/internal/err.h + include/internal/sslconf.h ); + our @cryptoskipheaders = ( @sslheaders, + qw( include/openssl/conf_api.h + include/openssl/ebcdic.h + include/openssl/opensslconf.h + include/openssl/symhacks.h ) ); + foreach my $f ( glob(catfile($config{sourcedir}, + 'include','openssl','*.h')) ) { + my $fn = "include/openssl/" . basename($f); + push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders; + } + ""; +-} +CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -} +SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -} ordinals: - ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) - ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) + ( cd $(SRCDIR); \ + $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ + --ordinals util/libcrypto.num \ + --symhacks include/openssl/symhacks.h \ + $(CRYPTOHEADERS) ) + ( cd $(SRCDIR); \ + $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ + --ordinals util/libssl.num \ + --symhacks include/openssl/symhacks.h \ + $(SSLHEADERS)) test_ordinals: ( cd test; \ @@ -826,37 +872,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 + $(SRCDIR)/util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)' # Helper targets ##################################################### @@ -958,14 +975,18 @@ 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$/) { (my $target = $args{src}) =~ s/\.ld$/${defext}/; (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; + my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : ''; + my $ord_name = + $args{generator}->[1] || basename($args{product}, $dsoext); return <<"EOF"; -$target: $args{generator}->[0] $deps - \$(PERL) \$(SRCDIR)/util/mkdef.pl $args{generator}->[1] $mkdef_os > $target +$target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl + \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target EOF } elsif ($args{src} !~ /\.[sS]$/) { if ($args{generator}->[0] =~ m|^.*\.in$|) { @@ -1008,7 +1029,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 } @@ -1024,6 +1045,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; @@ -1065,13 +1087,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; \\ @@ -1082,7 +1104,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"; @@ -1093,9 +1115,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}; @@ -1122,26 +1142,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()) { @@ -1155,14 +1169,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 } @@ -1184,14 +1198,18 @@ EOF my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" } grep { $_ !~ m/\.ld$/ } @{$args{objs}}; + my @defs = map { (my $x = $_) =~ s|\.ld$||; "$x$defext" } + grep { $_ =~ /\.ld$/ } + @{$args{objs}}; my @deps = compute_lib_depends(@{$args{deps}}); my $objs = join(" ", @objs); - my $deps = join(" ", @deps); + my $deps = join(" ", @objs, @defs, @deps); my $target = dso($dso); + my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); return <<"EOF"; -$target: $objs $deps +$target: $deps \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ - -o $target $objs \\ + -o $target$shared_def $objs \\ $linklibs \$(DSO_EX_LIBS) EOF } @@ -1266,6 +1284,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 @@ -1286,7 +1308,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.