Makefile updates from HEAD [see http://cvs.openssl.org/chngview?cn=14099
authorAndy Polyakov <appro@openssl.org>
Tue, 28 Jun 2005 09:10:19 +0000 (09:10 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 28 Jun 2005 09:10:19 +0000 (09:10 +0000)
for further details].

Makefile.org
apps/Makefile
crypto/Makefile
engines/Makefile
test/Makefile

index 88fa37625e643c96f95bb532297ac894e5e9c81e..ba60f70696c510ef9ef0d479800ef907c1aed40d 100644 (file)
@@ -112,6 +112,8 @@ SDIRS=  \
        buffer bio stack lhash rand err \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
        store pqueue
+# keep in mind that the above list is adjusted by ./Configure
+# according to no-xxx arguments...
 
 # tests to perform.  "alltests" is a special word indicating that all tests
 # should be performed.
@@ -146,6 +148,22 @@ HEADER=         e_os.h
 
 all: Makefile build_all openssl.pc
 
+# as we stick to -e, CLEARENV ensures that local variables in lower
+# Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
+# shell, which [annoyingly enough] terminates unset with error if VAR
+# is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
+# which terminates unset with error if no variable was present:-(
+CLEARENV=      TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
+               $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}       \
+               $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}           \
+               $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
+               $${EXHEADER+EXHEADER} $${HEADER+HEADER}         \
+               $${GENERAL+GENERAL} $${CFLAGS+CFLAGS}           \
+               $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}           \
+               $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS}             \
+               $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}     \
+               $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
+
 BUILDENV=      PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
                CC='${CC}' CFLAG='${CFLAG}'                     \
                AS='${CC}' ASFLAG='${CFLAG} -c'                 \
@@ -153,10 +171,10 @@ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
                SDIRS='${SDIRS}' LIBRPATH='${INSTALLTOP}/lib'   \
                INSTALL_PREFIX='${INSTALL_PREFIX}'              \
                INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}'   \
-               MAKEDEPEND='$${TOP}/util/domd $${TOP} -MD ${MAKEDEPPROG}' \
+               MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD ${MAKEDEPPROG}' \
                DEPFLAG='-DOPENSSL_NO_DEPRECATED ${DEPFLAG}'    \
                MAKEDEPPROG='${MAKEDEPPROG}'                    \
-               LDFLAGS='${LDFLAGS}' SHARED_LDFLAGS='${SHARED_LDFLAGS}' \
+               SHARED_LDFLAGS='${SHARED_LDFLAGS}'              \
                KRB5_INCLUDES='${KRB5_INCLUDES}' LIBKRB5='${LIBKRB5}'   \
                EXE_EXT='${EXE_EXT}' SHARED_LIBS='${SHARED_LIBS}'       \
                SHLIB_EXT='${SHLIB_EXT}' SHLIB_TARGET='${SHLIB_TARGET}' \
@@ -169,18 +187,19 @@ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
                SHA1_ASM_OBJ='${SHA1_ASM_OBJ}'                  \
                MD5_ASM_OBJ='${MD5_ASM_OBJ}'                    \
                RMD160_ASM_OBJ='${RMD160_ASM_OBJ}'              \
-               THIS=$${THIS:-$@}
+               THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
+# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
+# which in turn eliminates ambiguities in variable treatment with -e.
 
-BUILD_CMD=if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
-       if [ -d "$$dir" ]; then \
-               (cd $$dir && echo "making $$target in $$dir..." && \
-               $(MAKE) $(BUILDENV) BUILDENV="$(BUILDENV)" $$target ) || exit 1; \
-       else \
-               $(MAKE) $$dir; \
-       fi; fi
+BUILD_CMD=  if [ -d "$$dir" ]; then \
+           (   cd $$dir && echo "making $$target in $$dir..." && \
+               $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
+           ) || exit 1; \
+           fi
+RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
 
 reflect:
-       @[ -n "$(THIS)" ] && $(MAKE) $(THIS) $(BUILDENV)
+       @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
 
 sub_all: build_all
 build_all: build_libs build_apps build_tests build_tools
@@ -250,7 +269,7 @@ do_$(SHLIB_TARGET):
                if [ "${SHLIBDIRS}" = "ssl" -a -n "$(LIBKRB5)" ]; then \
                        libs="$(LIBKRB5) $$libs"; \
                fi; \
-               $(MAKE) -f Makefile.shared $(BUILDENV) \
+               $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
                        LIBNAME=$$i LIBVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR} \
                        LIBCOMPATVERSIONS=";${SHLIB_VERSION_HISTORY}" \
                        LIBDEPS="$$libs $(EX_LIBS)" \
@@ -281,14 +300,8 @@ libclean:
 
 clean: libclean
        rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i && echo "making clean in $$i..." && \
-               $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
-               rm -f $(LIBS); \
-       fi; \
-       done;
+       @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
+       rm -f $(LIBS)
        rm -f openssl.pc
        rm -f speed.* .pure
        rm -f $(TARFILE)
@@ -303,32 +316,20 @@ makefile.one: files
 
 files:
        $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i && echo "making 'files' in $$i..." && \
-               $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
-       fi; \
-       done;
+       @set -e; target=files; $(RECURSIVE_BUILD_CMD)
 
 links:
        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
-       @set -e; target=links; for dir in $(DIRS); do $(BUILD_CMD); done
+       @set -e; target=links; $(RECURSIVE_BUILD_CMD)
 
 gentests:
        @(cd test && echo "generating dummy tests (if needed)..." && \
-       $(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
+       $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on generate );
 
 dclean:
        rm -f *.bak
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i && echo "making dclean in $$i..." && \
-               $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
-       fi; \
-       done;
+       @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
 
 rehash: rehash.time
 rehash.time: certs
@@ -342,29 +343,17 @@ test:   tests
 
 tests: rehash
        @(cd test && echo "testing..." && \
-       $(MAKE) $(BUILDENV) TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
+       $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='${TESTS}' OPENSSL_DEBUG_MEMORY=on tests );
        util/opensslwrap.sh version -a
 
 report:
        @$(PERL) util/selftest.pl
 
 depend:
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i && echo "making dependencies $$i..." && \
-               $(MAKE) $(BUILDENV) depend ) || exit 1; \
-       fi; \
-       done;
+       @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
 
 lint:
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i && echo "making lint $$i..." && \
-               $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
-       fi; \
-       done;
+       @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
 
 tags:
        rm -f TAGS
@@ -435,7 +424,7 @@ dist:
        @$(MAKE) TAR='${TAR}' TARFLAGS='${TARFLAGS}' tar
 
 dist_pem_h:
-       (cd crypto/pem; $(MAKE) $(BUILDENV) pem.h; $(MAKE) clean)
+       (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
 
 install: all install_docs install_sw
 
@@ -453,13 +442,7 @@ install_sw:
        (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
        chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
        done;
-       @set -e; for i in $(DIRS) ;\
-       do \
-       if [ -d "$$i" ]; then \
-               (cd $$i; echo "installing $$i..."; \
-               $(MAKE) $(BUILDENV) install ); \
-       fi; \
-       done
+       @set -e; target=install; $(RECURSIVE_BUILD_CMD)
        @set -e; for i in $(LIBS) ;\
        do \
                if [ -f "$$i" ]; then \
index b6565cca20cd3bcf1e3de74f71eab75adf238e68..0c215e16bc9e8ade0944f57614fe21d5d940a175 100644 (file)
@@ -86,7 +86,7 @@ req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
        shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
                shlib_target="$(SHLIB_TARGET)"; \
        fi; \
-       $(MAKE) -f $(TOP)/Makefile.shared $(BUILDENV) \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
                APPNAME=req OBJECTS="sreq.o $(A_OBJ) $(RAND_OBJ)" \
                LIBDEPS="$(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)" \
                link_app.$${shlib_target}
@@ -158,11 +158,10 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
        else \
          LIBRARIES="$(LIBSSL) $(LIBKRB5) $(LIBCRYPTO)" ; \
        fi; \
-       $(MAKE) -f $(TOP)/Makefile.shared $(BUILDENV) \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
                APPNAME=$(EXE) OBJECTS="$(PROGRAM).o $(E_OBJ)" \
                LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
                link_app.$${shlib_target}
-       @case "../*.dll" in *\**) ;; *) cp -p ../*.dll .;; esac
        -(cd ..; \
          OPENSSL="`pwd`/util/opensslwrap.sh"; export OPENSSL; \
          $(PERL) tools/c_rehash certs)
@@ -835,7 +834,7 @@ speed.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 speed.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 speed.o: ../include/openssl/txt_db.h ../include/openssl/ui.h
 speed.o: ../include/openssl/ui_compat.h ../include/openssl/x509.h
-speed.o: ../include/openssl/x509_vfy.h apps.h speed.c testdsa.h testrsa.h
+speed.o: ../include/openssl/x509_vfy.h testdsa.h testrsa.h apps.h speed.c
 spkac.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 spkac.o: ../include/openssl/buffer.h ../include/openssl/conf.h
 spkac.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
index ee6e507dc7467763c848154e73f62d0aaa590429..879e593d89c54abe1ad4845e0462602508edd477 100644 (file)
@@ -15,6 +15,11 @@ MAKEFILE=       Makefile
 RM=             rm -f
 AR=            ar r
 
+RECURSIVE_MAKE=        [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
+                   (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
+                   $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='${INCLUDES}' $$target ) || exit 1; \
+               done;
+
 PEX_LIBS=
 EX_LIBS=
  
@@ -24,14 +29,6 @@ AFLAGS=$(ASFLAGS)
 
 LIBS=
 
-SDIRS= objects \
-       md2 md4 md5 sha mdc2 hmac ripemd \
-       des rc2 rc4 rc5 idea bf cast \
-       bn ec rsa dsa ecdsa ecdh dh dso engine aes \
-       buffer bio stack lhash rand err \
-       evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
-       store pqueue
-
 GENERAL=Makefile README crypto-lib.com install.com
 
 LIB= $(TOP)/libcrypto.a
@@ -79,34 +76,23 @@ ia64cpuid.s: ia64cpuid.S
        $(CC) $(CFLAGS) -E ia64cpuid.S > $@
 
 testapps:
-       [ -z "$(THIS)" ] || ( if echo ${SDIRS} | fgrep ' des '; \
-       then cd des && $(MAKE) des; fi )
-       [ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) testapps );
+       [ -z "$(THIS)" ] || (   if echo ${SDIRS} | fgrep ' des '; \
+                               then cd des && $(MAKE) -e des; fi )
+       [ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
        @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 
 subdirs:
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making all in crypto/$$i..." && \
-       $(MAKE) $(BUILDENV) INCLUDES='${INCLUDES}' all ) || exit 1; \
-       done;
+       @target=all; $(RECURSIVE_MAKE)
 
 files:
        $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making 'files' in crypto/$$i..." && \
-       $(MAKE) files ); \
-       done;
+       @target=files; $(RECURSIVE_MAKE)
 
 links:
        @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
        @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
        @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
-       @for i in $(SDIRS); do \
-           (cd $$i && echo "making links in crypto/$$i..." && \
-           $(MAKE) links ); \
-       done;
+       @target=links; $(RECURSIVE_MAKE)
 
 lib:   $(LIBOBJ)
        $(AR) $(LIB) $(LIBOBJ)
@@ -119,19 +105,7 @@ shared: buildinf.h lib subdirs
        fi
 
 libs:
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making libs in crypto/$$i..." && \
-       $(MAKE) lib );
-       done;
-
-tests:
-       @[ -z "$(THIS)" ] || (for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making tests in crypto/$$i..." && \
-       $(MAKE) tests ); \
-       done; )
-       @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
+       @target=lib; $(RECURSIVE_MAKE)
 
 install:
        @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
@@ -140,47 +114,26 @@ install:
        (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
        chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
        done;
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making install in crypto/$$i..." && \
-       $(MAKE) install ); \
-       done;
+       @target=install; $(RECURSIVE_MAKE)
 
 lint:
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making lint in crypto/$$i..." && \
-       $(MAKE) lint ); \
-       done;
+       @target=lint; $(RECURSIVE_MAKE)
 
 depend:
-       [ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
-       [ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
-       [ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
-       @[ -z "$(THIS)" ] || (set -e; \
-       for i in $(SDIRS) ; do \
-           (   cd $$i && echo "making depend in crypto/$$i..." && \
-               $(MAKE) INCLUDES='${INCLUDES}' depend \
-           ); \
-       done; )
+       @[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
+       @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+       @[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
+       @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
        @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
 
 clean:
        rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making clean in crypto/$$i..." && \
-       $(MAKE) clean ); \
-       done;
+       @target=clean; $(RECURSIVE_MAKE)
 
 dclean:
        $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
        mv -f Makefile.new $(MAKEFILE)
-       @for i in $(SDIRS) ;\
-       do \
-       (cd $$i && echo "making dclean in crypto/$$i..." && \
-       $(MAKE) dclean ); \
-       done;
+       @target=dclean; $(RECURSIVE_MAKE)
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
index 714c43fac544dd3ac1d7d55dba6e25ff0ce27e6a..b8fb1e9a0a386babd89299fa83e45192281f0aac 100644 (file)
@@ -65,7 +65,7 @@ lib:  $(LIBOBJ)
        @if [ -n "$(SHARED_LIBS)" ]; then \
                set -e; \
                for l in $(LIBNAMES); do \
-                       $(MAKE) -f ../Makefile.shared $(BUILDENV) \
+                       $(MAKE) -f ../Makefile.shared -e \
                                LIBNAME=$$l LIBEXTRAS=e_$$l.o \
                                LIBDEPS='-L.. -lcrypto $(EX_LIBS)' \
                                link_o.$(SHLIB_TARGET); \
index 598609e6fc17d8a0f0725d3b2ba4b912fbf768cb..fc739875ac2eb2b8a224746a350edbd2f37b4d16 100644 (file)
@@ -312,7 +312,7 @@ BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
        else \
                LIBRARIES="$(LIBSSL) $(LIBCRYPTO)"; \
        fi; \
-       $(MAKE) -f $(TOP)/Makefile.shared $(BUILDENV) \
+       $(MAKE) -f $(TOP)/Makefile.shared -e \
                APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
                LIBDEPS="$(PEX_LIBS) $$LIBRARIES $(EX_LIBS)" \
                link_app.$${shlib_target}