version 1.126, 2020/01/13 15:19:04 |
version 1.127, 2020/01/13 15:41:53 |
|
|
#include "pathnames.h" |
#include "pathnames.h" |
#include "init.h" |
#include "init.h" |
#include "job.h" |
#include "job.h" |
#include "compat.h" |
|
#include "targ.h" |
#include "targ.h" |
#include "suff.h" |
#include "suff.h" |
#include "str.h" |
#include "str.h" |
#include "main.h" |
#include "main.h" |
#include "lst.h" |
#include "lst.h" |
#include "memory.h" |
#include "memory.h" |
#include "make.h" |
|
#include "dump.h" |
#include "dump.h" |
|
#include "enginechoice.h" |
|
|
#define MAKEFLAGS ".MAKEFLAGS" |
#define MAKEFLAGS ".MAKEFLAGS" |
|
|
|
|
Parse_End(); |
Parse_End(); |
} |
} |
|
|
|
static void |
|
run_node(GNode *gn, bool *has_errors, bool *out_of_date) |
|
{ |
|
LIST l; |
|
|
|
Lst_Init(&l); |
|
Lst_AtEnd(&l, gn); |
|
engine_run_list(&l, has_errors, out_of_date); |
|
Lst_Destroy(&l, NOFREE); |
|
} |
|
|
int main(int, char **); |
int main(int, char **); |
/*- |
|
* main -- |
|
* The main function, for obvious reasons. Initializes variables |
|
* and a few modules, then parses the arguments give it in the |
|
* environment and on the command line. Reads the system makefile |
|
* followed by either Makefile, makefile or the file given by the |
|
* -f argument. Sets the .MAKEFLAGS PMake variable based on all the |
|
* flags it has received by then uses either the Make or the Compat |
|
* module to create the initial list of targets. |
|
* |
|
* Results: |
|
* If -q was given, exits -1 if anything was out-of-date. Else it exits |
|
* 0. |
|
* |
|
* Side Effects: |
|
* The program exits when done. Targets are created. etc. etc. etc. |
|
*/ |
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
static LIST targs; /* target nodes to create */ |
static LIST targs; /* target nodes to create */ |
bool outOfDate = true; /* false if all targets up to date */ |
bool outOfDate = false; /* false if all targets up to date */ |
|
bool errored = false; /* true if errors occurred */ |
char *machine = figure_out_MACHINE(); |
char *machine = figure_out_MACHINE(); |
char *machine_arch = figure_out_MACHINE_ARCH(); |
char *machine_arch = figure_out_MACHINE_ARCH(); |
char *machine_cpu = figure_out_MACHINE_CPU(); |
char *machine_cpu = figure_out_MACHINE_CPU(); |
|
|
Static_Lst_Init(&makefiles); |
Static_Lst_Init(&makefiles); |
Static_Lst_Init(&varstoprint); |
Static_Lst_Init(&varstoprint); |
Static_Lst_Init(&targs); |
Static_Lst_Init(&targs); |
|
Static_Lst_Init(&special); |
|
|
beSilent = false; /* Print commands as executed */ |
beSilent = false; /* Print commands as executed */ |
ignoreErrors = false; /* Pay attention to non-zero returns */ |
ignoreErrors = false; /* Pay attention to non-zero returns */ |
|
|
else |
else |
Targ_FindList(&targs, create); |
Targ_FindList(&targs, create); |
|
|
Job_Init(optj, compatMake); |
choose_engine(compatMake); |
/* If the user has defined a .BEGIN target, execute the commands |
Job_Init(optj); |
* attached to it. */ |
if (!queryFlag && node_is_real(begin_node)) |
if (!queryFlag) |
run_node(begin_node, &errored, &outOfDate); |
Job_Begin(); |
|
if (compatMake) |
if (!errored) |
/* Compat_Init will take care of creating all the |
engine_run_list(&targs, &errored, &outOfDate); |
* targets as well as initializing the module. */ |
|
outOfDate = Compat_Run(&targs); |
if (!queryFlag && !errored && node_is_real(end_node)) |
else { |
run_node(end_node, &errored, &outOfDate); |
/* Traverse the graph, checking on all the targets. */ |
|
outOfDate = Make_Run(&targs); |
|
} |
|
} |
} |
|
|
/* print the graph now it's been processed if the user requested it */ |
/* print the graph now it's been processed if the user requested it */ |
if (DEBUG(GRAPH2)) |
if (DEBUG(GRAPH2)) |
post_mortem(); |
post_mortem(); |
|
|
|
/* Note that we only hit this code if -k is used, otherwise we |
|
* exited early in case of errors. */ |
|
if (errored) |
|
Fatal("Errors while building"); |
|
|
if (queryFlag && outOfDate) |
if (queryFlag && outOfDate) |
return 1; |
return 1; |