[BACK]Return to enginechoice.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

File: [local] / src / usr.bin / make / enginechoice.c (download)

Revision 1.1, Mon Jan 13 15:41:53 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7

make the choice of engine explicit

simplify the running of .BEGIN/.END so that they pass through the engine
first (so they can now have dependencies). Error out properly if .BEGIN/.END
fails.

#include "config.h"
#include "defines.h"
#include "compat.h"
#include "make.h"

struct engine {
	void (*run_list)(Lst, bool *, bool *);
	void (*node_updated)(GNode *);
	void (*init)(void);
} 
	compat_engine = { Compat_Run, Compat_Update, Compat_Init }, 
	parallel_engine = { Make_Run, Make_Update, Make_Init }, 
	*engine;

void
choose_engine(bool compat)
{
	engine = compat ? &compat_engine: &parallel_engine;
	engine->init();
}

void
engine_run_list(Lst l, bool *has_errors, bool *out_of_date)
{
	engine->run_list(l, has_errors, out_of_date);
}

void
engine_node_updated(GNode *gn)
{
	engine->node_updated(gn);
}