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,
    expedite=args.expedite,
    dryrun=args.dryrun,
    double=args.double,
    debug=args.debug,
    include_subdirs=args.subdirs,
    fflags=args.fflags,
    cflags=args.cflags,
    arch=args.arch,
    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, expedite=False, dryrun=False, double=False, debug=False, include_subdirs=False, fflags=None, cflags=None, syslibs=None, arch='intel64', makefile=False, makefiledir='.', srcdir2=None, extrafiles=None, excludefiles=None, sharedobject=False, appdir=None, verbose=False, inplace=False, networkx=False, meson=False, mesondir='.')[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

  • expedite (bool) – boolean indicating if only out of date source files will be compiled. Clean must not have been used on previous build.

  • dryrun (bool) – boolean indicating if source files should be compiled. Files will be deleted, if makeclean is True.

  • 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

  • arch (str) – Architecture to use for Intel Compilers on Windows (default is intel64)

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

  • 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)

  • networkx (bool) – boolean indicating that the NetworkX python package will be used to create the Directed Acyclic Graph (DAG) used to determine the order source files are compiled in. The NetworkX package tends to result in a unique DAG more often than the standard algorithm used in pymake. (default is False)

  • meson (bool) – boolean indicating that the executable should be built using the meson build system. (default is False)

  • mesondir (str) – Main meson.build file path

Returns:

returncode – return code

Return type:

int