Argh... That last patch wasn't quite right. This one works a bit better. (Note that build-shared is serialized to allow parallel builds to work.)
-- Howard Chu Chief Architect, Symas Corp. Director, Highland Sun http://www.symas.com http://highlandsun.com/hyc Symas: Premier OpenSource Development and Support > Here's a small patch for the shared library build that allows > you to re-run > make in a directory without unnecessarily recreating the > shared library > files. It moves them into a .libs subdirectory so they'll be > out of the way, > instead of using clean-shared to get rid of them. We build > OpenSSL inside a > larger project and while fixing problems in other directories > we do a lot of > top-level make invocations and it's annoying to have this > trigger a rebuild > all the time. (Because we have dependencies on libcrypto/libssl etc.)
Index: Makefile.org =================================================================== RCS file: /var/CVSROOT/ssl/Makefile.org,v retrieving revision 1.1.1.2 retrieving revision 1.7 diff -w -u -r1.1.1.2 -r1.7 --- Makefile.org 20 Sep 2002 21:50:37 -0000 1.1.1.2 +++ Makefile.org 23 Sep 2002 02:27:12 -0000 1.7 @@ -179,8 +179,8 @@ EDIRS= times doc bugs util include certs ms shlib mt demos perl sf dep VMS WDIRS= windows LIBS= libcrypto.a libssl.a -SHARED_CRYPTO=libcrypto$(SHLIB_EXT) -SHARED_SSL=libssl$(SHLIB_EXT) +SHARED_CRYPTO=.libs/libcrypto$(SHLIB_EXT) +SHARED_SSL=.libs/libssl$(SHLIB_EXT) SHARED_LIBS= SHARED_LIBS_LINK_EXTS= SHARED_LDFLAGS= @@ -194,9 +194,9 @@ HEADER= e_os.h # When we're prepared to use shared libraries in the programs we link here -# we might remove 'clean-shared' from the targets to perform at this stage +# we might remove 'move-shared' from the targets to perform at this stage -all: clean-shared Makefile.ssl sub_all +all: Makefile.ssl sub_all sub_all: @for i in $(DIRS); \ @@ -211,16 +211,16 @@ if echo "$(DIRS)" | \ egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \ [ -n "$(SHARED_LIBS)" ]; then \ - $(MAKE) $(SHARED_LIBS); \ + $(MAKE) .libs; \ fi -libcrypto$(SHLIB_EXT): libcrypto.a +$(SHARED_CRYPTO): libcrypto.a @if [ "$(SHLIB_TARGET)" != "" ]; then \ $(MAKE) SHLIBDIRS=crypto build-shared; \ else \ echo "There's no support for shared libraries on this platform" >&2; \ fi -libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a +$(SHARED_SSL): $(SHARED_CRYPTO) libssl.a @if [ "$(SHLIB_TARGET)" != "" ]; then \ $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \ else \ @@ -232,15 +232,29 @@ if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \ tmp="$(SHARED_LIBS_LINK_EXTS)"; \ for j in $${tmp:-x}; do \ - ( set -x; rm -f lib$$i$$j ); \ + ( set -x; rm -f lib$$i$$j .libs/lib$$i$$j ); \ done; \ fi; \ - ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \ + ( set -x; rm -f lib $$i$(SHLIB_EXT) .libs/lib$$i$(SHLIB_EXT) ); \ if [ "$(PLATFORM)" = "Cygwin" ]; then \ - ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \ + ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a \ + .libs/cyg$$i$(SHLIB_EXT) .libs/lib$$i$(SHLIB_EXT).a ); \ fi; \ done +.libs: $(SHARED_LIBS) + @-mkdir .libs + @$(MAKE) move-shared + +move-shared: + @-for i in $(SHLIBDIRS); do \ + ( set -x; mv lib$$i$(SHLIB_EXT) .libs ); \ + tmp="$(SHARED_LIBS_LINK_EXTS)"; \ + for j in $${tmp:-x}; do \ + ( set -x; mv lib$$i$$j .libs ); \ + done; \ + done + link-shared: @if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \ tmp="$(SHARED_LIBS_LINK_EXTS)"; \ @@ -254,7 +268,10 @@ done; \ fi -build-shared: clean-shared do_$(SHLIB_TARGET) link-shared +build-shared: + @$(MAKE) clean-shared + @$(MAKE) do_$(SHLIB_TARGET) + @$(MAKE) link-shared do_bsd-gcc-shared: do_gnu-shared do_linux-shared: do_gnu-shared