diff options
Diffstat (limited to 'Makefile.shared')
-rw-r--r-- | Makefile.shared | 38 |
1 files changed, 22 insertions, 16 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"; \ |