summaryrefslogtreecommitdiff
path: root/cmsmvs/mc.exec
blob: ca22a182a912f392e1d81b3d03c0d0a4a25bc8e6 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* MAKECPIP EXEC      Make program to build a C/370 module           */
/*                    Author: George Petrov, 29 Sep 1994             */

arg fn . '(' cparms                   /* Filter name                 */
'pipe (end ?) < 'fn' makefile',       /* get all source files from   */
    '| frlab GLOBALS:'||,
    '| drop',
    '| strip',
    '| var globals'
cparms = cparms globals
say ''
say 'Compile options : 'cparms
say ''
if pos('REB',cparms) > 0 then do
parse var cparms cp1 'REB' . ' ' cp2  /* REBuild options specified ? */
cparms = cp1||cp2
pipe1=,
'pipe (end ?) < 'fn' makefile',       /* get all source files from   */
    '| nfind *'||,                    /* the makefile and compile    */
    '| frlab TEXT:'||,                /* only the those who are      */
    '| r: tolab MODULE:'||,           /* changed or never compiled   */
    '| drop',
    '| o: fanout',
    '| chop before str /(/',
    '| statew',
    '| c: fanout',                    /* compiled                    */
    '| specs /Compiling / 1 w1-3 n / .../ n',
    '| cons'
end
else do
pipe1=,
'pipe (end ?) < 'fn' makefile',       /* get all source files from   */
    '| nfind *'||,                    /* the makefile and compile    */
    '| frlab TEXT:'||,                /* only the those who are      */
    '| r: tolab MODULE:'||,           /* changed or never compiled   */
    '| drop',
    '| o: fanout',
    '| specs w1 1 /C/ nw w3 nw write w1 1 /TEXT A/ nw',
    '| chop before str /(/',
    '| statew',
    '| change (57 66) / /0/',
    '| sort 1.8 d',                  /* sort the date and time      */
    '| uniq 1-17 singles',           /* if the first is a source    */
    '| sort 1.8 d 64.2 d 57.2 d 60.2 d 66.8 d',    /* sort the date */
    '| uniq 1-8 first',          /*    if the first is a source    */
    '| locate 9.8 /C      /',         /* program then it has to be   */
    '| c: fanout',                    /* compiled                    */
    '| specs /Compiling / 1 w1-3 n / .../ n',
    '| cons'
end
pipe2= '?',
    'r:',
    '| drop',
    '| specs w1 1',                 /* save the module name in var  */
    '| var module',
    '?',
    'o:',
    '| specs w1 1',
    '| join * / /',
    '| var texts',                  /* save all the text file names */
    '?',                            /* for later include            */
    'c:',
    '| specs /CC / 1 w1-3 n /(NOTERM 'cparms'/ nw',   /* compile! */
    '| err: cms | cons',
    '?',
    'err:',
    '| strip both',
    '| nfind 0'||,
    '| var err',
    '| specs /----> Errors found! RC=/ 1 1-* n',
    '| cons'
/*  '| g: gate'*/
pipe1 pipe2
say ''
if symbol('err') = 'VAR' & err ^= 0 then do
      say 'Errors found in source files - link aborted! RC = 'err
      exit err
end
say 'Generating module 'module
'pipe cms cmod' fn texts' DMSCSL | > 'fn' LINK A'
'set cmstype ht'
'state 'fn' LINK A'
rcc = rc
'set cmstype rt'
if rcc = 0 then do
   say ''
   say 'ERRORS discovered during linking!'
   say 'See: 'fn' LINK A for more info'
end
exit rc
error:
say 'Error in REXX detected!'
Say 'Syntax error on line' Sigl':' Sourceline(Sigl)
Say 'Error was:' Errortext(RC)
return rc