diff options
-rw-r--r-- | Makefile.shared | 38 | ||||
-rwxr-xr-x | util/mkdef.pl | 13 |
2 files changed, 30 insertions, 21 deletions
diff --git a/Makefile.shared b/Makefile.shared index 13129f837c..af2dc8ce85 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -31,6 +31,12 @@ LIBNAME= #APPNAME=foo APPNAME= +# DSTDIR is the directory where the built file should end up in. +DSTDIR=. + +# SRCDIR is the top directory of the source tree. +SRCDIR=. + # OBJECTS contains all the object files to link together into the application. # This must contain at least one object file. #OBJECTS=foo.o @@ -109,11 +115,11 @@ LINK_SO= \ LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \ echo LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ $${SHAREDCMD} $${SHAREDFLAGS} \ - -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ + -o $(DSTDIR)/$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \ LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ $${SHAREDCMD} $${SHAREDFLAGS} \ - -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ + -o $(DSTDIR)/$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \ ) && $(SYMLINK_SO) @@ -122,30 +128,30 @@ SYMLINK_SO= \ prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ if [ -n "$$SHLIB_COMPAT" ]; then \ for x in $$SHLIB_COMPAT; do \ - ( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \ - ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ + ( $(SET_X); rm -f $(DSTDIR)/$$SHLIB$$x$$SHLIB_SUFFIX; \ + ln -s $$prev $(DSTDIR)/$$SHLIB$$x$$SHLIB_SUFFIX ); \ prev=$$SHLIB$$x$$SHLIB_SUFFIX; \ done; \ fi; \ if [ -n "$$SHLIB_SOVER" ]; then \ - ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \ - ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \ + ( $(SET_X); rm -f $(DSTDIR)/$$SHLIB$$SHLIB_SUFFIX; \ + ln -s $$prev $(DSTDIR)/$$SHLIB$$SHLIB_SUFFIX ); \ fi; \ fi -LINK_SO_A= SHOBJECTS="lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO) +LINK_SO_A= SHOBJECTS="$(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO) LINK_SO_O= SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO) LINK_SO_A_VIA_O= \ - SHOBJECTS=lib$(LIBNAME).o; \ + SHOBJECTS=$(DSTDIR)/lib$(LIBNAME).o; \ ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \ - ( echo ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS); \ - ld $(LDFLAGS) -r -o lib$(LIBNAME).o $$ALL lib$(LIBNAME).a $(LIBEXTRAS) ); \ - $(LINK_SO) && ( echo rm -f lib$(LIBNAME).o; rm -f lib$(LIBNAME).o ) + ( echo ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL lib$(LIBNAME).a $(LIBEXTRAS); \ + ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL $(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS) ); \ + $(LINK_SO) && ( echo rm -f $$SHOBJECTS; rm -f $$SHOBJECTS ) LINK_SO_A_UNPACKED= \ UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \ - (cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && \ + (cd $$UNPACKDIR; ar x ../$(DSTDIR)/lib$(LIBNAME).a) && \ ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \ SHOBJECTS=$$UNPACKDIR/*.o; \ $(LINK_SO) && rm -rf $$UNPACKDIR @@ -178,7 +184,7 @@ link_app.gnu: link_a.linux-shared: @if [ $(LIBNAME) != "crypto" -a $(LIBNAME) != "ssl" ]; then $(DO_GNU_SO); else \ - $(PERL) util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \ + $(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \ $(CALC_VERSIONS); \ SHLIB=lib$(LIBNAME).so; \ SHLIB_SUFFIX=; \ @@ -294,7 +300,7 @@ link_a.cygwin: esac; \ SHLIB_SOVER=32; \ extras="$(LIBNAME).def"; \ - $(PERL) util/mkdef.pl 32 $$SHLIB > $$extras; \ + $(PERL) $(SRCDIR)/util/mkdef.pl 32 $$SHLIB > $$extras; \ base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \ fi; \ dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ @@ -312,7 +318,7 @@ link_a.cygwin: cp -p $$dll_name test/ link_app.cygwin: @if expr "$(CFLAGS)" : '.*OPENSSL_USE_APPLINK' > /dev/null; then \ - LIBDEPS="$(TOP)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \ + LIBDEPS="$(SRCDIR)/crypto/applink.o $${LIBDEPS:-$(LIBDEPS)}"; \ export LIBDEPS; \ fi; \ $(LINK_APP) @@ -393,7 +399,7 @@ link_a.solaris: if [ $(LIBNAME) != "crypto" -a $(LIBNAME) != "ssl" ]; then \ ALLSYMSFLAGS="$${MINUSZ}allextract"; \ else \ - $(PERL) util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \ + $(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \ ALLSYMSFLAGS="$${MINUSZ}allextract,-M,$(LIBNAME).map"; \ fi; \ NOALLSYMSFLAGS="$${MINUSZ}defaultextract"; \ diff --git a/util/mkdef.pl b/util/mkdef.pl index 3151800007..ff68d86ecc 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -40,11 +40,12 @@ use lib "."; use configdata; +use File::Spec::Functions; my $debug=0; -my $crypto_num= "util/libeay.num"; -my $ssl_num= "util/ssleay.num"; +my $crypto_num= catfile($config{sourcedir},"util","libeay.num"); +my $ssl_num= catfile($config{sourcedir},"util","ssleay.num"); my $libname; my $do_update = 0; @@ -384,8 +385,9 @@ sub do_defs foreach $file (split(/\s+/,$symhacksfile." ".$files)) { - print STDERR "DEBUG: starting on $file:\n" if $debug; - open(IN,"<$file") || die "unable to open $file:$!\n"; + my $fn = catfile($config{sourcedir},$file); + print STDERR "DEBUG: starting on $fn:\n" if $debug; + open(IN,"<$fn") || die "unable to open $fn:$!\n"; my $line = "", my $def= ""; my %tag = ( (map { $_ => 0 } @known_platforms), @@ -1552,7 +1554,8 @@ sub count_parens #version sub get_openssl_version() { - open (IN, "include/openssl/opensslv.h") || die "Can't open opensslv.h"; + my $fn = catfile($config{sourcedir},"include","openssl","opensslv.h"); + open (IN, "$fn") || die "Can't open opensslv.h"; while(<IN>) { if (/OPENSSL_VERSION_TEXT\s+"OpenSSL (\d\.\d\.)(\d[a-z]*)(-| )/) { |