Skip to content

make install and uninstall targets#658

Merged
ZedThree merged 10 commits intov4.1-RCfrom
makefile-install
Aug 16, 2017
Merged

make install and uninstall targets#658
ZedThree merged 10 commits intov4.1-RCfrom
makefile-install

Conversation

@bendudson
Copy link
Contributor

This allows BOUT++ to be installed to a directory, and maintain links to include files, libraries etc.

  • There is currently no documentation or proper testing, so this is not really ready to merge, but here for discussion/tweaking.
  • I have tried to follow the GNU coding standards https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions but probably missed some things.
  • It's up for discussion where we install some things like python, IDL scripts. Experience or similar project examples welcome
  • Hopefully this will make packaging BOUT++ for distributions easier

To test it, run
$ configure
$ make
$ make install prefix=$HOME/tmp/bout++/

This should install everything needed under $HOME/tmp/bout++ in bin, include, lib, share subdirectories. Finer control over installation directories should work though configure in a GNU-ish way.

Then add $HOME/tmp/bout++ to your PATH and try

$ bout-config --all

The examples/make-script code should then compile anywhere, linking against the installed library.

You can also try replacing the examples/conduction makefile with

SOURCEC         = conduction.cxx
include $(shell bout-config --config-file)

which should find make.config using the bout-config script.

dschwoerer and others added 8 commits May 3, 2017 03:12
* Print full release version
* Only put version in configure.ac
New variables BOUT_INCLUDE_PATH, BOUT_LIB_PATH and BOUT_CONFIG_FILE
defined in make.config and bout-config files. These point to the
include paths for cflags, ldflags, and the make.config file.

During configure these variables are set to the working directory,
so the current process of compiling and running in the same directory
still works.

When "make install" is run, these paths are replaced in the installed
scripts, to point to the new locations.

The bout-config script "--prefix" option has been replaced by
"--config-file". This returns the full name of make.config.
A user makefile can be:

    SOURCEC = myfile.cxx

    include $(shell bout-config --config-file)

Alternatively, a more flexible but longer way is to use --cxx (compiler),
--cflags, --ld (linker), --libs

This method captures the flags pulled in by external codes like PETSc,
using the output.make targets in configure. If the make.config method
is used then the path to PETSc (for example) should be consistent with
the path used in configure.

The paths to the IDL and Python libraries can also be accessed using
bout-config --idlpath and --pythonpath to set up environment variables.

Also added a "make uninstall" target, which takes the same DESTDIR
argument as install, and deletes the installed files.
everything already depends on make.config, so I don't
think this is needed (but might be wrong)

This saves having to complicate the make rules or install
config.status somewhere.
@bendudson
Copy link
Contributor Author

Note: The include files are installed under a "bout++" subdirectory, to avoid conflicts with system libraries. This doesn't affect any code because the paths (BOUT_INCLUDE_PATH) is included in the flags, and updated by make install.

Retains the changes to BOUT_VERSION handling,
and the RELEASE tag used in a few places.
Compiling examples away from source directory results in
missing dependency for all. Since config.status isn't needed
this just removes it.

Small fix for installing IDL and python libraries: To avoid install
failing when there are additional files or subdirectories the sources
are more specifically defined (e.g. *.py rather than *)
@bendudson
Copy link
Contributor Author

Now merged in PR #550

Tested that the following ways to install work after installing BOUT++ with
$ make install prefix=$HOME/tmp/

Move examples/conduction outside the source directory (so BOUT_TOP is not a parent directory)

  1. With the current makefile unmodified
    $ make BOUT_TOP=$HOME/tmp/share/bout++

  2. With makefile

    SOURCEC = conduction.cxx
    include $(shell bout-config --config-file)

    $ make

  3. The examples/make-script example, using bout-config to get flags

@bendudson
Copy link
Contributor Author

Passing "--prefix=/some/install/path" to configure also works, same as passing to "make install".

@ZedThree ZedThree changed the base branch from next to v4.1-RC August 16, 2017 16:27
@ZedThree ZedThree merged commit c5ac83c into v4.1-RC Aug 16, 2017
@ZedThree ZedThree deleted the makefile-install branch August 16, 2017 16:27
@ZedThree ZedThree added this to the BOUT-4.1 milestone Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants