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.)
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support
Index: Makefile.org
===================================================================
RCS file: /var/CVSROOT/ssl/Makefile.org,v
retrieving revision 1.1.1.2
retrieving revision 1.6
diff -w -u -r1.1.1.2 -r1.6
--- Makefile.org 20 Sep 2002 21:50:37 -0000 1.1.1.2
+++ Makefile.org 23 Sep 2002 01:54:34 -0000 1.6
@@ -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,36 +211,52 @@
if echo "$(DIRS)" | \
egrep '(^| )(crypto|ssl)( |$$)' > /dev/null 2>&1 && \
[ -n "$(SHARED_LIBS)" ]; then \
- $(MAKE) $(SHARED_LIBS); \
+ $(MAKE) setup-shared; \
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 \
echo "There's no support for shared libraries on this platform" >&2; \
fi
+setup-shared: $(SHARED_LIBS)
+ @$(MAKE) move-shared
+
clean-shared:
@for i in $(SHLIBDIRS); do \
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:
+ mkdir .libs
+
+move-shared: .libs
+ @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 +270,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
@@ -353,6 +372,7 @@
libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
( PATH=/usr/ccs/bin:$$PATH ; export PATH; \
set -x; ${CC} ${SHARED_LDFLAGS} \
+ -R ${INSTALLTOP}/lib \
-G -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-h lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
-z allextract lib$$i.a $$libs ${EX_LIBS} -lc ) || exit 1; \