Merge pull request #164 from atgeirr/remove-gnumakefile

Remove confusing GNUmakefile and document cmake building process.
This commit is contained in:
Atgeirr Flø Rasmussen
2013-03-04 01:20:24 -08:00
3 changed files with 51 additions and 55 deletions

View File

@@ -273,9 +273,3 @@ configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
### clean in-source builds ###
include (OpmDistClean)
opm_dist_clean (${project})
# smart wrapper that auto-parallelizes builds
file (COPY
GNUmakefile
DESTINATION ${PROJECT_BINARY_DIR}
)

View File

@@ -1,43 +0,0 @@
# GNUmakefile is processed before Makefile, which is why we arrive here
# first; when we call the other makefile, then we must specify its real
# name with the -f parameter
# figure out the number of processors from the system, add one and round
# to nearest integer. this is the maximum number of processes we want running
# at the same time (one for each core and one stuck on I/O)
# if we are running this is a VM, then /proc won't be mounted and we revert
# to single CPU processing
CPUINFO:=/proc/cpuinfo
NUM_CPUS:=$(shell test -r $(CPUINFO) && grep -P -c '^processor\t:' $(CPUINFO) || echo 0)
PROCS:=$(shell echo "("$(NUM_CPUS)+1")"/1 | bc)
# use these utilities if they are available
IONICE:=$(shell test -x "$$(which ionice)" && echo ionice -c2 -n7)
NICE:=$(shell test -x "$$(which nice)" && echo nice)
# we do dependency management the right way; don't attempt to cache
export CCACHE_DISABLE:=1
# ignore that there may be files with these names, we are going to call
# the other make regardless
.PHONY: __everything $(MAKECMDGOALS)
# outsource the processing to the real makefile, running in parallel and
# in a nice environment so that it doesn't hog our workstation. if there
# is nothing else happening on the box, then it will run just as fast
# the leading plus makes us run this regardless of options, see
# http://www.gnu.org/software/make/manual/make.html#Instead-of-Execution
__everything:
# only put on a parallel flag if there isn't already one; otherwise we
# get the warning "-jN forced in submake: disabling jobserver mode".
# this have to happen inside the rule, because -j option is removed from
# MAKEFLAGS outside
+@$(IONICE) $(NICE) $(MAKE) --no-print-directory -f Makefile $(if $(findstring -j,$(MAKEFLAGS)),,-j $(PROCS)) $(MAKECMDGOALS)
# automatically generate all the goals we are asked to make and delegate
# processing of them to the real makefile through the dependency (since
# everything depends on the same thing, then we only call the other make
# once). the dummy command is just there to make sure that make doesn't
# show the "Nothing to do for `foo'" message after processing
$(MAKECMDGOALS): __everything
@true

57
README
View File

@@ -115,16 +115,61 @@ If you want to contribute, fork OPM/opm-core on github.
BUILDING
--------
There are two ways to build the opm-core library:
There are two ways to build the opm-core library.
1. As a stand-alone library.
cd opm-core
./configure
make
In this setup we recommend creating an entirely separate directory
outside the directory containing the source code and doing the build
from that separate directory (termed "the build directory"). This
configuration is sometimes referred to as an "out-of-source build".
If you want to install the library:
As an example, consider the following layout in which "opm-core" refers
to the directory containing the package source code as downloaded from
GitHub
workspace
|
+-- build
|
+-- opm-core
| |
| +-- ...
| |
| +-- opm
| |
| +-- ...
We will configure a release-type (optimised) build using traditional
Unix Makefiles within the "build" directory. The following command
configures the build
cd path/to/build
cmake ../opm-core -DCMAKE_BUILD_TYPE=Release
Building the software then amounts to typing
make
in the top-level "build" directory; i.e., the directory from which we
invoked the "cmake" utility. On a multi-core computer system you may
want to build the software in parallel (make(1)'s "job-server" mode) in
order to reduce the total amount of time needed to complete the build.
To do so, replace the above "make" command with
make -j N
or, possibly,
nice -20 make -j N
in which "N" is an integer that should typically not exceed the number
of cores in the system.
Once the library has been built, it can be installed in a central,
system-wide location (often in "/usr/local") through the command
sudo make install
sudo make install
2. As a dune module.
- Put the opm-core directory in the same directory