Parallel Make  1.0
My implementation of make utility, which can run in multiple threads according to user request.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
makefile_record Class Reference

Class for storing single records in Makefile. Record in makefile has following syntax: target [...] : [dependency] [...] [command] [...] Where commands line have to start with at least one white space character. More...

#include <makefile_record.hpp>

Public Types

using dependencies = std::vector< file >
 
using targets = std::vector< file >
 

Public Member Functions

 makefile_record (std::vector< std::string > &&targets, std::vector< std::string > &&dependencies, const pmake_options &options)
 
bool is_recent (const file &tar) const
 
const file & get_target () const
 
const dependencies & get_dependencies () const
 
bool has_target (const file &tar) const
 
dependencies get_dependencies_stripped () const
 
dependencies get_dependencies_recent () const
 
int execute (bool only_print=false)
 
bool is_built () const
 
void add_command (std::string &&command)
 
void set_being_processed ()
 Sets inner process state to being processed. More...
 
bool is_being_processed ()
 
void set_process_state (process_states state)
 
process_states get_process_state ()
 

Detailed Description

Class for storing single records in Makefile. Record in makefile has following syntax: target [...] : [dependency] [...] [command] [...] Where commands line have to start with at least one white space character.

!

Member Typedef Documentation

using makefile_record::dependencies = std::vector<file>
using makefile_record::targets = std::vector<file>

Constructor & Destructor Documentation

makefile_record::makefile_record ( std::vector< std::string > &&  targets,
std::vector< std::string > &&  dependencies,
const pmake_options &  options 
)

Constructs makefile record with given arguments.

Parameters
targetsstd::vector of targets.
dependenciesstd::vector of dependencies.
optionsConst reference to options.

Member Function Documentation

void makefile_record::add_command ( std::string &&  command)
inline

Appends new command for this makefile_record.

Parameters
commandcommand to be added.
int makefile_record::execute ( bool  only_print = false)

Executes commands for this makefile_record.

Parameters
only_printif true, commands are only outputted to stdout.
Returns
return value of first command to fail, or 0 if all commands returned 0.
const dependencies& makefile_record::get_dependencies ( ) const
inline

Gets dependencies of this makefile_record.

Returns
const reference to std::vector of file.
makefile_record::dependencies makefile_record::get_dependencies_recent ( ) const

Returns new std::vector of dependencies more recent than default target.

Returns
std::vector of file.
makefile_record::dependencies makefile_record::get_dependencies_stripped ( ) const

Returns new std::vector of dependencies without duplicities.

Returns
std::vector of file.
process_states makefile_record::get_process_state ( )
inline

Gets current process state.

Returns
current process state.
const file& makefile_record::get_target ( ) const
inline

Gets default target of this makefile_record.

Returns
const reference to file object containing target.
bool makefile_record::has_target ( const file &  tar) const
inline

Checks, whether argument is member of targets of this makefile_record.

Parameters
tartarget to look for.
Returns
true if there is, false otherwise.
bool makefile_record::is_being_processed ( )
inline

Checks, whether this record is currently being processed.

Returns
true if it is, false otherwise.
bool makefile_record::is_built ( ) const
inline

Checks whether commands for this makefile_record has already been executed.

Returns
true if it was, false otherwise.
bool makefile_record::is_recent ( const file &  tar) const

Checks, whether all dependencies are more recent than file argument.

Parameters
tarto check against.
Returns
true if all dependencies of this makefile_record are more recent than tar, false otherwise.
void makefile_record::set_being_processed ( )
inline

Sets inner process state to being processed.

void makefile_record::set_process_state ( process_states  state)
inline

Manually sets current process state.

Parameters
stateprocess_states to set to.

The documentation for this class was generated from the following files: