Commit 6291fb1c authored by Chris McDonough's avatar Chris McDonough

Make 'make inplace' target run 'make install' instead of performing

a setup.py build_ext -i in order to prevent needing to needlessly rebuild
C extensions after a straight 'make' is performed.

Cleaned up makefile and added comments.

Also, moved mkzopeinstance and mkzeoinstance into 'utilities'.  It makes
more sense for 'bin' to be disposable in the face of inplace builds.
parent 9397899c
...@@ -15,6 +15,7 @@ BASE_DIR=<<BASE_DIR>> ...@@ -15,6 +15,7 @@ BASE_DIR=<<BASE_DIR>>
BUILD_BASE=<<BUILD_BASE>> BUILD_BASE=<<BUILD_BASE>>
DISTUTILS_OPTS=<<DISTUTILS_OPTS>> DISTUTILS_OPTS=<<DISTUTILS_OPTS>>
INSTALL_FLAGS=<<INSTALL_FLAGS>> INSTALL_FLAGS=<<INSTALL_FLAGS>>
TESTOPTS=-v1 -e -d lib/python
BUILD_FLAGS=--build-base="${BUILD_BASE}" \ BUILD_FLAGS=--build-base="${BUILD_BASE}" \
--build-lib="${BUILD_BASE}/build-lib" \ --build-lib="${BUILD_BASE}/build-lib" \
--build-scripts="${BUILD_BASE}/build-scripts"\ --build-scripts="${BUILD_BASE}/build-scripts"\
...@@ -28,19 +29,26 @@ CD=cd ...@@ -28,19 +29,26 @@ CD=cd
LN=ln -sf LN=ln -sf
CP=cp CP=cp
.PHONY : clean install uninstall instance untestinst testinst .PHONY : clean install uninstall instance untestinst testinst build unbuild
.PHONY : default .PHONY : default
# default: The default step (invoked when make is called without a target)
default: build default: build
@echo @echo
@echo Zope built. Next, do \'make install\' \(or \'make instance\' @echo Zope built. Next, do \'make install\' \(or \'make instance\'
@echo to run a Zope instance directly from the build directory\). @echo to run a Zope instance directly from the build directory\).
@echo @echo
# build: Do whatever 'setup.py build' implies
build: build:
${PYTHON} "${BASE_DIR}/setup.py" \ ${PYTHON} "${BASE_DIR}/setup.py" \
${DISTUTILS_OPTS} build ${BUILD_FLAGS} ${DISTUTILS_OPTS} build ${BUILD_FLAGS}
# unbuild: Remove the build directory (undo the make build step)
unbuild:
${RMRF} ${BUILD_BASE}
# install: Install a software home.
install: build install: build
${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} install \ ${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} install \
--home="${PREFIX}" ${BUILD_FLAGS} ${INSTALL_FLAGS} --home="${PREFIX}" ${BUILD_FLAGS} ${INSTALL_FLAGS}
...@@ -48,37 +56,52 @@ install: build ...@@ -48,37 +56,52 @@ install: build
@echo Zope binaries installed successfully. @echo Zope binaries installed successfully.
@echo Now run \'${PREFIX}/bin/mkzopeinstance\' @echo Now run \'${PREFIX}/bin/mkzopeinstance\'
inplace: # uninstall: Uninstall a software home.
${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} build_ext -i uninstall:
${RMRF} "${PREFIX}"
# inplace: Install a software home into to the source directory.
#
# Note: We used to run 'build_ext -i' for 'inplace', but that was
# suboptimal because it had a tendency to try to rebuild all of the
# (possibly already-built) extensions that might be built during a
# previous 'make' step. built_ext doesn't understand '--build-base'
# and friends so we can't stop it from doing this easily. So instead,
# we rely on the stock install step and name the prefix as the current
# directory. This is a little less efficient than just building the
# extensions because it also compiles bytecode, but it's more intuitive and
# less expensive in the common case than letting distutils
# potentially rebuild the binaries when we've done that already.
inplace: PREFIX=${BASE_DIR} install
# instance: Do an inplace build and create an instance home in the resulting
# software home.
instance: inplace instance: inplace
${PYTHON} "${BASE_DIR}/bin/mkzopeinstance" . ${PYTHON} "${BASE_DIR}/bin/mkzopeinstance" ${MKZ_FLAGS} "${BASE_DIR}"
# testinst makes an instance home in the build directory without asking # uninstance: Remove the instance files made by make instance (w/ prejudice)
# any questions. this is useful when testing. instances made with uninstance:
# this can be removed via "make untestinst" ${RMRF} "${BASE_DIR}/bin"
testinst: build
${PYTHON} "${BASE_DIR}/setup.py" ${DISTUTILS_OPTS} build_ext -i
${PYTHON} "${BASE_DIR}/bin/mkzopeinstance" --user=admin:admin .
# remove the instance files made with testinst (w/ prejudice)
untestinst:
${RM} "${BASE_DIR}/bin/zopectl.py"
${RM} "${BASE_DIR}/bin/ntservice.py"
${RMRF} "${BASE_DIR}/etc" ${RMRF} "${BASE_DIR}/etc"
${RMRF} "${BASE_DIR}/log" ${RMRF} "${BASE_DIR}/log"
${RMRF} "${BASE_DIR}/var"
${RMRF} "${BASE_DIR}/Products"
uninstall: # testinst: Perform an inplace build and create an instance home in the
${RMRF} "${PREFIX}" # resulting software home without asking questions. Useful when
# performing automated testing.
TESTOPTS=-v1 -e -d lib/python testinst: MKZ_FLAGS=--user=admin:admin
testinst: instance
# test: Do an inplace build and run the Zope test suite.
test: inplace test: inplace
${PYTHON} "${BASE_DIR}/utilities/testrunner.py" ${TESTOPTS} ${PYTHON} "${BASE_DIR}/utilities/testrunner.py" ${TESTOPTS}
clean: # clean: Delete the build files and any binaries/bytecode files in
${RMRF} "${BUILD_BASE}" # the source directory for good measure.
clean: unbuild
${FIND} "${BASE_DIR}" \ ${FIND} "${BASE_DIR}" \
-name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM} -name '*.py[co]' -o -name '*.so' -o -name '*.o' | ${XARGS} ${RM}
clobber: clean untestinst # clobber: Make the source tree 'pristine' again.
clobber: clean uninstance
...@@ -1092,7 +1092,7 @@ distutils.core.setup( ...@@ -1092,7 +1092,7 @@ distutils.core.setup(
author=AUTHOR, author=AUTHOR,
data_files=installed_data_files, data_files=installed_data_files,
scripts=["bin/mkzeoinstance", "bin/mkzopeinstance"], scripts=["utilities/mkzeoinstance", "utilities/mkzopeinstance"],
distclass=ZopeDistribution, distclass=ZopeDistribution,
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment