pymake.pymake_base module#

Main pymake function, pymake.main(), that is called when pymake is run from the command line. pymake.main() can also be called directly from a script in combination with pymake.parser().

import pymake
args = pymake.parser()
pymake.main(
    args.srcdir,
    args.target,
    fc=args.fc,
    cc=args.cc,
    makeclean=args.makeclean,
    double=args.double,
    debug=args.debug,
    include_subdirs=args.subdirs,
    fflags=args.fflags,
    cflags=args.cflags,
    syslibs=args.syslibs,
    makefile=args.makefile,
    srcdir2=args.commonsrc,
    extrafiles=args.extrafiles,
    excludefiles=args.excludefiles,
    sharedobject=args.sharedobject,
    appdir=args.appdir,
    verbose=args.verbose,
    inplace=args.inplace,
)

The script could be run from the command line using:

python myscript.py ../src myapp -fc=ifort -cc=icc
get_temporary_directories(appdir=None, target=None)[source]#

Get paths to temporary object, module, and source files.

Parameters:
  • appdir (str) – path for executable

  • target (str) – target name to be appended to the temporary directories. Default is None

Returns:

  • obj_temp (str) – path to temporary object files

  • mod_temp (str) – path to temporary module files

  • src_temp (str) – path to temporary source files

main(srcdir=None, target=None, fc='gfortran', cc='gcc', makeclean=True, double=False, debug=False, include_subdirs=False, fflags=None, cflags=None, syslibs=None, makefile=False, makefile_only=False, dryrun=None, makefiledir='.', srcdir2=None, extrafiles=None, excludefiles=None, sharedobject=False, appdir=None, verbose=False, inplace=False, mesondir=None)[source]#

Main pymake function.

Parameters:
  • srcdir (str) – path for directory containing source files

  • target (str) – executable name or path for executable to create

  • fc (str) – fortran compiler

  • cc (str) – c or cpp compiler

  • makeclean (bool) – boolean indicating if intermediate files should be cleaned up after successful build

  • double (bool) – boolean indicating a compiler switch will be used to create an executable with double precision real variables.

  • debug (bool) – boolean indicating is a debug executable will be built

  • include_subdirs (bool) – boolean indicating source files in srcdir subdirectories should be included in the build

  • fflags (list) – user provided list of fortran compiler flags

  • cflags (list) – user provided list of c or cpp compiler flags

  • syslibs (list) – user provided syslibs

  • makefile (bool) – boolean indicating if a GNU make makefile should be created

  • makefile_only (bool) – boolean indicating if a GNU make makefile should be created without building the target (default is False)

  • dryrun (bool) – deprecated name for makefile_only, which replaced it when the pymake build engine was removed (default is None)

  • makefiledir (str) – GNU make makefile path

  • srcdir2 (str) – additional directory with common source files.

  • extrafiles (str) – path for extrafiles file that contains paths to additional source files to include

  • excludefiles (str) – path for excludefiles file that contains filename of source files to exclude from the build

  • sharedobject (bool) – boolean indicating a shared object will be built

  • appdir (str) – path for executable

  • verbose (bool) – boolean indicating if output will be printed to the terminal

  • inplace (bool) – boolean indicating that the source files in srcdir, srcdir2, and defined in extrafiles will be used directly. If inplace is False, source files will be copied to a directory named srcdir_temp. (default is False)

  • mesondir (str) – Main meson.build file path. the current directory is used when mesondir is None (default is None)

Returns:

returncode – return code

Return type:

int