File: grbmake.m

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (76 lines) | stat: -rw-r--r-- 2,362 bytes parent folder | download | duplicates (2)
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
function grbmake
%GRBMAKE compile the GraphBLAS library for statement coverage testing
%
% This function compiles ../Source to create the
% libgraphblas_tcov.so (or *.dylib) library, inserting code code for statement
% coverage testing.  It does not compile the mexFunctions.
%
% See also: grbcov_testmake, grbcover_edit

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0

if (ispc)
    error ('The tests in Tcov are not ported to Windows') ;
end

% copy the GB_rename.h and GB_coverage.c files
copyfile ('../GraphBLAS/rename/GB_rename.h', 'tmp_include/GB_rename.h') ;
copyfile ('GB_coverage.c', 'tmp_source/GB_coverage.c') ;

% create the include files and place in tmp_include
hfiles = [ ...
        dir('../Include/GraphBLAS.h') ; ...
        dir('../Source/*.h') ; ...
        dir('../GraphBLAS/Config/*.h') ; ...
        dir('../Source/include') ; ...
        dir('../Source/*/*.h') ; ...
        dir('../Source/*/include') ; ...
        dir('../Source/*/template') ; ...
        dir('../Source/*/factory') ; ...
        dir('../JITpackage/*.h') ; ...
        dir('../FactoryKernels/*.h') ; ] ;

count = grbcover_edit (hfiles, 0, 'tmp_include') ;
fprintf ('hfile count: %d\n', count) ;

% create the C files and place in tmp_source
cfiles = [ dir('../Source/*/*.c') ; ...
        dir('../FactoryKernels/*.c') ; ...
        % use Tcov/PreJIT kernels ...
        dir('PreJIT/*.c') ; ...
        % not the PreJIT kernels in the primary source:
        % dir('../PreJIT/*.c') ; ...
        % dir('../Config/GB_prejit.c') ; ...
        dir('../JITpackage/*.c')
        ] ;

count = grbcover_edit (cfiles, count, 'tmp_source') ;
fprintf ('cfile count: %d\n', count) ;

% save the count
fp = fopen ('tmp_cover/count', 'w') ;
fprintf (fp, '%d\n', count) ;
fclose (fp) ;

% revise this to match Source/include/GB_coverage.h
GBCOVER_MAX = 31000 ;
assert (count < GBCOVER_MAX) ;

% compile the libgraphblas_tcov.so library

have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
if (have_octave)
    need_rename = false ;
else
    need_rename = ~verLessThan ('matlab', '9.10') ;
end

if (need_rename)
    fprintf ('Rename with -DGBMATLAB=1\n') ;
    system (sprintf ('make -j%d MATLAB="-DGBMATLAB=1"', feature ('numcores'))) ;
else
    system (sprintf ('make -j%d', feature ('numcores'))) ;
end