Added a top level Makefile to encapsulate the ./bootsrap/ccb.py call.

This commit is contained in:
Jean-Paul Chaput 2015-05-09 23:11:44 +02:00
parent a2d4f01ca3
commit 1b79ef75c9
3 changed files with 112 additions and 12 deletions

81
Makefile Normal file
View File

@ -0,0 +1,81 @@
UNAME_S = $(shell uname -s)
UNAME_R = $(shell uname -r)
# We must use devtoolset-2 only under RHEL6 & clones.
DEVTOOLSET_OPTION =
ifeq ($(UNAME_S),Linux)
ifneq ($(findstring .el6.,$(UNAME_R)),)
DEVTOOLSET_OPTION = --devtoolset-2
endif
ifneq ($(findstring .slsoc6.,$(UNAME_R)),)
DEVTOOLSET_OPTION = --devtoolset-2
endif
endif
SMP_FLAGS =
ifneq ($(shell which nproc 2> /dev/null),)
SMP_FLAGS = -j$(shell nproc)
endif
ISYS_ROOT = $(shell ./bootstrap/coriolisEnv.py --query-isys-root)
INST_ROOT = $(shell ./bootstrap/coriolisEnv.py --query-inst-root)
help:
@echo "============================================================================"; \
echo "Coriolis build & install top Makefile"; \
echo ""; \
echo "This Makefile is only a wrapper around the Coriolis & Chams Builder tool"; \
echo "(./boostrap/ccb.py)"; \
echo ""; \
echo "To build it, simply type (in coriolis/, at the shell prompt):"; \
echo " ego@home:coriolis> make install"; \
echo "To remove the build directory (and keep the software installed):"; \
echo " ego@home:coriolis> make clean_build"; \
echo "To fully remove build & install:"; \
echo " ego@home:coriolis> make uninstall"; \
echo "============================================================================"; \
echo "SMP_FLAGS = $(SMP_FLAGS)" ; \
echo "ISYS_ROOT = $(ISYS_ROOT)" ; \
echo "INST_ROOT = $(INST_ROOT)" ; \
echo "============================================================================";
check_dir:
@if [ "`pwd`" != "${HOME}/coriolis-2.x/src/coriolis" ]; then \
echo "Coriolis uses a fixed directory from the user's root."; \
echo "You must put in:"; \
echo " <${HOME}/coriolis-2.x/src/coriolis>"; \
echo "Instead of:"; \
echo " <`pwd`>"; \
echo "Stopping build."; \
exit 1; \
fi
install: check_dir
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="$(SMP_FLAGS) install"
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="-j1 install" --doc
@echo ""; \
echo "============================================================================"; \
echo "Coriolis has been successfully built"; \
echo "============================================================================"; \
echo "It has been installed under the directory:"; \
echo " $(INST_ROOT)/{bin,lib,lib64,include,share,...}"; \
echo ""; \
echo "You can start the tool by running:"; \
echo " ego@home:~> $(INST_ROOT)/bin/coriolis"; \
echo "============================================================================";
clean_build: check_dir
@echo "Removing the build tree only."; \
echo " $(INST_ROOT)/../build"; \
rm -rf $(INST_ROOT)/../build
uninstall: check_dir
@echo "Removing the whole build & install tree..."; \
echo " $(ISYS_ROOT)"; \
rm -rf $(ISYS_ROOT)

View File

@ -62,9 +62,9 @@ If you want to use the *devel* branch: ::
ego@home:coriolis$ git checkout devel
Then, build the tool, where ``N`` is your number of threads: ::
Then, build the tool: ::
ego@home:coriolis$ ./bootstrap/ccb.py --project=coriolis --make="-jN install"
ego@home:coriolis$ make install
Coriolis gets installed at the root of the following tree: ::
@ -77,7 +77,16 @@ distribution.
Using Coriolis
==============
A helper is provided to setup the environment ``coriolisEnv.py``: ::
The Coriolis main interface can be launched with the command: ::
ego@home:~: ~/coriolis-2.x/<OS>.<DISTRIB>/Release.Shared/install/bin/coriolis
The ``coriolis`` script is tasked to guess it's location and setup appropriatly
the UNIX environment, then lauch ``cgt`` (or *any* command, with the
``--run=<COMMAND>`` option).
Conversely, you can setup the current shell environement for Coriolis by
using the helper ``coriolisEnv.py``, then run any Coriolis tool: ::
ego@home:~$ eval `~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`
ego@home:~$ cgt -V

View File

@ -134,15 +134,17 @@ if __name__ == "__main__":
parser = optparse.OptionParser ()
# Build relateds.
parser.add_option ( "--csh" , action="store_true" , dest="csh" )
parser.add_option ( "--release" , action="store_true" , dest="release" )
parser.add_option ( "--debug" , action="store_true" , dest="debug" )
parser.add_option ( "--devel" , action="store_true" , dest="devel" )
parser.add_option ( "--static" , action="store_true" , dest="static" )
parser.add_option ( "--shared" , action="store_true" , dest="shared" )
parser.add_option ( "--chams" , action="store_true" , dest="chams" )
parser.add_option ( "--no-python", action="store_true" , dest="nopython" )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
parser.add_option ( "--query-inst-root", action="store_true" , dest="queryInstRoot" )
parser.add_option ( "--query-isys-root", action="store_true" , dest="queryISysRoot" )
parser.add_option ( "--csh" , action="store_true" , dest="csh" )
parser.add_option ( "--release" , action="store_true" , dest="release" )
parser.add_option ( "--debug" , action="store_true" , dest="debug" )
parser.add_option ( "--devel" , action="store_true" , dest="devel" )
parser.add_option ( "--static" , action="store_true" , dest="static" )
parser.add_option ( "--shared" , action="store_true" , dest="shared" )
parser.add_option ( "--chams" , action="store_true" , dest="chams" )
parser.add_option ( "--no-python" , action="store_true" , dest="nopython" )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
( options, args ) = parser.parse_args ()
if options.release: buildType = "Release"
@ -253,4 +255,12 @@ if __name__ == "__main__":
if useDevtoolset2:
evalScript = '%s scl enable devtoolset-2 ${SHELL}' % evalScript
if options.queryISysRoot:
print '%s/%s' % (rootDir,osType)
sys.exit( 0 )
if options.queryInstRoot:
print coriolisTop
sys.exit( 0 )
print evalScript