Backport the following changes from HEAD:

1.270:
As an effect of revisions 1.261, BUILD_CMD was changed so $(DIRS)
wasn't respected when using it to build different parts of OpenSSL.
1.269 was an attempt to correct that, but unfortunately meant that we
built every part that was given i $(DIRS) 7 times.  This change puts
back the original intent with BUILD_CMD via the new macro
BUILD_ONE_CMD while keeping the intent with RECURSIVE_BUILD_CMD.

1.271:
Document the building macros.
This commit is contained in:
Richard Levitte 2006-02-10 08:52:56 +00:00
parent f0ec771933
commit 6b5f5e3508

View File

@ -195,12 +195,29 @@ BUILDENV= PLATFORM='${PLATFORM}' PROCESSOR='${PROCESSOR}' \
# MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors, # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
# which in turn eliminates ambiguities in variable treatment with -e. # which in turn eliminates ambiguities in variable treatment with -e.
# BUILD_CMD is a generic macro to build a given target in a given
# subdirectory. The target must be given through the shell variable
# `target' and the subdirectory to build in must be given through `dir'.
# This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
# BUILD_ONE_CMD instead.
#
# BUILD_ONE_CMD is a macro to build a given target in a given
# subdirectory if that subdirectory is part of $(DIRS). It requires
# exactly the same shell variables as BUILD_CMD.
#
# RECURSIVE_BUILD_CMD is a macro to build a given target in all
# subdirectories defined in $(DIRS). It requires that the target
# is given through the shell variable `target'.
BUILD_CMD= if [ -d "$$dir" ]; then \ BUILD_CMD= if [ -d "$$dir" ]; then \
( cd $$dir && echo "making $$target in $$dir..." && \ ( cd $$dir && echo "making $$target in $$dir..." && \
$(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \ $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
) || exit 1; \ ) || exit 1; \
fi fi
RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
BUILD_ONE_CMD=\
if echo " $(DIRS) " | grep " $$dir " >/dev/null 2>/dev/null; then \
$(BUILD_CMD); \
fi
reflect: reflect:
@[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV) @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
@ -211,21 +228,21 @@ build_all: build_libs build_apps build_tests build_tools
build_libs: build_crypto build_ssl build_engines build_libs: build_crypto build_ssl build_engines
build_crypto: build_crypto:
@dir=crypto; target=all; $(RECURSIVE_BUILD_CMD) @dir=crypto; target=all; $(BUILD_ONE_CMD)
build_ssl: build_ssl:
@dir=ssl; target=all; $(RECURSIVE_BUILD_CMD) @dir=ssl; target=all; $(BUILD_ONE_CMD)
build_engines: build_engines:
@dir=engines; target=all; $(RECURSIVE_BUILD_CMD) @dir=engines; target=all; $(BUILD_ONE_CMD)
build_apps: build_apps:
@dir=apps; target=all; $(RECURSIVE_BUILD_CMD) @dir=apps; target=all; $(BUILD_ONE_CMD)
build_tests: build_tests:
@dir=test; target=all; $(RECURSIVE_BUILD_CMD) @dir=test; target=all; $(BUILD_ONE_CMD)
build_tools: build_tools:
@dir=tools; target=all; $(RECURSIVE_BUILD_CMD) @dir=tools; target=all; $(BUILD_ONE_CMD)
all_testapps: build_libs build_testapps all_testapps: build_libs build_testapps
build_testapps: build_testapps:
@dir=crypto; target=testapps; $(RECURSIVE_BUILD_CMD) @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
libcrypto$(SHLIB_EXT): libcrypto.a libcrypto$(SHLIB_EXT): libcrypto.a
@if [ "$(SHLIB_TARGET)" != "" ]; then \ @if [ "$(SHLIB_TARGET)" != "" ]; then \