1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
function c_to_o =
{
return [fromto %0%.c %0%.o [arg]];
}
function select_c =
{
return [match_mask src/[@1]/%.c [source_files]];
}
function get_cflags =
{
if [defined [@1]cflags] then
return [[@1]cflags];
return [cflags];
}
function get_ldflags =
{
if [defined [@1]ldflags] then
return [[@1]ldflags];
return [ldflags];
}
function get_libs =
{
if [defined [@1]libs] then
return [[@1]libs];
return [libs];
}
function get_program =
{
if [matches src/%/ [@1]] then
return [fromto src/%/ % [@1]]_;
return;
}
function octal =
{
result =;
number = [@1];
loop
{
if [expr [number] \=\= 0] then loopstop;
result = [expr [number] & 7][result];
number = [expr [number] / 8];
}
return 0[result];
}
function stripext =
{
return [fromto %0%.%1 %0% [@1]];
}
function is_library =
{
if [match_mask lib% [@1]] then
return [@1];
return;
}
function lib_deps =
{
targets = [match_mask -l% [arg]];
deps = ;
loop
{
lib = [head [targets]];
if [not [lib]] then loopstop;
targets = [tail [targets]];
if [match_mask src/[fromto -l% lib% [lib]]/%.c [source_files]] then
deps = [deps] [fromto -l% bin/lib%.a [lib]];
}
return [deps];
}
|