MakeFile Class¶
The MakeFile class acts as a representation of a single Makefile on the filesystem. Typically you create one of these as a starting point and the other class’s are created underneath automatically during the parsing of the Makefile
As a basic example
from py_makefile_dbparse.makefile import MakeFile
# Read in the Makefile from the src directory underneath the current working directory
mk1 = MakeFile('src')
# Read in / parse the make database output
mk1.read_db()
# Parse everything from the database text
mk1.read_all()
# Expand a variable
expanded_var = mk1.vars.expand_var('OBJ')
Class Description¶
-
class
MakeFile
¶ Represents a Makefile database.
Public Functions
-
__init__
(makefile_path)¶ Class initialiser.
- Parameters
makefile_path
: The path to the Makefile (file or directory).
-
read_db
()¶ Read in the Makefile database as text.
- Return
The Makefile database as text.
-
dump_db
(filepath)¶ Write the Makefile database output as a text file.
- Parameters
filepath
: The path to the file to write to.
-
parse_targets
()¶ Generate a list of all targets defined in the make process.
- Return
The targets parsed from the Makefile database.
-
parse_vars
()¶ Generate the (key,value) dict of all variables defined in the make process.
- Return
The (key,value) dict of all variables defined in the make process.
-
read_all
()¶ Read / Parse all from the Makefile database.
-