PyMake: a python script to compile Fortran, C, C++ files
Usage: PyMake [-c Config.txt] [-d] [-e EXE] [-f] [-s] [-v] [-vvv] [-h] [--version]
Options:
-c Use
Config.txt for compiler/build configurations (vide infra)
-d Do a DryRun, i.e. go through the source code but do not compile/build anything
-e EXE Make executable EXE
-f Force a re-initialization. I.e. compile/build from scratch with a Clean Start
-s Silent mode (less feedback)
-v Verbose mode (more feedback)
-vvv ExtraVerbose mode (even more feedback, mostly for debugging purposes)
-h Help (this message)
--version Version of PyMake
NB:
- The tool should be run from the top directory, where it will generate a library with objects (unless specified differently with setting LIBMAKE)
- The program source file does not have to be in the top directory, but the tool will generate an object file for it there
- The tool will generate an ".epoch" directory at the top level, to keep track of when source files have been compiled, and if changes have been made to the source files (i.e. if they need to be recompiled)
- Currently, it is limited to Python3, but someday it might be transformed to Python2
An example of the feedback received from the tool:
PyMake -f -e $MSXC/exe/guessrho.exe
F77 files: 0
F90 files: 10
Modules: 5
C files: 0
C++ files: 0
Ordering levels (based on modules)
level 0: 0
level 1: 6
level 2: 3
Found 1 program source files ./guessrho.f90
Reinitializing the compile/build process.
Progress: 10% (1/10)
Progress: 30% (3/10)
Progress: 50% (5/10)
Progress: 70% (7/10)
Progress: 90% (9/10)
Progress: 100% (10/10)
gfortran -Bstatic -o $MSXC/exe/guessrho.exe guessrho.o libguessrho.a
Made the $MSXC/exe/guessrho.exe executable.
Config.txt file contents (default files for MacOSX-GFortran, Linux-GFortran and Linux-Intel are included)
# ----------------------------------------------------------------
# compiler names and flags for MacOSX-GFortran
# ----------------------------------------------------------------
FC = gfortran -ffixed-form
FFLAGS = -O3 -std=legacy -fdefault-real-8 -ffixed-line-length-0 -ffree-line-length-none
FC90 = gfortran -ffree-form
F90FLAGS = -O3 -std=legacy -fdefault-real-8 -ffixed-line-length-0 -ffree-line-length-none
CC = gcc
CFLAGS = -O2
CPP = gpp
CPPFLAGS = -O2
LD = gfortran
LDFLAGS = -Bstatic
BLD = ar
BLDFLAGS = r
RANLIB = ranlib -s -c
# -------------------------------------------------------------------
# needobjs indicates if objects may be replaced by dummies (optional)
# default: false
#
# only the object of the program source file will be kept
# all others will be placed into a library
# -------------------------------------------------------------------
NEEDOBJS = false
# -----------------------------
# name of executable (optional)
# -----------------------------
EXEC =
# ---------------------------------------------------------------------------
# library to be made (optional), let PyMake decide otherwise by leaving blank
# ---------------------------------------------------------------------------
LIBMAKE =
# ---------------------------------------------------------------------
# libraries to read object files from (optional), leave blank otherwise
# NB. can be more than one
# ---------------------------------------------------------------------
LIBREAD =
# -----------------------------------------------------------------
# directory where modules should be stored (optional)
# default is 'ModDir' at the top level of the source code directory
# -----------------------------------------------------------------
MODDIR =
# -------------------------------------------------------------------
# directories with modules from other source codes
# NB. can be more than one
# -------------------------------------------------------------------
MODREAD =