Remake
|
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
Go to the source code of this file.
Classes | |
struct | ref_ptr< T > |
struct | ref_ptr< T >::content |
struct | dependency_t |
struct | status_t |
struct | assign_t |
struct | rule_t |
struct | job_t |
struct | client_t |
struct | log |
struct | log_auto_close |
struct | escape_string |
struct | generator |
struct | variable_generator |
struct | input_generator |
struct | addprefix_generator |
struct | addsuffix_generator |
Macros | |
#define | DEBUG if (debug.active) debug() |
#define | DEBUG_open log_auto_close auto_close; if (debug.active) debug(true) |
#define | DEBUG_close if ((auto_close.still_open = false), debug.active) debug(false) |
Typedefs | |
typedef int | socket_t |
typedef std::list< std::string > | string_list |
typedef std::set< std::string > | string_set |
typedef std::map< std::string, ref_ptr< dependency_t > > | dependency_map |
typedef std::map< std::string, string_list > | variable_map |
typedef std::map< std::string, status_t > | status_map |
typedef std::map< std::string, assign_t > | assign_map |
typedef std::list< rule_t > | rule_list |
typedef std::map< std::string, ref_ptr< rule_t > > | rule_map |
typedef std::map< int, job_t > | job_map |
typedef std::map< pid_t, int > | pid_job_map |
typedef std::list< client_t > | client_list |
Enumerations | |
enum | { INVALID_SOCKET = -1 } |
enum | status_e { Uptodate , Todo , Recheck , Running , RunningRecheck , Remade , Failed } |
enum | { Unexpected = 0 , Word = 1 << 1 , Colon = 1 << 2 , Equal = 1 << 3 , Dollarpar = 1 << 4 , Rightpar = 1 << 5 , Comma = 1 << 6 , Plusequal = 1 << 7 , Pipe = 1 << 8 } |
enum | input_status { Success , SyntaxError , Eof } |
Variables | |
char ** | environ |
static variable_map | variables |
static dependency_map | dependencies |
static status_map | status |
static rule_list | generic_rules |
static rule_map | specific_rules |
static job_map | jobs |
static pid_job_map | job_pids |
static client_list | clients |
static int | max_active_jobs = 1 |
static bool | keep_going = false |
static int | running_jobs = 0 |
static int | waiting_jobs = 0 |
static int | job_counter = 0 |
static socket_t | socket_fd |
static bool | build_failure |
static char * | socket_name |
static std::string | first_target |
static bool | show_targets = true |
static bool | echo_scripts = false |
static time_t | now = time(NULL) |
static std::string | working_dir |
static std::string | prefix_dir |
static bool | changed_prefix_dir |
static bool | propagate_vars = false |
static bool | obsolete_targets = false |
static sigset_t | old_sigmask |
static volatile sig_atomic_t | got_SIGCHLD = 0 |
static log | debug |
Definition at line 817 of file remake.cpp.
Referenced by accept_client(), complete_job(), get_status(), load_dependencies(), load_rule(), load_rules(), and main().
Definition at line 819 of file remake.cpp.
Referenced by accept_client(), get_status(), handle_clients(), load_dependencies(), load_rule(), run_script(), start(), still_need_rebuild(), and update_status().
#define DEBUG_open log_auto_close auto_close; if (debug.active) debug(true) |
Definition at line 818 of file remake.cpp.
Referenced by accept_client(), client_mode(), complete_request(), create_server(), get_status(), handle_clients(), load_dependencies(), load_rule(), load_rules(), run_script(), save_dependencies(), server_loop(), start(), still_need_rebuild(), and update_status().
typedef std::map<std::string, assign_t> assign_map |
Definition at line 555 of file remake.cpp.
typedef std::list<client_t> client_list |
Definition at line 613 of file remake.cpp.
typedef std::map<std::string, ref_ptr<dependency_t> > dependency_map |
Definition at line 517 of file remake.cpp.
typedef std::map<pid_t, int> pid_job_map |
Definition at line 586 of file remake.cpp.
Definition at line 570 of file remake.cpp.
Definition at line 462 of file remake.cpp.
typedef std::map<std::string, status_t> status_map |
Definition at line 544 of file remake.cpp.
typedef std::list<std::string> string_list |
Definition at line 471 of file remake.cpp.
typedef std::set<std::string> string_set |
Definition at line 473 of file remake.cpp.
typedef std::map<std::string, string_list> variable_map |
Definition at line 519 of file remake.cpp.
Build status of a target.
Definition at line 524 of file remake.cpp.
|
static |
Write the string in se to out if it does not contain any special characters, a quoted and escaped string otherwise.
Definition at line 836 of file remake.cpp.
Definition at line 763 of file remake.cpp.
Referenced by create_server().
Definition at line 768 of file remake.cpp.
Referenced by create_server().
|
static |
Whether the request of an original client failed.
Definition at line 704 of file remake.cpp.
Referenced by complete_request(), and server_mode().
|
static |
Whether the prefix directory is different from working_dir.
Definition at line 746 of file remake.cpp.
Referenced by init_prefix_dir(), and server_mode().
|
static |
List of clients waiting for a request to complete. New clients are put to front, so that the build process is depth-first.
Definition at line 655 of file remake.cpp.
Referenced by accept_client(), handle_clients(), server_loop(), server_mode(), and start().
|
static |
Definition at line 803 of file remake.cpp.
Referenced by main(), and log_auto_close::~log_auto_close().
|
static |
Map from targets to their known dependencies.
Definition at line 624 of file remake.cpp.
Referenced by accept_client(), get_status(), load_dependencies(), main(), register_scripted_rule(), register_transparent_rule(), run_script(), save_dependencies(), and still_need_rebuild().
Whether script commands are echoed.
Definition at line 726 of file remake.cpp.
Referenced by main(), and run_script().
|
extern |
Referenced by run_script().
|
static |
Name of the first target of the first specific rule, used for default run.
Definition at line 716 of file remake.cpp.
Referenced by register_rule(), and server_mode().
|
static |
Set of generic rules loaded from Remakefile.
Definition at line 634 of file remake.cpp.
Referenced by find_generic_rule(), load_rule(), and server_mode().
|
static |
Definition at line 761 of file remake.cpp.
Referenced by server_loop(), and sigchld_handler().
|
static |
Global counter used to produce increasing job numbers.
Definition at line 694 of file remake.cpp.
Referenced by start().
|
static |
Map from jobs to shell pids.
Definition at line 649 of file remake.cpp.
Referenced by finalize_job(), run_script(), and server_loop().
|
static |
Map of jobs being built.
Definition at line 644 of file remake.cpp.
Referenced by accept_client(), complete_job(), complete_request(), and start().
Whether to keep building targets in case of failure. Can be modified by the -k option.
Definition at line 667 of file remake.cpp.
Referenced by handle_clients(), main(), and sigint_handler().
|
static |
Maximum number of parallel jobs (non-positive if unbounded). Can be modified by the -j option.
Definition at line 661 of file remake.cpp.
Referenced by has_free_slots(), and main().
Time at the start of the program.
Definition at line 731 of file remake.cpp.
Referenced by update_status().
Whether targets are unconditionally obsolete.
Definition at line 756 of file remake.cpp.
Referenced by get_status(), and main().
|
static |
Definition at line 759 of file remake.cpp.
Referenced by create_server(), and run_script().
|
static |
Directory with respect to which targets are relative.
Definition at line 741 of file remake.cpp.
Referenced by init_prefix_dir(), init_working_dir(), main(), and server_mode().
Whether target-specific variables are propagated to prerequisites.
Definition at line 751 of file remake.cpp.
Referenced by accept_client(), load_rules(), and start().
|
static |
Number of jobs currently running:
Definition at line 680 of file remake.cpp.
Referenced by finalize_job(), handle_clients(), has_free_slots(), and run_script().
Whether a short message should be displayed for each target.
Definition at line 721 of file remake.cpp.
Referenced by complete_job(), init_prefix_dir(), main(), run_script(), and server_mode().
|
static |
Socket on which the server listens for client request.
Definition at line 699 of file remake.cpp.
Referenced by accept_client(), client_mode(), create_server(), server_loop(), and server_mode().
|
static |
Name of the server socket in the file system.
Definition at line 710 of file remake.cpp.
Referenced by client_mode(), create_server(), and server_mode().
|
static |
Map from targets to specific rules loaded from Remakefile.
Definition at line 639 of file remake.cpp.
Referenced by find_rule(), register_scripted_rule(), register_transparent_rule(), and server_mode().
|
static |
Map from targets to their build status.
Definition at line 629 of file remake.cpp.
Referenced by complete_job(), get_status(), handle_clients(), load_rule(), server_loop(), server_mode(), start(), still_need_rebuild(), and update_status().
|
static |
Map from variable names to their content. Initialized with the values passed on the command line.
Definition at line 619 of file remake.cpp.
Referenced by client_mode(), load_rules(), main(), server_mode(), start(), and variable_generator::variable_generator().
|
static |
Number of jobs currently waiting for a build request to finish:
Definition at line 688 of file remake.cpp.
Referenced by accept_client(), complete_request(), handle_clients(), and has_free_slots().
|
static |
Directory with respect to which command-line names are relative.
Definition at line 736 of file remake.cpp.
Referenced by init_working_dir(), and main().